Open
Description
both Scala 2.12.20 and Scala 3.6.3 give an unreachable warning but Scala 2.13 does not:
trait Tree
object Tree {
def unapply(tree: Tree): Some[Int] = ???
}
object Test {
def foo(tree: Tree) =
tree match {
case Tree(_) => ???
case _ => "unreachable"
}
}
note that adding a case null => ???
line does causes the unreachable warning to emerge
the Scala 3 warning text is helpfully explicit about the status of null
:
-- [E121] Pattern Match Warning: -----------------------------------------------
9 | case _ => "unreachable"
| ^
|Unreachable case except for null (if this is intentional, consider writing case null => instead).