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

Support Scala 3 Union Types #811

Open
lvitaly opened this issue Nov 30, 2023 · 0 comments
Open

Support Scala 3 Union Types #811

lvitaly opened this issue Nov 30, 2023 · 0 comments

Comments

@lvitaly
Copy link
Contributor

lvitaly commented Nov 30, 2023

It looks like Scala 3 Union Types could replace Shapeless Coproduct. But in practice, usage of the Union Type leads to an error like this.

[error] -- [E172] Type Error:
[error] 17 |        implicit override lazy val s5: Serde[PushMessageCommand] = Avro4sSerde(client)
[error]    |                                                                                      ^
[error]    |No given instance of type com.sksamuel.avro4s.Encoder[model.SendPushMessage |
[error]    |  model.MarkIsRead] was found.
[error]    |I found:
[error]    |
[error]    |    com.sksamuel.avro4s.Encoder.autoDerived[
[error]    |        model.SendPushMessage |
[error]    |          model.MarkIsRead
[error]    |    ](
[error]    |      /* missing */
[error]    |        summon[
[error]    |          deriving.Mirror.Of[
[error]    |            model.SendPushMessage |
[error]    |              model.MarkIsRead
[error]    |          ]
[error]    |        ]
[error]    |    )
[error]    |
[error]    |But Failed to synthesize an instance of type deriving.Mirror.Of[
[error]    |  model.SendPushMessage |
[error]    |    model.MarkIsRead
[error]    |]:
[error]    |	* type `model.SendPushMessage |
[error]    |  model.MarkIsRead` is not a generic product because its subpart `model.SendPushMessage |
[error]    |  model.MarkIsRead` is a top-level union type.
[error]    |	* type `model.SendPushMessage |
[error]    |  model.MarkIsRead` is not a generic sum because its subpart `model.SendPushMessage |
[error]    |  model.MarkIsRead` is a top-level union type..
[error]    |----------------------------------------------------------------------------
[error]    |Inline stack trace
[error]    |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[error]    |This location contains code that was inlined from impl.scala:86
[error]    |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[error]    |This location contains code that was inlined from impl.scala:86
[error]    |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[error]    |This location contains code that was inlined from impl.scala:86
[error]    |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[error]    |This location contains code that was inlined from impl.scala:86
[error]    |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[error]    |This location contains code that was inlined from impl.scala:86
[error]    |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[error]    |This location contains code that was inlined from impl.scala:86
[error]     ----------------------------------------------------------------------------

Scala 3.3.1
avro4s 5.0.7

What do you think about the possibility of supporting Union Types?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant