Aladdin - Scala Bugtracking
[#97] project: compiler priority: medium category: bug
submitter assigned to status date submitted
Matthias Martin fixed 2003-09-01 18:45:51.0
subject Typechecker crash for match selector of type Any
code
object Main {
  def foo(x: Any) = x match {
    case List(y) => "zero"
    case y :: ys => "one"
  }
  def main(args: Array[String]) = System.out.println(List(1, 2));
}
what happened
SM.scala:3: expected pattern type scala.Any does not conform to sequence trait scala.List
                case List(y) => "zero"
                     ^
SM.scala:3: stable identifier required, but y found.
                case List(y) => "zero"
                          ^
Exception in thread "main" java.lang.AssertionError: y
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1704)
        at scalac.typechecker.Analyzer.transformArgs(Analyzer.java:1685)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:2238)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1702)
        at scalac.typechecker.Analyzer.transformCase(Analyzer.java:1498)
        at scalac.typechecker.Analyzer.transformVisitor(Analyzer.java:1481)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:2222)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1702)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1717)
        at scalac.typechecker.Analyzer.defineSym(Analyzer.java:1004)
        at scalac.typechecker.Analyzer$LazyTreeType.complete(Analyzer.java:613)
        at scalac.symtab.Symbol.info(Symbol.java:653)
        at scalac.symtab.Symbol.initialize(Symbol.java:619)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1750)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1721)
        at scalac.typechecker.Analyzer.transformStatSeq(Analyzer.java:1524)
        at scalac.typechecker.Analyzer.transformTemplate(Analyzer.java:1583)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1797)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1721)
        at scalac.typechecker.Analyzer.transformStatSeq(Analyzer.java:1524)
        at scalac.typechecker.Analyzer.apply(Analyzer.java:111)
        at scalac.ast.Transformer.apply(Transformer.java:62)
        at scalac.typechecker.Analyzer.apply(Analyzer.java:59)
        at scalac.typechecker.AnalyzerPhase.apply(AnalyzerPhase.java:107)
        at scalac.Global.compile(Global.java:266)
        at scalac.Global.compile(Global.java:245)
        at scalac.Main.main(Main.java:32)
what expected Compiler, runtime positive.
[back to overview]
Changes of this bug report
Martin  edited on  2003-09-02 19:06:56.0