Aladdin - Scala Bugtracking
[#195] project: compiler priority: medium category: bug
submitter assigned to status date submitted
Matthias Burak fixed 2003-10-15 11:52:33.0
subject Sequence matcher can't handle some @ patterns
code
case class Two(xs: List[Any]);
object Foo with Executable {
  def test(xs: Any) = xs match {
    case Two(x@List(_*)) =>
    	Console.println("x = " + x);
    case _ =>
    	Console.println("default");
  }
}
what happened
Crashes the compiler:
Exception in thread "main" scalac.ApplicationError:
cannot handle x @ scala.List([x$0 @ ([] | [_, x$0])])
        at scalac.transformer.matching.AlgebraicMatcher.patternNode(AlgebraicMatcher.java:239)
        at scalac.transformer.matching.AlgebraicMatcher.enter1(AlgebraicMatcher.java:316)
        at scalac.transformer.matching.PatternMatcher.enter(PatternMatcher.java:518)
        at scalac.transformer.matching.AlgebraicMatcher.enter1(AlgebraicMatcher.java:351)
        at scalac.transformer.matching.AlgebraicMatcher.addCase(AlgebraicMatcher.java:121)
        at scalac.transformer.matching.AlgebraicMatcher.addCase(AlgebraicMatcher.java:111)
        at scalac.transformer.matching.AlgebraicMatcher.construct(AlgebraicMatcher.java:56)
        at scalac.transformer.matching.AlgebraicMatcher.construct(AlgebraicMatcher.java:45)
        at scalac.transformer.TransMatch.transform(TransMatch.java:97)
        at scalac.transformer.TransMatch.transform(TransMatch.java:119)
        at scalac.transformer.OwnerTransformer.transform(OwnerTransformer.java:41)
        at scalac.transformer.OwnerTransformer.transform(OwnerTransformer.java:116)
        at scalac.transformer.TransMatch.transform(TransMatch.java:130)
        at scalac.transformer.OwnerTransformer.transform(OwnerTransformer.java:41)
        at scalac.transformer.OwnerTransformer.transformTemplateStat(OwnerTransformer.java:87)
        at scalac.transformer.OwnerTransformer.transformTemplateStats(OwnerTransformer.java:76)
        at scalac.transformer.OwnerTransformer.transform(OwnerTransformer.java:68)
        at scalac.transformer.OwnerTransformer.transform(OwnerTransformer.java:100)
        at scalac.transformer.TransMatch.transform(TransMatch.java:130)
        at scalac.ast.Transformer.transform(Transformer.java:281)
        at scalac.transformer.OwnerTransformer.apply(OwnerTransformer.java:35)
        at scalac.transformer.TransMatch.apply(TransMatch.java:86)
        at scalac.transformer.TransMatchPhase.apply(TransMatchPhase.java:33)
        at scalac.Global.compile(Global.java:294)
        at scalac.Global.compile(Global.java:267)
        at scalac.Main.main(Main.java:32)
what expected Compiles.
[back to overview]
Changes of this bug report
Burak  edited on  2003-10-30 11:51:18.0
Also this problem finally fixed. It appeared because of bad interplay of AlgebraicMatcher and PatternMatcher when I removed some duplicated code.