play-json
play-json copied to clipboard
Json.writes[myScala3Enum] crashes play-json / the compilation?
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
Duplicate of #1017