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
Incorrect exhaustiveness warning with tuple with Boolean values #7466
Comments
Imported From: https://issues.scala-lang.org/browse/SI-7466?orig=1 |
@paulp said (edited on May 9, 2013 2:16:53 PM UTC): Declare the constants so they will be seen as such, and the warning goes away: final val Yes1 = true
final val Yes2 = true
final val No1 = false
final val No2 = false |
@paulp said: |
@paulp said: |
@paulp said:
|
@retronym said (edited on May 9, 2013 2:28:23 PM UTC): |
@paulp said: |
@paulp said: |
Spent a good while studying this one and I can't think of a good way to fix it. It's not false unreachable warnings anymore, it's just saying that it can't prove exhaustiveness, and gives you the 8 ways it thinks 2 booleans can fail, which is a bit dumb. |
The following code gives an incorrect dead code warning:
When compiling this, I get the wraning:
However, when run, it does print "2", so it is clearly not dead code.
It looks like it has something to do the Booleans. If I change all the Booleans to Int's with values of 0/1, the dead code error goes away.
This same code does not produce a warning in scala 2.9.2.
The text was updated successfully, but these errors were encountered: