runarorama / scala-machines

A stream processing library for Scala
MIT License
212 stars 25 forks source link

Scala 2.10.0 warning for non exhaustive pattern match. #9

Open markhibberd opened 11 years ago

markhibberd commented 11 years ago

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 commented 11 years ago

https://github.com/markhibberd/scala-machines/commit/629a16e8fe27e5dbd6e136488b5b319a3d68a00b 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.