Aladdin - Scala Bugtracking
[#66] project: compiler priority: medium category: bug
submitter assigned to status date submitted
Erik Martin fixed 2003-07-10 17:40:41.0
subject illegal cyclic reference
code
class GBTree[A, B] with Map[A, B, GBTree[A,B]] {
    abstract class Tree[A,B];
    case class Node[A,B](key:A,value:B,smaller:Node[A,B],bigger:Node[A,B])
	extends Tree[A,B];
    case class Nil[A,B]() extends Tree[A,B];
    
}
what happened
~/scala/bin/socos -d libtest/ C.scala 
C.scala:1: constructor scala.Map of type ()scala.Map cannot be applied to [A,B,GBTree[A,B]]
class GBTree[A, B] with Map[A, B, GBTree[A,B]] {
                           ^
C.scala:3: illegal cyclic reference involving constructor GBTree.Node
    case class Node[A,B](key:A,value:B,smaller:Node[A,B],bigger:Node[A,B])
                                               ^
C.scala:3: GBTree.this.Node does not take type parameters
    case class Node[A,B](key:A,value:B,smaller:Node[A,B],bigger:Node[A,B])
                                                                ^
Exception in thread "main" java.lang.AssertionError: type A
        at scalac.symtab.Symbol.info(Symbol.java:560)
        at scalac.symtab.Symbol.initialize(Symbol.java:530)
        at scalac.typechecker.Analyzer.checkNonCyclic(Analyzer.java:415)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1682)
        at scalac.ast.Transformer.transform(Transformer.java:263)
        at scalac.ast.Transformer.transform(Transformer.java:277)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1662)
        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 OK, so something is wrong with my code, but I would not expect the compiler to crash.
[back to overview]
Changes of this bug report
Martin  edited on  2003-07-15 16:13:24.0