disneystreaming / smithy4s

https://disneystreaming.github.io/smithy4s/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`@adt`, mixins and optionality changes don't play well together

kubukoz opened this issue · comments

If you apply a mixin to a shape, and then make an inherited field required, smithy4s will not generate an extends with that mixin.

However, if such a shape is part of and @adt union, the union still has extends. This results in a compilation error:

$version: "2"

namespace input

@mixin
structure HasName {
    name: String
}

structure Person with [HasName] {
    @required
    $name
}

@smithy4s.meta#adt
union U {
    p: Person
}
[error] /Users/kubukoz/projects/demos/target/scala-2.13/src_managed/main/scala/input/U.scala:31:27: incompatible type in overriding
[error] def name: Option[String] (defined in trait HasName);
[error]  found   : String
[error]  required: Option[String]
[error]   final case class Person(name: String) extends U {
[error]                           ^
[error] one error found

Checked in 0.18.15.

Slightly related / worth considering the relation to: #1312

Don't have much thoughts about it besides "let's fix it I guess ?"

yeah, I think we're gonna have to extend #425.

Looks like it's closed in #1510