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

forward port knowledge of private and sealed traits in exhaustivity warnings #14579

Closed
bishabosha opened this issue Feb 28, 2022 · 0 comments · Fixed by #14599
Closed

forward port knowledge of private and sealed traits in exhaustivity warnings #14579

bishabosha opened this issue Feb 28, 2022 · 0 comments · Fixed by #14599
Assignees
Labels
Milestone

Comments

@bishabosha
Copy link
Member

port fixes from scala 2 that closed scala/scala#9211

Compiler version

3.1.1

Minimized code

trait A {
  sealed abstract class X
  private class X1 extends X with X2 { }
  private trait X2 extends X
  sealed trait X3 extends X

  def f(x: X) = x match {
    case _: X1 => 0
  }
}

Output

-- [E029] Pattern Match Exhaustivity Warning: ----------------------------------
7 |  def f(x: X) = x match {
  |                ^
  |                match may not be exhaustive.
  |
  |                It would fail on pattern case: _: X2, _: X3

Expectation

No warning, like scala 2

@bishabosha bishabosha added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label area:pattern-matching area:reporting Error reporting including formatting, implicit suggestions, etc and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Feb 28, 2022
@dwijnand dwijnand added Spree Suitable for a future Spree and removed area:reporting Error reporting including formatting, implicit suggestions, etc labels Feb 28, 2022
@Kordyjan Kordyjan added this to the 3.1.3 milestone Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants