Closed
Description
Compiler version
3.2.1-RC1-bin-20220831-398b72e-NIGHTLY
compiles without warnings with 3.2.0-RC1
Minimized code
sealed trait T[-U]
final case class C[U]() extends T[U]
def f[U](ua: T[U]) = ua match {
case ua: C[U] @unchecked => ???
}
Output
[warn] ./turboliftbug.scala:4:22: match may not be exhaustive.
[warn]
[warn] It would fail on pattern case: C()
[warn] def f[U](ua: T[U]) = ua match {
[warn] ^^
Expectation
No warning. (possibly)
I'm not 100% sure if the warning is correct or not. But this is a CB (#15949) fail, so decided to create an issue either way.
My reasoning is: Since C.U
is invariant and T.U
is contravariant, then the match can still fail on C[Any]
.
Though scala 2.13.8
doesn't give a warning here.