Closed
Description
Compiling this,
object Test {
def foo(t: AnyVal): Unit = t match {
case _: Int =>
}
}
gives me the following unreachable case error rather than the non-exhaustivity warning I was hoping for,
-- Error: local/nulls.scala:3:9 ------------------------------------------------
3 | case _: Int =>
| ^
|this case is unreachable since class AnyVal and class Integer are unrelated
1 error found
Assuming this is a bug and that this should instead give us a warning about a non-exhaustive match, then does this make the introduction of Null
as a subtype of AnyVal
with -Yexplict-nulls
in #7546 problematic? Presumably the extra case would make previously exhaustive matches over existing AnyVals
non-exhaustive?