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

Json.writes[myScala3Enum] crashes play-json / the compilation? #1019

Open
nemoo opened this issue Apr 29, 2024 · 0 comments
Open

Json.writes[myScala3Enum] crashes play-json / the compilation? #1019

nemoo opened this issue Apr 29, 2024 · 0 comments

Comments

@nemoo
Copy link

nemoo commented Apr 29, 2024

Since somebody else had the same problem, I am now opening this ticket. I guess lots of users who are now starting to use scala 3 will run into this problem.

Expected behaviour
If play-json currently does not support scala 3 enums via Json.writes, it should tell the user that in a compiler message.

Actual behaviour
If Json.writes[T] is used on a scala 3 enum, compiling it with scala-cli or sbt crashes the compilation process. Compilation can only be killed via the task manager.

How to reproduce (tested on Java 11):

//> using scala 3.3.3
//> using dep org.playframework::play-json:3.0.2
import play.api.libs.json.*

enum Color:
  case red,green,blue

@main
def main =
  implicit val myWrites: OWrites[Color] = Json.writes[Color] //this line produces the crash
@nemoo nemoo changed the title Json.writes[myScala3Enum] crashes play-json / the compiler? Json.writes[myScala3Enum] crashes play-json / the compilation? Apr 29, 2024
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