Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Scala lost guarded exhaustiveness checks at 2.10.x... very annoying
mark@mark-pc2:~/tmp/patterns$ cat Test.scala
sealed trait Foo
case object A extends Foo
case object B extends Foo
object Test {
def f(foo: Foo) {
foo match {
case A if true =>
println("A")
case B =>
println("B")
}
}
}
mark@mark-pc2:~/tmp/patterns$ ~/scala-2.8.0.final/bin/scalac ./Test.scala
./Test.scala:7: warning: match is not exhaustive!
missing combination A
foo match {
^
one warning found
mark@mark-pc2:~/tmp/patterns$ ~/scala-2.9.3/bin/scalac ./Test.scala
./Test.scala:7: warning: match is not exhaustive!
missing combination A
foo match {
^
one warning found
mark@mark-pc2:~/tmp/patterns$ ~/scala-2.10.5/bin/scalac ./Test.scala
mark@mark-pc2:~/tmp/patterns$ ~/scala-2.11.6/bin/scalac ./Test.scala
mark@mark-pc2:~/tmp/patterns$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.