Open
Description
Compiler version
3.6.3
Minimized code
opaque type R[T] <: T = T
object Test {
enum E:
case E(a: Int)
val v: R[E] = ???
v match
case E.E(_) =>
}
Output
[warn] ./opaque_subtype.scala:8:3
[warn] match may not be exhaustive.
[warn]
[warn] It would fail on pattern case: _: R[E]
[warn] v match
[warn]
Expectation
The code should compile without warnings.
Adding the case from the exhaustive warning like this
opaque type R[T] <: T = T
object Test {
enum E:
case E(a: Int)
val v: R[E] = ???
v match
case E.E(_) =>
case _: R[E] =>
}
also does not compile with
[warn] ./dev/eejbyfeldt/scala_playground/opaque_subtype.scala:10:10
[warn] Unreachable case
[warn] case _: R[E] =>
[warn]