Open
Description
Compiler version
3.5.0-RC1
Minimized code
A_1.scala
type M[X] = X match
case 0 => String
case 1 => Int
trait A:
type T
val str: M[0 & T] = "hello"
val int: M[1 & T]
B_2.scala
trait B extends A:
type T = 0 & 1
val int = str
@main def Test =
val a: A = new B {}
val i: Int = a.int
Output
java.lang.ClassCastException: class java.lang.String cannot be cast to class java.lang.Integer