-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
itype:bugstat:needs triageEvery issue needs to have an "area" and "itype" labelEvery issue needs to have an "area" and "itype" label
Description
Compiler version
3.7.2
Minimized code
//> using scala 3.7.2
import language.experimental.modularity
case class Event(tracked val payload: Payload)
enum Payload {
case Created()
}
val e = Event(Payload.Created())
def handleCreated(e: Event { def payload : Payload.Created}) = println(e.payload)
@main def run = e match {
case Event(payload: Payload.Created) => handleCreated(e.copy(payload = payload))
}
Output
Exception in thread "main" java.lang.ClassCastException: class Payload$Created cannot be cast to class scala.Function0 (Payload$Created and scala.Function0 are in unnamed module of loader 'app')
at demo$package$.handleCreated(demo.scala:12)
at demo$package$.run(demo.scala:15)
at run.main(demo.scala:14)
Expectation
Either a compile error, or just Created()
in the output.
Metadata
Metadata
Assignees
Labels
itype:bugstat:needs triageEvery issue needs to have an "area" and "itype" labelEvery issue needs to have an "area" and "itype" label