Skip to content

Commit

Permalink
Merge pull request #615 from xuwei-k/interpolation
Browse files Browse the repository at this point in the history
use string interpolation. fix warnings
  • Loading branch information
eed3si9n committed Oct 4, 2023
2 parents a5895bb + 155cda6 commit 346e4e7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
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

0 comments on commit 346e4e7

Please sign in to comment.