Open
Description
Compiler version
3.3.3, 3.4.0, 3.4.1-RC2
Minimized code
sealed trait Foo[A]
final case class Bar[A, B <: A]() extends Foo[A]
/*
def getB[A](f: Foo[A]): Unit = f match {
case bar: Bar[A, b] =>
println(summon[b <:< A])
}
*/
def getB[A](f: Foo[A]): Unit = f match {
case bar1: Bar[A, ? <: A] => bar1 match {
case bar2: Bar[A, b] =>
println(summon[b <:< A])
}
}
Output
If we uncomment faulty implementation, the compiler outputs:
Cannot prove that b <:< A.
Expectation
I believe the both variants are equivalent and should work.