Closed
Description
Compiler version
3.1.1
Minimized code
enum Foo:
case One(value: String)
case Two(value: Long, month: java.time.Month)
object Issue:
def doSomething(foo: Foo): String = foo match {
case Foo.One(x) => s"1 $x"
case Foo.Two(x, y) => s"2 $x $y"
}
Output
[warn] ./patmatbug.scala:9:10: Unreachable case
[warn] case Foo.Two(x, y) => s"2 $x $y"
[warn] ^^^^^^^^^^^^^
Expectation
Compiles without warnings, like Scala 2.13.
Notes
Surprisingly, if I switch the lines around to make case Foo.Two(x, y)
the very first case in the match, the warning goes away.