Skip to content

Spurious exhaustivity warning #8203

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
Jasper-M opened this issue Feb 5, 2020 · 0 comments · Fixed by #8206
Closed

Spurious exhaustivity warning #8203

Jasper-M opened this issue Feb 5, 2020 · 0 comments · Fixed by #8206

Comments

@Jasper-M
Copy link
Contributor

Jasper-M commented Feb 5, 2020

minimized code

Behold my beautiful enum.

sealed trait Pretty { self: Color => }      
sealed trait Dull { self: Color => }
enum Color  {
  case Pink extends Color with Pretty
  case Red extends Color with Dull
}

def describe(c: Color) = c match { 
  case Color.Pink => "Amazing!"
  case Color.Red => "Yawn..." 
}

Compilation output

8 |def describe(c: Color) = c match { 
  |                         ^
  |                         match may not be exhaustive.
  |
  |                         It would fail on pattern case: _: Color

expectation

No warning.

@liufengyun liufengyun self-assigned this Feb 5, 2020
liufengyun added a commit to dotty-staging/dotty that referenced this issue Feb 5, 2020
An enum value may have the type `A & B`, in such cases we
need to register for both `A` and `B`.
liufengyun added a commit that referenced this issue Feb 25, 2020
Fix #8203: handle intersection type in parent registration
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.

2 participants