Closed
Description
Compiler version
Tested both 3.1.3 and 3.2.0-RC1
Minimized code
case class Composite[T](l: List[T], v: T)
def m(composite: Composite[_]): Unit =
composite match {
case Composite(l: List[Int], v: Int) => println(v)
case _ => println("This is not Int")
}
Output
Two bad warnings. First one is major, second one minor. Reporting both together, because I think they have the same root cause.
Unreachable case except for null (if this is intentional, consider writing case null => instead).
Strangely, If I follow the advice and specify case null =>
I get a proper match may not be exhaustive.
warning.
the type test for List[Int] cannot be checked at runtime
Explanation: List[Int]
does not need to be checked at runtime, because matching second parameter as Int
fixes the possible type of the list.
Expectation
No warnings at all.