Open
Description
Compiler version
3.4.2-RC1-bin-SNAPSHOT-nonbootstrapped-git-7f410aa
Minimized code
type IllegalMatch1[T] = T match {
case Int => java.lang.Integer
case a | Null => a
case _ => T
}
type IllegalMatch2[T] = T match {
case a | Null => a
case _ => T
}
Output
-- [E191] Type Error: Stest.scala:84:26 ----------------------------------------
84 |type IllegalMatch2[T] = T match {
| ^
| The match type contains an illegal case:
| case a | Null => a
| (this error can be ignored for now with `-source:3.3`)
85 | case a | Null => a
86 | case _ => T
87 |}
Expectation
case a | Null => ???
is an illegal case based on the specification of match types (#18262).
The illegal cases in both IllegalMatch1
and IllegalMatch2
should be reported at the definition site.
Discussed at: https://users.scala-lang.org/t/updated-to-scala-3-4-0-and-now-getting-compiler-crash/9825/10