Pattern Matching inconsistency #22064
Labels
area:pattern-matching
area:reporting
Error reporting including formatting, implicit suggestions, etc
itype:bug
Compiler version
3.6.1
Minimized code
This does not issue a pattern match exhaustivity warning:
But this does:
Expectation
They should behave the same. The issue generally appears when matching against traits that don't have any case classes extending them, given certain generics. (Here
T[Int]
). But it does not appear when a trait simply has no case classes extending them, regardless of generics (T_B
).My guess is that this is related to the fact that the pattern matcher does not enforce covering nulls explicitly, so if the only way to create a case class is with a null it thinks that this case class could never be constructed (first program) and therefore also does not need to match against it
I believe my previous bug reports had this same issue at the root, and the fix in #21000 (which to my knowledge should be included in 3.6.1?) did not resolve this issue.
The text was updated successfully, but these errors were encountered: