Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use string interpolation. fix warnings #615

Merged
merged 1 commit into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ trait ContextProcessor extends ScalaNames with PackageName {
.split("[:/]") // Split the namespace URI into fragments
.map {_.filter(allowedChars)} // Package name must be valid
.filter(!_.isEmpty) // Drop empty fragments
.map {str => if (numbers(str.head)) 'n' + str else str} // Package name can't start with a number
.map {str => if (numbers(str.head)) s"n${str}" else str} // Package name can't start with a number
.tail // Drop the first fragment, which is usually "http"
.mkString(".") // Concat the fragments
)}
Expand Down
4 changes: 2 additions & 2 deletions cli/src/main/scala/scalaxb/compiler/xsd/Lookup.scala
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ trait Lookup extends ContextProcessor {
buildTypeName(packageName(decl, context), decl, shortLocal)

def buildTypeName(pkg: Option[String], decl: Decl, shortLocal: Boolean): String = {
if (!context.typeNames.contains(decl)) sys.error(pkg + ": Type name not found: " + decl.toString)
if (!context.typeNames.contains(decl)) sys.error(s"${pkg}: Type name not found: " + decl.toString)

if (shortLocal && pkg == packageName(schema, context)) context.typeNames(decl)
else buildFullyQualifiedNameFromPackage(pkg, context.typeNames(decl))
Expand All @@ -183,7 +183,7 @@ trait Lookup extends ContextProcessor {
val pkg = packageName(schema, context)
val typeNames = context.enumValueNames(pkg)
if (!typeNames.contains(enumTypeName, enum))
sys.error(pkg + ": Type name not found: " + enum.toString)
sys.error(s"${pkg}: Type name not found: " + enum.toString)

if (shortLocal && pkg == packageName(schema, context)) typeNames(enumTypeName, enum)
else buildFullyQualifiedNameFromPackage(pkg, typeNames(enumTypeName, enum))
Expand Down