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

False warning about non-exhaustive match #16539

Closed
rskfocus opened this issue Dec 15, 2022 · 0 comments · Fixed by #16573
Closed

False warning about non-exhaustive match #16539

rskfocus opened this issue Dec 15, 2022 · 0 comments · Fixed by #16573

Comments

@rskfocus
Copy link

Compiler version

3.2.1

Minimized code

sealed trait Tag[A]

enum Hidden:
  case Reveal[A](
    init: A,
    reduce: (A, A) => A
  ) extends Hidden with Tag[A]

trait Handle[C]:
  def apply[A](c: C & Tag[A]): A

val x = new Handle[Hidden] {
  def apply[A](c: Hidden & Tag[A]): A = c match {
    case Hidden.Reveal(x, _) => x
  }
}

Output

[warn] -- [E029] Pattern Match Exhaustivity Warning: /home/<redacted>:51:42 
[warn] 51 |    def apply[A](c: Hidden & Tag[A]): A = c match {
[warn]    |                                          ^
[warn]    |                      match may not be exhaustive.
[warn]    |
[warn]    |                      It would fail on pattern case: Hidden.Reveal(_, _)

Expectation

No warning is emitted by compiler.

@rskfocus rskfocus added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Dec 15, 2022
@anatoliykmetyuk anatoliykmetyuk added area:pattern-matching and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Dec 19, 2022
@dwijnand dwijnand linked a pull request Dec 22, 2022 that will close this issue
@Kordyjan Kordyjan added this to the 3.3.0 milestone Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants