Aladdin - Scala Bugtracking
[#68] project: compiler priority: medium category: bug
submitter assigned to status date submitted
Erik Burak fixed 2003-07-11 14:13:46.0
subject Analyser crashes
code
class E {
  def f() = {
    val (_::l1) = List(1,2,3);
    l1.tail;
  }
}
what happened
Exception in thread "main" scalac.ApplicationError: illegal pattern: scalac.ast.Tree$Sequence([])
 at scalac.typechecker.DeSugarize.getVariables(DeSugarize.java:100)
 at scalac.typechecker.DeSugarize.getVariables(DeSugarize.java:97)
 at scalac.typechecker.DeSugarize.PatDef(DeSugarize.java:458)
 at scalac.typechecker.DeSugarize.Statements(DeSugarize.java:401)
 at scalac.typechecker.Analyzer.transform(Analyzer.java:1715)
 at scalac.typechecker.Analyzer.transform(Analyzer.java:1583)
 at scalac.typechecker.Analyzer.transform(Analyzer.java:1596)
 at scalac.typechecker.Analyzer.defineSym(Analyzer.java:966)
 at scalac.typechecker.Analyzer$LazyTreeType.complete(Analyzer.java:600)
 at scalac.symtab.Symbol.info(Symbol.java:553)
 at scalac.symtab.Symbol.initialize(Symbol.java:530)
 at scalac.typechecker.Analyzer.transform(Analyzer.java:1629)
 at scalac.typechecker.Analyzer.transform(Analyzer.java:1600)
 at scalac.typechecker.Analyzer.transformStatSeq(Analyzer.java:1419)
 at scalac.typechecker.Analyzer.transformTemplate(Analyzer.java:1472)
 at scalac.typechecker.Analyzer.transform(Analyzer.java:1664)
 at scalac.typechecker.Analyzer.transform(Analyzer.java:1600)
 at scalac.typechecker.Analyzer.transformStatSeq(Analyzer.java:1419)
 at scalac.typechecker.Analyzer.apply(Analyzer.java:114)
 at scalac.ast.Transformer.apply(Transformer.java:66)
 at scalac.ast.Transformer.apply(Transformer.java:62)
 at scalac.typechecker.Analyzer.apply(Analyzer.java:58)
 at scalac.typechecker.AnalyzerPhase.apply(AnalyzerPhase.java:118)
 at scalac.Global.compile(Global.java:274)
 at scalac.Global.compile(Global.java:250)
 at scalac.Main.main(Main.java:32)
what expected The compiler should not crash.
[back to overview]
Changes of this bug report
Martin  edited on  2003-07-15 16:58:40.0
Here's what the parser produces. This seems to be a bug in the pattern parser. Note the empty sequence as second argument of l1! class E extends scala.Object() { def f() = { val l1(_$colon$colon, []) = List(1, 2, 3); l1.tail } };
Burak  edited on  2003-07-16 14:25:27.0
fixed. changed the rule for
Tree Pattern ::= ...
               | SimplePattern { Id SimplePattern } 
such that the operand SimplePattern must be non-empty.