Why does type parameter bound by sealed type seem not to raise exhaustivity warning
sealed trait A
case class B() extends A
case class C(i: Option[Int]) extends A
def f[T <: A](a: T) =
a match {
case B() =>
case C(None) =>
}
f(C(Some(42))) // throws MatchError
whilst without type parameter
def f(a: A) =
a match {
case B() =>
case C(None) =>
}
the warning is raised
warning: match may not be exhaustive.
It would fail on the following input: C(Some(_))
a match {
^