Aladdin - Scala Bugtracking
[#510] project: nsc priority: low category: bug
submitter assigned to status date submitted
Philippe Martin fixed 2006-01-10 14:11:50.0
subject Cyclic type crashes the compiler
code
abstract class C {

  type T <: Any;

}

abstract class D[S <: C](_c: S) extends C {

  val c: S = _c;
  type T <: c.T;

}

abstract class E(e: E) extends D[E](e);

object Test {

  def f(e: E): Unit = {
    def g(t: e.T): Unit = {
      val i: Int = t;
      ()
    }
    ()
  }

}
what happened
tmp/test.scala:19 error: cyclic aliasing or subtyping involving type T
    def g(t: e.T): Unit = {
          ^
Exception in thread "main" java.lang.Error: recursive <:<
	at scala.tools.nsc.symtab.Types$class.isSubType(Types.scala:1485)
	at scala.tools.nsc.symtab.SymbolTable.isSubType(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$Type.$less$colon$less(Types.scala:220)
	at scala.tools.nsc.symtab.Types$class.isSubType0(Types.scala:1523)
	at scala.tools.nsc.symtab.SymbolTable.isSubType0(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$class.isSubType(Types.scala:1486)
	at scala.tools.nsc.symtab.SymbolTable.isSubType(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$Type.$less$colon$less(Types.scala:220)
	at scala.tools.nsc.symtab.Types$class.isSubType0(Types.scala:1523)
	at scala.tools.nsc.symtab.SymbolTable.isSubType0(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$class.isSubType(Types.scala:1486)
	at scala.tools.nsc.symtab.SymbolTable.isSubType(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$Type.$less$colon$less(Types.scala:220)
	at scala.tools.nsc.symtab.Types$class.isSubType0(Types.scala:1523)
	at scala.tools.nsc.symtab.SymbolTable.isSubType0(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$class.isSubType(Types.scala:1486)
	at scala.tools.nsc.symtab.SymbolTable.isSubType(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$Type.$less$colon$less(Types.scala:220)
	at scala.tools.nsc.symtab.Types$class.isSubType0(Types.scala:1523)
	at scala.tools.nsc.symtab.SymbolTable.isSubType0(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$class.isSubType(Types.scala:1486)
	at scala.tools.nsc.symtab.SymbolTable.isSubType(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$Type.$less$colon$less(Types.scala:220)
	at scala.tools.nsc.symtab.Types$class.isSubType0(Types.scala:1523)
	at scala.tools.nsc.symtab.SymbolTable.isSubType0(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$class.isSubType(Types.scala:1486)
	at scala.tools.nsc.symtab.SymbolTable.isSubType(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$Type.$less$colon$less(Types.scala:220)
	at scala.tools.nsc.symtab.Types$class.isSubType0(Types.scala:1523)
	at scala.tools.nsc.symtab.SymbolTable.isSubType0(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$class.isSubType(Types.scala:1486)
	at scala.tools.nsc.symtab.SymbolTable.isSubType(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$Type.$less$colon$less(Types.scala:220)
	at scala.tools.nsc.symtab.Types$class.isSubType0(Types.scala:1523)
	at scala.tools.nsc.symtab.SymbolTable.isSubType0(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$class.isSubType(Types.scala:1486)
	at scala.tools.nsc.symtab.SymbolTable.isSubType(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$Type.$less$colon$less(Types.scala:220)
	at scala.tools.nsc.symtab.Types$class.isSubType0(Types.scala:1523)
	at scala.tools.nsc.symtab.SymbolTable.isSubType0(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$class.isSubType(Types.scala:1486)
	at scala.tools.nsc.symtab.SymbolTable.isSubType(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$Type.$less$colon$less(Types.scala:220)
	at scala.tools.nsc.symtab.Types$class.isSubType0(Types.scala:1523)
	at scala.tools.nsc.symtab.SymbolTable.isSubType0(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$class.isSubType(Types.scala:1486)
	at scala.tools.nsc.symtab.SymbolTable.isSubType(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$Type.$less$colon$less(Types.scala:220)
	at scala.tools.nsc.symtab.Types$class.isSubType0(Types.scala:1523)
	at scala.tools.nsc.symtab.SymbolTable.isSubType0(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$class.isSubType(Types.scala:1486)
	at scala.tools.nsc.symtab.SymbolTable.isSubType(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$Type.$less$colon$less(Types.scala:220)
	at scala.tools.nsc.symtab.Types$class.isSubType0(Types.scala:1523)
	at scala.tools.nsc.symtab.SymbolTable.isSubType0(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$class.isSubType(Types.scala:1486)
	at scala.tools.nsc.symtab.SymbolTable.isSubType(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$Type.$less$colon$less(Types.scala:220)
	at scala.tools.nsc.symtab.Types$class.isSubType0(Types.scala:1523)
	at scala.tools.nsc.symtab.SymbolTable.isSubType0(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$class.isSubType(Types.scala:1486)
	at scala.tools.nsc.symtab.SymbolTable.isSubType(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$Type.$less$colon$less(Types.scala:220)
	at scala.tools.nsc.symtab.Types$class.isSubType0(Types.scala:1523)
	at scala.tools.nsc.symtab.SymbolTable.isSubType0(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$class.isSubType(Types.scala:1486)
	at scala.tools.nsc.symtab.SymbolTable.isSubType(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$Type.$less$colon$less(Types.scala:220)
	at scala.tools.nsc.symtab.Types$class.isSubType0(Types.scala:1523)
	at scala.tools.nsc.symtab.SymbolTable.isSubType0(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$class.isSubType(Types.scala:1486)
	at scala.tools.nsc.symtab.SymbolTable.isSubType(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$Type.$less$colon$less(Types.scala:220)
	at scala.tools.nsc.symtab.Types$class.isSubType0(Types.scala:1523)
	at scala.tools.nsc.symtab.SymbolTable.isSubType0(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$class.isSubType(Types.scala:1486)
	at scala.tools.nsc.symtab.SymbolTable.isSubType(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$Type.$less$colon$less(Types.scala:220)
	at scala.tools.nsc.symtab.Types$class.isSubType0(Types.scala:1523)
	at scala.tools.nsc.symtab.SymbolTable.isSubType0(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$class.isSubType(Types.scala:1486)
	at scala.tools.nsc.symtab.SymbolTable.isSubType(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$Type.$less$colon$less(Types.scala:220)
	at scala.tools.nsc.symtab.Types$class.isSubType0(Types.scala:1523)
	at scala.tools.nsc.symtab.SymbolTable.isSubType0(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$class.isSubType(Types.scala:1486)
	at scala.tools.nsc.symtab.SymbolTable.isSubType(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$Type.$less$colon$less(Types.scala:220)
	at scala.tools.nsc.symtab.Types$class.isSubType0(Types.scala:1523)
	at scala.tools.nsc.symtab.SymbolTable.isSubType0(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$class.isSubType(Types.scala:1486)
	at scala.tools.nsc.symtab.SymbolTable.isSubType(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$Type.$less$colon$less(Types.scala:220)
	at scala.tools.nsc.symtab.Types$class.isSubType0(Types.scala:1523)
	at scala.tools.nsc.symtab.SymbolTable.isSubType0(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$class.isSubType(Types.scala:1486)
	at scala.tools.nsc.symtab.SymbolTable.isSubType(SymbolTable.scala:10)
	at scala.tools.nsc.symtab.Types$Type.$less$colon$less(Types.scala:220)
	at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:395)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1426)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1452)
	at scala.tools.nsc.typechecker.Typers$Typer.transformedOrTyped(Typers.scala:1486)
	at scala.tools.nsc.typechecker.Typers$Typer.typedValDef(Typers.scala:639)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1124)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1424)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1448)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun42.apply(Typers.scala:859)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun42.apply(Typers.scala:849)
	at scala.List$.loop0(List.scala:241)
	at scala.List$.mapConserve(List.scala:258)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:849)
	at scala.tools.nsc.typechecker.Typers$Typer.typedBlock(Typers.scala:772)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1156)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1424)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1452)
	at scala.tools.nsc.typechecker.Typers$Typer.transformedOrTyped(Typers.scala:1486)
	at scala.tools.nsc.typechecker.Typers$Typer.typedDefDef(Typers.scala:735)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1127)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1424)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1448)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun42.apply(Typers.scala:859)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun42.apply(Typers.scala:849)
	at scala.List$.loop0(List.scala:241)
	at scala.List$.mapConserve(List.scala:258)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:849)
	at scala.tools.nsc.typechecker.Typers$Typer.typedBlock(Typers.scala:772)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1156)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1424)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1452)
	at scala.tools.nsc.typechecker.Typers$Typer.transformedOrTyped(Typers.scala:1486)
	at scala.tools.nsc.typechecker.Typers$Typer.typedDefDef(Typers.scala:735)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1127)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1424)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1448)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun42.apply(Typers.scala:859)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun42.apply(Typers.scala:849)
	at scala.List$.loop0(List.scala:241)
	at scala.List$.mapConserve(List.scala:258)
	at scala.List$.loop0(List.scala:245)
	at scala.List$.mapConserve(List.scala:258)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:849)
	at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:622)
	at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:571)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1121)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1424)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1448)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun42.apply(Typers.scala:859)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun42.apply(Typers.scala:849)
	at scala.List$.loop0(List.scala:241)
	at scala.List$.mapConserve(List.scala:258)
	at scala.List$.loop0(List.scala:245)
	at scala.List$.mapConserve(List.scala:258)
	at scala.List$.loop0(List.scala:245)
	at scala.List$.mapConserve(List.scala:258)
	at scala.List$.loop0(List.scala:245)
	at scala.List$.mapConserve(List.scala:258)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:849)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1114)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1424)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1448)
	at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon1.apply(Analyzer.scala:39)
	at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:175)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun1.apply(Global.scala:164)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun1.apply(Global.scala:164)
	at scala.Iterator$class.foreach(Iterator.scala:262)
	at scala.List$$anon1.foreach(List.scala:474)
	at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:164)
	at scala.tools.nsc.Global$Run.compileSources(Global.scala:373)
	at scala.tools.nsc.Global$Run.compile(Global.scala:440)
	at scala.tools.nsc.Main$.process(Main.scala:57)
	at scala.tools.nsc.Main$.main(Main.scala:69)
	at scala.tools.nsc.Main.main(Main.scala)
what expected No compiler crash. The type e.T of t is cyclic: e.T <: e.c.T <: e.c.c.T <: .... The cycle is correctly detected but the analyzer crashes when it checks whether t is of type Int.
[back to overview]
Changes of this bug report
Martin  edited on  2006-01-20 18:34:04.0