Skip to content

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

Description

@nemoo

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions