Skip to content

Commit

Permalink
TO REMOVE ???
Browse files Browse the repository at this point in the history
  • Loading branch information
daddykotex committed Dec 19, 2023
1 parent d8759a4 commit 07ec5bd
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .mill-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.11.1
0.11.6
7 changes: 3 additions & 4 deletions buildSetup.sc
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,8 @@ case class ScalacOption(

// format: off
private val allScalacOptions = Seq(
ScalacOption("-Xsource:3", isSupported = version => v211 <= version || version < v300), // Treat compiler input as Scala source for the specified version, see scala/bug#8126.
ScalacOption("-deprecation", isSupported = version => version < v213 || v300 <= version), // Emit warning and location for usages of deprecated APIs. Not really removed but deprecated in 2.13.
ScalacOption("-migration", isSupported = v300 <= _), // Emit warning and location for migration issues from Scala 2.
ScalacOption("-Xsource:3", isSupported = version => v211 <= version && version < v300), // Treat compiler input as Scala source for the specified version, see scala/bug#8126.
ScalacOption("-deprecation", isSupported = version => version < v213 && v300 <= version), // Emit warning and location for usages of deprecated APIs. Not really removed but deprecated in 2.13.
ScalacOption("-explaintypes", isSupported = _ < v300), // Explain type errors in more detail.
ScalacOption("-explain-types", isSupported = v300 <= _), // Explain type errors in more detail.
ScalacOption("-explain", isSupported = v300 <= _), // Explain errors in more detail.
Expand All @@ -188,7 +187,7 @@ private val allScalacOptions = Seq(
ScalacOption("-language:existentials,experimental.macros,higherKinds,implicitConversions", isSupported = v300 <= _), // the four options above, dotty style
ScalacOption("-unchecked"), // Enable additional warnings where generated code depends on assumptions.
ScalacOption("-Xcheckinit", isSupported = _ < v300), // Wrap field accessors to throw an exception on uninitialized access.
ScalacOption("-Xfatal-warnings"), // Fail the compilation if there are any warnings.
ScalacOption("-Xfatal-warnings", isSupported = _ < v300), // Fail the compilation if there are any warnings.
ScalacOption("-Xlint", isSupported = _ < v211), // Used to mean enable all linting options but now the syntax for that is different (-Xlint:_ I think)
ScalacOption("-Xlint:adapted-args", isSupported = version => v211 <= version && version < v300), // Warn if an argument list is modified to match the receiver.
ScalacOption("-Xlint:by-name-right-associative", isSupported = version => v211 <= version && version < v213), // By-name parameter of right associative operator.
Expand Down
43 changes: 21 additions & 22 deletions modules/compiler-core/src/internals/IModelToSmithy.scala
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ private[compiler] final class IModelToSmithy(useEnumTraitSyntax: Boolean)
extends (IModel => Model) {

def apply(iModel: IModel): Model = {
val shapes = iModel.definitions.map {
val shapes: Vector[JShape] = iModel.definitions.map {
case Structure(id, fields, _, structHints) =>
val members = fields.map { case Field(id, tpe, hints) =>
val memName = id.memberName.value.toString
Expand Down Expand Up @@ -130,27 +130,28 @@ private[compiler] final class IModelToSmithy(useEnumTraitSyntax: Boolean)
}
builder.build()
case Newtype(id, target, hints) =>
val builder = target.name.segments.last.value.toString match {
case "String" => StringShape.builder()
case "Integer" => IntegerShape.builder()
case "Long" => LongShape.builder()
case "BigInteger" => BigIntegerShape.builder()
case "BigDecimal" => BigDecimalShape.builder()
case "Short" => ShortShape.builder()
case "Float" => FloatShape.builder()
case "Double" => DoubleShape.builder()
case "Boolean" => BooleanShape.builder()
case "Byte" => ByteShape.builder()
case "Timestamp" => TimestampShape.builder()
case "Document" => DocumentShape.builder()
case "UUID" => StringShape.builder().addTrait(new UuidFormatTrait())
case "Null" =>
StructureShape.builder().addTrait(new NullFormatTrait())
case other => sys.error(s"error processing $id, found $other")
}
val builder: AbstractShapeBuilder[_, _] =
target.name.segments.last.value.toString match {
case "String" => StringShape.builder()
case "Integer" => IntegerShape.builder()
case "Long" => LongShape.builder()
case "BigInteger" => BigIntegerShape.builder()
case "BigDecimal" => BigDecimalShape.builder()
case "Short" => ShortShape.builder()
case "Float" => FloatShape.builder()
case "Double" => DoubleShape.builder()
case "Boolean" => BooleanShape.builder()
case "Byte" => ByteShape.builder()
case "Timestamp" => TimestampShape.builder()
case "Document" => DocumentShape.builder()
case "UUID" => StringShape.builder().addTrait(new UuidFormatTrait())
case "Null" =>
StructureShape.builder().addTrait(new NullFormatTrait())
case other => sys.error(s"error processing $id, found $other")
}
builder.id(id.toSmithy)
hintsToTraits(hints).foreach(builder.addTrait(_))
builder.build()
builder.build().asInstanceOf[JShape] // WTF?
case OperationDef(id, input, output, errors, hints) =>
val builder =
OperationShape.builder().id(id.toSmithy)
Expand All @@ -167,8 +168,6 @@ private[compiler] final class IModelToSmithy(useEnumTraitSyntax: Boolean)
operations.foreach(o => builder.addOperation(o.toSmithy))
builder.build()
case e: Enumeration => buildEnum(e)
case other =>
throw new IllegalArgumentException(s"Unexpected input: $other")
}
val builder = Model.builder()
if (iModel.suppressions.nonEmpty) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ private[compiler] object AllOfTransformer extends IModelPostProcessor {
case _: ServiceDef => false
}
loop(tail, hasRef)
case _ :: tail => loop(tail, isReferenced)
}

loop(allShapes.toList)
Expand Down

0 comments on commit 07ec5bd

Please sign in to comment.