Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.13 regression: false negative, missing unreachable warning after extractor returning Some #13085

Open
SethTisue opened this issue Feb 12, 2025 · 1 comment

Comments

@SethTisue
Copy link
Member

SethTisue commented Feb 12, 2025

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).
@SethTisue
Copy link
Member Author

this may be tangled up with tickets such as #11457

@SethTisue SethTisue changed the title 2.13 regression: false negative, missing unreachable warning on extractor returning Some 2.13 regression: false negative, missing unreachable warning after extractor returning Some Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant