Skip to content

Spurious "Unreachable case" warning #14102

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

Closed
odersky opened this issue Dec 13, 2021 · 0 comments · Fixed by #14118
Closed

Spurious "Unreachable case" warning #14102

odersky opened this issue Dec 13, 2021 · 0 comments · Fixed by #14118
Assignees
Milestone

Comments

@odersky
Copy link
Contributor

odersky commented Dec 13, 2021

Compiler version

3.1.1-RC1

Minimized example

trait T[-X]
case class CC[-X](x: List[T[X]]) extends T[Nothing]
case class Id[-X](x: String) extends T[X]

def f[X](tree: T[X]) = tree match
  case CC(Id("hi") :: Nil) => ???
  case CC(refs) => ???
  case _ => ???

Output

-- [E030] Match case Unreachable Warning: ../../new/test.scala:8:7 -------------
8 |  case CC(refs) => ???
  |       ^^^^^^^^
  |       Unreachable case
1 warning found

Expectation

No warning

@dwijnand dwijnand self-assigned this Dec 13, 2021
@dwijnand dwijnand linked a pull request Dec 15, 2021 that will close this issue
@Kordyjan Kordyjan added this to the 3.1.2 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants