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

Scala 2.10.0 warning for non exhaustive pattern match. #9

Open
markhibberd opened this issue Feb 4, 2013 · 1 comment
Open

Scala 2.10.0 warning for non exhaustive pattern match. #9

markhibberd opened this issue Feb 4, 2013 · 1 comment

Comments

@markhibberd
Copy link
Contributor

I think this could be an issue with the compiler. As far as I can tell the cases that it warns about are not possible because of the Nothing. A simple example shows the compiler change: https://gist.github.com/4705894

Is there a preference for working around the issue by putting in the missing cases even though they can't be reached, or ignoring the warning? I will do up another pull request if someone thinks it is worth working around.

@markhibberd
Copy link
Contributor Author

markhibberd@629a16e Is an example of the pain a workaround would unleash on the world.

Not sure of the best way to handle, I filled in missing cases with: case Return(a) => a. The primary reason for choosing this over, case Return(_) => sys.error("derp") or similar is that if someone was to copy and paste or modify the code in a way, that a was no longer of type Nothing it should generate a compiler error whereas sys.error and friends would continue to play along happily.

Let me know what you think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant