I have this little scala example:
object Test {
def add(x: Int, y: Int) = {
val z = x - y
x match {
case 0 => 0 - y
case 1 => 1 - y
case _ => x - y
}
x + y
}
def main(args: Array[String]) {
println(add(5, 6))
}
}
I feel that scala should warn about 'z' and the 'x match ...' being unused. I did not notice any compiler options to turn on more warnings. I'm using scala 2.10.1.
Thoughts? Thanks!
As you can see here, "unused" warnings will be introduced in the next version of scala, 2.11.
Warn about unused private / local terms and types, and unused imports, under -Xlint
You can try them using the last milestone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With