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

Scala 3 enums cause error at runtime #178

Open
hejfelix opened this issue Dec 8, 2021 · 1 comment
Open

Scala 3 enums cause error at runtime #178

hejfelix opened this issue Dec 8, 2021 · 1 comment

Comments

@hejfelix
Copy link

hejfelix commented Dec 8, 2021

enum Event:
  case Increment
  case Decrement

val eventPickler = summon[_root_.boopickle.Pickler[Event]]

at runtime, I get the following:

Cannot add same class (fennec.examples.CounterKernel$Event) twice to a composite pickler

looks like it's finding the type Event for both cases, which is how Scala 3 seems to treat enums wrt. type inference, so maybe it's natural.

@hejfelix
Copy link
Author

hejfelix commented Dec 8, 2021

It does indeed seem to work for the cases individually:

val incPickler   = summon[Pickler[Event.Increment.type]]
val decPickler   = summon[Pickler[Event.Decrement.type]]

the above goes by without problems.

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