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

@adt, mixins and optionality changes don't play well #1457

Open
kubukoz opened this issue Mar 25, 2024 · 3 comments
Open

@adt, mixins and optionality changes don't play well #1457

kubukoz opened this issue Mar 25, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@kubukoz
Copy link
Member

kubukoz commented Mar 25, 2024

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.

@kubukoz kubukoz added the bug Something isn't working label Mar 25, 2024
@kubukoz
Copy link
Member Author

kubukoz commented Mar 25, 2024

Slightly related / worth considering the relation to: #1312

@Baccata
Copy link
Contributor

Baccata commented Mar 25, 2024

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

@kubukoz
Copy link
Member Author

kubukoz commented Mar 25, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants