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

'match may not be exhaustive' warning when matching on singleton types #5968

Closed
scabug opened this issue Jun 23, 2012 · 4 comments
Closed

'match may not be exhaustive' warning when matching on singleton types #5968

scabug opened this issue Jun 23, 2012 · 4 comments
Assignees
Labels
Milestone

Comments

@scabug
Copy link

scabug commented Jun 23, 2012

    object X
    def f(e: Either[Int, X.type]) = e match {
      case Left(i) => i
      case Right(X) => 0
    }

gives:

    warning: match may not be exhaustive.
    It would fail on the following input: Right(<not X>)

Is this correct? Surely the match is in fact exhaustive.

(c.f. http://stackoverflow.com/questions/11166098/why-does-scala-2-10-give-match-may-not-be-exhaustive-warning-when-matching-on, where it was suggested I post this as a bug report.)

@scabug
Copy link
Author

scabug commented Jun 23, 2012

Imported From: https://issues.scala-lang.org/browse/SI-5968?orig=1
Reporter: Scott Morrison (scott)
Affected Versions: 2.10.0-M4
Other Milestones: 2.10.0

@scabug
Copy link
Author

scabug commented Jun 23, 2012

@retronym said:
This seems to do the trick: https://github.com/retronym/scala/compare/ticket/5968

@scabug
Copy link
Author

scabug commented Jun 24, 2012

@adriaanm said:
Awesome, thanks Jason! Could you please submit a pullreq?

@scabug
Copy link
Author

scabug commented Jun 25, 2012

@retronym said:
scala/scala@1ef679

@scabug scabug closed this as completed Jun 25, 2012
@scabug scabug added the patmat label Apr 7, 2017
@scabug scabug added this to the 2.10.0-M4 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants