Skip to content

Exhaustivity checks do not dealias types nested in or-types #2254

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
abgruszecki opened this issue Apr 13, 2017 · 1 comment
Closed

Exhaustivity checks do not dealias types nested in or-types #2254

abgruszecki opened this issue Apr 13, 2017 · 1 comment

Comments

@abgruszecki
Copy link
Contributor

As in the title:

scala> def m(s: Int | Float | String) = s match {
         case _: Int => ; case _: Float => ; case _: String => ; }
def m(s: Int | Float | String): Unit
scala> type OrAlias = Int | Float
defined type alias OrAlias
scala> def m(s: OrAlias | String) = s match {
         case _: Int => ; case _: Float => ; case _: String => ; }
-- [E028] Pattern Match Exhaustivity Warning: <console> ------------------------
5 |def m(s: OrAlias | String) = s match {
  |                             ^
  |                             match may not be exhaustive.
  |
  |                             It would fail on: _: OrAlias
6 |  case _: Int => ; case _: Float => ; case _: String => ; }
def m(s: OrAlias | String): Unit
@liufengyun
Copy link
Contributor

Thanks a lot @AleksanderBG , very good findings. I just pushed two fixes, I hope they are correct :)

@liufengyun liufengyun self-assigned this Apr 13, 2017
liufengyun added a commit that referenced this issue Apr 13, 2017
fix #2254: dealias types in decomposition of spaces
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

2 participants