In Scala 2.10.0-M4
object X
def f(e: Either[Int, X.type]) = e match {
case Left(i) => i
case Right(X) => 0
}
gives:
warning: match may not be exhaustive.
It would fail on the following input: Right(<not X>)
Is this correct? Surely the match is in fact exhaustive.
(Meanwhile, back in Scala 2.9.X we get
error: pattern type is incompatible with expected type;
found : object X
required: X.type
case Right(X) => 0
which presumably was a bug.)
And it's been patched, c.f. https://github.com/retronym/scala/compare/ticket/5968.