Aladdin - Scala Bugtracking
[#644] project: compiler priority: medium category: bug
submitter assigned to status date submitted
Burak Burak fixed 2006-06-27 17:01:13.0
subject transmatch chokes on guards
code
object bugpat {
  
  case class A(i:Int)
  val ignore = A(42)

  def main(a:Array[String]) = {
    
    (ignore:Any) match {
      case x:A if (2==1) =>
        true
      case A(1) =>
        false
    }

    // no error when type annotation is dropped
  }
}
what happened
[emir@lamppc31 ape]$ scalac -d /tmp /tmp/bugpat.scala
Exception in thread "main" java.lang.ClassCastException: scala.tools.nsc.matching.PatternNodes$Body
        at scala.tools.nsc.matching.PatternMatchers$PatternMatcher.enter1(PatternMatchers.scala:500)

...
what expected
[back to overview]
Changes of this bug report
Burak  edited on  2006-07-12 19:29:28.0