-
Couldn't load subscription status.
- 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.3, 3.8.0-RC1-bin-20251028-11ecbfb-NIGHTLY
Minimized code
object test {
enum Expr[T] {
case IsOpt[T](left: Expr[T]) extends Expr[Boolean]
case Lit[T](value: T) extends Expr[T]
}
def main(args: Array[String]): Unit =
val _ = Expr.IsOpt(Expr.Lit(1)) match {
case Expr.IsOpt(opt: Expr.Lit[Option[?]]) => opt.value.isEmpty
case _ => None
}
}Output
Exception in thread "main" java.lang.ClassCastException: class java.lang.Integer cannot be cast to class scala.Option (java.lang.Integer is in module java.base of loader 'bootstrap'; scala.Option is in unnamed module of loader 'app')
at test$.main(expr_unsafe.scala:9)
at test.main(expr_unsafe.scala)
Expectation
There should be a warning that the type test for test.Expr.Lit[Option[_]] @_ cannot be checked at runtime
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