Aladdin - Scala Bugtracking
[#181] project: compiler priority: low category: bug
submitter assigned to status date submitted
Matthias Matthias fixed 2003-10-07 02:07:01.0
subject | on top-level crashes pattern matcher
code
case class One();
object Foo with Executable {
  def test(xs: List[Any]) = xs match {
    case List(One()) | List(One()) => Console.println("error")
  }
}
what happened
Exception in thread "main" scalac.ApplicationError:
cannot handle (scala.List([One()]) | scala.List([One()]))
        at scalac.transformer.matching.AlgebraicMatcher.patternNode(AlgebraicMatcher.java:238)
        at scalac.transformer.matching.AlgebraicMatcher.enter1(AlgebraicMatcher.java:333)
        at scalac.transformer.matching.AlgebraicMatcher.addCase(AlgebraicMatcher.java:122)
        at scalac.transformer.matching.AlgebraicMatcher.addCase(AlgebraicMatcher.java:112)
        at scalac.transformer.matching.AlgebraicMatcher.construct(AlgebraicMatcher.java:57)
        at scalac.transformer.matching.AlgebraicMatcher.construct(AlgebraicMatcher.java:46)
        at scalac.transformer.TransMatch.transform(TransMatch.java:103)
        at scalac.transformer.TransMatch.transform(TransMatch.java:125)
        at scalac.transformer.OwnerTransformer.transform(OwnerTransformer.java:41)
        at scalac.transformer.OwnerTransformer.transform(OwnerTransformer.java:116)
        at scalac.transformer.TransMatch.transform(TransMatch.java:136)
        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:136)
        at scalac.ast.Transformer.transform(Transformer.java:281)
        at scalac.transformer.OwnerTransformer.apply(OwnerTransformer.java:35)
        at scalac.transformer.TransMatch.apply(TransMatch.java:92)
        at scalac.transformer.TransMatchPhase.apply(TransMatchPhase.java:33)
        at scalac.Global.compile(Global.java:293)
        at scalac.Global.compile(Global.java:266)
        at scalac.Main.main(Main.java:32)
what expected Either error from semantic analysis or pattern matcher compiles pattern without throwing exceptions.
[back to overview]
Changes of this bug report
Burak  edited on  2003-10-30 12:10:11.0

An alternative at the top-level is passed to your matcher now, which gracefully exits with a "duplicate case" error.

This is probably due to my trying to hack in Alternative handling. Could you instead add a proper node and tweak your code to treat it correctly ?

Matthias  edited on  2004-04-26 12:43:44.0