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

fix Line is indented too far to the left warnings in Scala 3 #625

Merged
merged 1 commit into from
Oct 6, 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
4 changes: 2 additions & 2 deletions cli/src/main/scala/scalaxb/compiler/wsdl11/GenSource.scala
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ trait {interfaceTypeName}{taglessTypeConstraint} {{ self =>
{operationOutputs.mkString(NL + NL)}
</source>

val bindingTrait = <source>
val bindingTrait = <source>
trait {name}s{taglessTypeConstraint} {{ this: {selfType} =>
{if(config.httpClientStyle == HttpClientStyle.Tagless) "implicit protected def F: ApplicativeError[F, Throwable]" else ""}
lazy val targetNamespace: Option[String] = { xsdgenerator.quote(targetNamespace) }
Expand Down Expand Up @@ -201,7 +201,7 @@ trait {interfaceTypeName}{taglessTypeConstraint} {{ self =>
{operationOutputs.mkString(NL + NL)}
</source>

val bindingTrait = <source>
val bindingTrait = <source>
trait {name}s{taglessTypeConstraint} {{ this: {selfType} =>
{if(config.httpClientStyle == HttpClientStyle.Tagless) "implicit protected def F: ApplicativeError[F, Throwable]" else ""}
lazy val targetNamespace: Option[String] = { xsdgenerator.quote(targetNamespace) }
Expand Down
10 changes: 6 additions & 4 deletions cli/src/main/scala/scalaxb/compiler/xsd/GenSource.scala
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ class GenSource(val schema: SchemaDecl,
scalaxb.Helper.instanceType(node) match {{
{ val cases = for (sub <- baseToDescendants(decl) if sub.isNamed)
yield makeCaseEntry(sub)
cases.mkString(newline + indent(4 + compDepth))

cases.mkString(newline + indent(4 + compDepth))
}
{ if (!decl.abstractValue) "case _ => Right(" + buildFromXML(defaultType, "node", Some("stack"), None) + ")"
else """case x => Left("Unknown type: " + x)""" }
Expand All @@ -177,7 +178,8 @@ class GenSource(val schema: SchemaDecl,
__scope: scala.xml.NamespaceBinding, __typeAttribute: Boolean): scala.xml.NodeSeq = __obj match {{
{ val cases = for (sub <- context.baseToSubs(decl))
yield makeToXmlCaseEntry(sub)
cases.mkString(newline + indent(2 + compDepth))

cases.mkString(newline + indent(2 + compDepth))
}
{ if (!decl.abstractValue) "case x: " + defaultType + " => " +
buildToXML(defaultType, "x, __namespace, __elementLabel, __scope, __typeAttribute")
Expand Down Expand Up @@ -642,13 +644,13 @@ class GenSource(val schema: SchemaDecl,

val traitCode = enums match {
case Nil =>
<source>case class {localName}()
<source>case class {localName}()

object {localName} {{
def fromString(value: String, scope: scala.xml.NamespaceBinding): {localName} = {localName}()
}}</source>
case _ =>
<source>sealed trait {localName}
<source>sealed trait {localName}

object {localName} {{
def fromString(value: String, scope: scala.xml.NamespaceBinding)(implicit fmt: scalaxb.XMLFormat[{fqn}]): {localName} = fmt.reads(scala.xml.Text(value), Nil) match {{
Expand Down
4 changes: 2 additions & 2 deletions cli/src_managed/xmlschema/xmlschema_xmlprotocol.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3837,7 +3837,7 @@ trait XXMLProtocol extends scalaxb.XMLStandardTypes {
def toAttribute(__obj: xmlschema.XDefRef, __attr: scala.xml.MetaData, __scope: scala.xml.NamespaceBinding): scala.xml.MetaData = {
var attr: scala.xml.MetaData = __attr
__obj.name foreach { x => attr = scala.xml.Attribute(null, "name", x.toString, attr) }
__obj.ref foreach { x => attr = scala.xml.Attribute(null, "ref", scalaxb.Helper.toString(x, __scope), attr) }
__obj.ref foreach { x => attr = scala.xml.Attribute(null, "ref", scalaxb.Helper.toString(x, __scope), attr) }
attr
}
}
Expand All @@ -3854,7 +3854,7 @@ trait XXMLProtocol extends scalaxb.XMLStandardTypes {
def toAttribute(__obj: xmlschema.XOccurs, __attr: scala.xml.MetaData, __scope: scala.xml.NamespaceBinding): scala.xml.MetaData = {
var attr: scala.xml.MetaData = __attr
if (__obj.minOccurs.toString != "1") attr = scala.xml.Attribute(null, "minOccurs", __obj.minOccurs.toString, attr)
if (__obj.maxOccurs.toString != "1") attr = scala.xml.Attribute(null, "maxOccurs", __obj.maxOccurs.toString, attr)
if (__obj.maxOccurs.toString != "1") attr = scala.xml.Attribute(null, "maxOccurs", __obj.maxOccurs.toString, attr)
attr
}
}
Expand Down