Open
Description
Compiler version
3.7.1-RC1-bin-SNAPSHOT-nonbootstrapped-git-f0c050e
Minimized code
scala> type Person = (name: String, age: Int)
// defined alias type Person = (name : String, age : Int)
scala> val u = ("fred", 65)
val u: (String, Int) = (fred,65)
scala> val t = ("fred", 64)
val t: (String, Int) = (fred,64)
scala> val Fred: Person = t
val Fred: Person = (fred,64)
scala> ("bob", 24) match { case `u` => 0 }
1 warning found
-- [E029] Pattern Match Exhaustivity Warning: ----------------------------------
1 |("bob", 24) match { case `u` => 0 }
|^^^^^^^^^^^
|match may not be exhaustive.
|
|It would fail on pattern case: (_, _)
|
| longer explanation available when compiling with `-explain`
scala.MatchError: (bob,24) (of class scala.Tuple2)
... 33 elided
scala> Fred match { case `u` => 0 }
scala.MatchError: (fred,64) (of class scala.Tuple2)
... 33 elided
scala> (("bob", 24): Person) match { case (x, 48) => 0 }
scala.MatchError: (bob,24) (of class scala.Tuple2)
... 33 elided
scala>
Expectation
This seems like a natural thing to do, so I expect the warning.