-
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.3.7. 3.7.3, 3.8.0-RC1-bin-20251106-b6d9a6d-NIGHTLY
Minimized code
object test {
class E1 extends Exception
class E2 extends Exception
type E1or2 = E1 | E2
def main(args: Array[String]): Unit = {
try throw new Exception {}
catch
case e: E1or2 => assert(e.isInstanceOf[E1or2])
case _ => ()
}
}Output
$ scala-cli run -S 3.nightly catch_union.scala
Compiling project (Scala 3.8.0-RC1-bin-20251106-b6d9a6d-NIGHTLY, JVM (21))
Compiled project (Scala 3.8.0-RC1-bin-20251106-b6d9a6d-NIGHTLY, JVM (21))
Exception in thread "main" java.lang.AssertionError: assertion failed
at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:13)
at test$.main(catch_union.scala:9)
at test.main(catch_union.scala)Expectation
The code should run without issues since. The case e: E1orE2 should only match E1 | E2 and inlineing the alias E1orE2 does have this correct behavior.
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