Aladdin - Scala Bugtracking
[#134] project: compiler priority: medium category: bug
submitter assigned to status date submitted
Matthias Burak fixed 2003-09-11 15:38:37.0
subject Repetitions/options must not define nested variables
code
class Expr;
object Foo with Executable {
  def test(xs: List[Expr]) = xs match {
    case List(b?) => System.out.println("b = " + b);
  }
}
what happened
Compiler crash:
Exception in thread "main" java.lang.AssertionError: found variable label b
        at scalac.transformer.matching.BindingBerrySethi.seenLabel(BindingBerrySethi.java:61)
        at scalac.transformer.matching.BerrySethi.traverse(BerrySethi.java:426)
        at scalac.transformer.matching.BerrySethi.traverse(BerrySethi.java:395)
        at scalac.transformer.matching.BerrySethi.initialize(BerrySethi.java:496)
        at scalac.transformer.matching.BindingBerrySethi.initialize(BindingBerrySethi.java:78)
        at scalac.transformer.matching.BindingBerrySethi.automatonFrom(BindingBerrySethi.java:105)
        at scalac.transformer.matching.SequenceMatcher.addBinderToBody(SequenceMatcher.java:117)
        at scalac.transformer.matching.SequenceMatcher.addBindersToBodies(SequenceMatcher.java:201)
        at scalac.transformer.matching.SequenceMatcher.construct(SequenceMatcher.java:266)
        at scalac.transformer.matching.AlgebraicMatcher.callSequenceMatcher(AlgebraicMatcher.java:489)
        at scalac.transformer.matching.AlgebraicMatcher.toTree(AlgebraicMatcher.java:417)
        at scalac.transformer.matching.AlgebraicMatcher.toTree(AlgebraicMatcher.java:382)
        at scalac.transformer.matching.AlgebraicMatcher.toTree(AlgebraicMatcher.java:364)
        at scalac.transformer.matching.AlgebraicMatcher.construct(AlgebraicMatcher.java:59)
        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:276)
        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 The compiler should check that within a * or a ? pattern there are no new variables.
[back to overview]
Changes of this bug report
Burak  edited on  2003-09-12 15:38:37.0
says this now.
Test6.scala:5: variable not allowed under alternative
    case List(b?) => System.out.println("b = " + b);
              ^
This is the same bug as #128, because b? becomes (b|).