Closed
Description
Minimized code
class A
class B
def test(x: (A, B) | (B, A)) = x match {
case (u: A, v) => (u, v)
case (u: B, v) => (v, u)
}
https://scastie.scala-lang.org/ifiEqLPETBq2eruEbFXfFQ
Output
match may not be exhaustive.
It would fail on pattern case: Tuple2(_, _)
Moreover, the type inferred for v
is always Object
, whereas it could be more precise here.
Expectation
No warning, and more precise types.