Skip to content

Commit

Permalink
Remove extra widen
Browse files Browse the repository at this point in the history
  • Loading branch information
kubukoz committed Oct 3, 2024
1 parent 04f9e83 commit e143b46
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import smithy4s.schema.Schema.string
object TestString extends Newtype[String] {
val id: ShapeId = ShapeId("smithy4s.example", "TestString")
val hints: Hints = Hints(
smithy4s.example.TestTrait(orderType = Some(smithy4s.example.OrderType.InStoreOrder(id = smithy4s.example.OrderNumber(100), locationId = Some("someLocation")).widen)),
smithy4s.example.TestTrait(orderType = Some(smithy4s.example.OrderType.InStoreOrder(id = smithy4s.example.OrderNumber(100), locationId = Some("someLocation")))),
).lazily
val underlyingSchema: Schema[String] = string.withId(id).addHints(hints)
implicit val schema: Schema[TestString] = bijection(underlyingSchema, asBijection)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import smithy4s.schema.Schema.string
object ReservedNameUnionTrait extends Newtype[java.lang.String] {
val id: ShapeId = ShapeId("smithy4s.example.collision", "ReservedNameUnionTrait")
val hints: Hints = Hints(
smithy4s.example.collision.Class.AdtStruct().widen,
smithy4s.example.collision.Class.AdtStruct(),
).lazily
val underlyingSchema: Schema[java.lang.String] = string.withId(id).addHints(hints)
implicit val schema: Schema[ReservedNameUnionTrait] = bijection(underlyingSchema, asBijection)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1617,10 +1617,7 @@ private[internals] class Renderer(compilationUnit: CompilationUnit) { self =>
line"${ref.show}.${altName.capitalize}Case.widen".write

case AltTN(_, _, AltValueTN.ProductAltTN(alt)) =>
// The `widen` is necessary in Scala 3.
// Without it, there are two schemas (the struct and the union) that match the type
// for the conversion to Hints.Binding.
line"${alt.runDefault}.widen".write
alt.runDefault.write

case CollectionTN(collectionType, values) =>
val col = collectionType.tpe
Expand Down

0 comments on commit e143b46

Please sign in to comment.