Aladdin - Scala Bugtracking
[#1063] project: compiler priority: low category: bug
submitter assigned to status date submitted
Lex Martin fixed 2007-04-21 00:17:38.0
subject exhaustivity warning for PartialFunction's
code
object Test {
sealed abstract class Root
case class A(n: Int) extends Root
case class B(n: Int) extends Root

def main(args: Array[String]) {
  // the target type is PartialFunction; it is
  // okay for the pattern match to be incomplete
  val test: PartialFunction[Root,Unit] =
    { case A(_) => }

  println("defined at A(3): " + test.isDefinedAt(A(3)))
  println("defined at B(3): " + test.isDefinedAt(B(3)))
}
}
what happened
exhaustwarn.scala:8: warning: match is not exhaustive!
missing combination              B

    { case A(_) => }
    ^
one warning found
what expected No warning should be given, because the target type is a PartalFunction.
[back to overview]
Changes of this bug report
Martin  edited on  2007-07-17 20:58:02.0