Skip to content

Instantly share code, notes, and snippets.

@overthink
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save overthink/e56f35159f6bc5751d34 to your computer and use it in GitHub Desktop.
Save overthink/e56f35159f6bc5751d34 to your computer and use it in GitHub Desktop.
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