Aladdin - Scala Bugtracking
[#67] project: compiler priority: medium category: bug
submitter assigned to status date submitted
Erik Martin fixed 2003-07-10 18:06:14.0
subject Analyzer crash
code
class D[A <: Ord[A],B] {
    abstract class Tree[A <: Ord[A],B]();
    case class Node[A,B](key:A,value:B,smaller:Tree[A,B],bigger:Tree[A,B])
	extends Tree[A,B];
    case class Nil[A,B]() extends Tree[A,B];
    

    abstract case class InsertTree[A,B]();
    case class ITree[A,B](t:Tree[A,B]); // forgot extends InsertTree[A,B];
    case class INode[A,B](t:Tree[A,B],height:int,size:int); // forgot extends InsertTree[A,B];
    val tree:Tree[A,B] = Nil();
    val s = 0;

    def insert(key:A, value:B) = {
	val ITree(t1) = insert_1(key, value, tree, s);
    }

    def insert_1(key:A, value:B, t0:Tree[A,B], s:int):InsertTree[A,B] = {
	INode(t0,1,s);
    }
}	
what happened
~/scala/bin/socos -d libtest/ D.scala 
D.scala:15: constructor cannot be instantiated to expected type;
 found   : D.this.ITree[A?,B?]
 required: D.this.InsertTree[A,B]
        val ITree(t1) = insert_1(key, value, tree, s);
            ^
D.scala:15: stable identifier required, but t1 found.
        val ITree(t1) = insert_1(key, value, tree, s);
                  ^
Exception in thread "main" java.lang.AssertionError: 
        at scalac.symtab.Type.elimRedundant(Type.java:1899)
        at scalac.symtab.Type.lub(Type.java:1934)
        at scalac.typechecker.Analyzer.transformVisitor(Analyzer.java:1378)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:2017)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1583)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1596)
        at scalac.typechecker.Analyzer.defineSym(Analyzer.java:949)
        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:1583)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1596)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1719)
        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 Not a compiler crash, just a type error since I had forgot to inherit from InsertTree[A,B] in my case clases.
[back to overview]
Changes of this bug report
Martin  edited on  2003-07-15 17:10:33.0