Aladdin - Scala Bugtracking
[#1088] project: compiler priority: low category: bug
submitter assigned to status date submitted
Nikolay Martin fixed 2007-05-06 23:09:00.0
subject [contrib #454] illegal cyclic reference involving type
code
// This is the only compiler failure I've experienced while using 2.5.0-RC1

// small variation on code in Aaron Harnly's newsgroup post "referring to the self class" 

trait MyNode {
   type This <: MyNode
   def child: This
}

trait Container {
   type This <: Container
   type aNode <: MyNode  { type This <: aNode }

   def root: aNode
   def child: aNode = root.child
   def child2: aNode = child.child
}


/*

error: illegal cyclic reference involving type aNode
   type aNode <: MyNode  { type This <: aNode }

                                ^
Exception in thread "main" scala.MatchError: scala.tools.nsc.util.NoPosition$@128635
	at scala.tools.nsc.reporters.ConsoleReporter.printMessage(ConsoleReporter.scala:55)
	at scala.tools.nsc.reporters.ConsoleReporter.print(ConsoleReporter.scala:68)
	at scala.tools.nsc.reporters.ConsoleReporter.display(ConsoleReporter.scala:101)
	at scala.tools.nsc.reporters.AbstractReporter.info0(AbstractReporter.scala:36)
	at scala.tools.nsc.reporters.Reporter.error(Reporter.scala:39)
	at scala.tools.nsc.CompilationUnits$CompilationUnit.error(CompilationUnits.scala:43)
	at scala.tools.nsc.typechecker.Contexts$Context.error(Contexts.scala:266)
	at scala.tools.nsc.typechecker.Infer$Inferencer.error(Infer.scala:277)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$56.apply(Typers.scala:1370)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$56.apply(Typers.scala:1365)
	at scala.List.foreach(List.scala:699)
	at scala.tools.nsc.typechecker.Typers$Typer.typedRefinement(Typers.scala:1365)
	at scala.tools.nsc.typechecker.Typers$Typer.typedCompoundTypeTree$0(Typers.scala:2355)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:2606)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2641)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$123.apply(Typers.scala:2706)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$123.apply(Typers.scala:2706)
	at scala.tools.nsc.symtab.Types$class.withNoGlobalVariance(Types.scala:3012)
	at scala.tools.nsc.symtab.SymbolTable.withNoGlobalVariance(SymbolTable.scala:10)
	at scala.tools.nsc.typechecker.Typers$Typer.typedType(Typers.scala:2706)
	at scala.tools.nsc.typechecker.Namers$Namer.abstractTypeSig(Namers.scala:594)
	at scala.tools.nsc.typechecker.Namers$Namer.typeSig(Namers.scala:652)
	at scala.tools.nsc.typechecker.Namers$Namer$$anon$0.complete(Namers.scala:356)
	at scala.tools.nsc.symtab.Symbols$Symbol.info(Symbols.scala:410)
	at scala.tools.nsc.symtab.Symbols$Symbol.initialize(Symbols.scala:518)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:2397)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2641)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2674)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStat$0(Typers.scala:1396)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$58.apply(Typers.scala:1426)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$58.apply(Typers.scala:1426)
	at scala.List$.loop$0(List.scala:243)
	at scala.List$.mapConserve(List.scala:260)
	at scala.List$.loop$0(List.scala:247)
	at scala.List$.mapConserve(List.scala:260)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:1426)
	at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1056)
	at scala.tools.nsc.typechecker.Typers$Typer.typedClassDef(Typers.scala:951)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:2406)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2641)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2674)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStat$0(Typers.scala:1396)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$58.apply(Typers.scala:1426)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$58.apply(Typers.scala:1426)
	at scala.List$.loop$0(List.scala:243)
	at scala.List$.mapConserve(List.scala:260)
	at scala.List$.loop$0(List.scala:247)
	at scala.List$.mapConserve(List.scala:260)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:1426)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:2402)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2641)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2674)
	at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$1.apply(Analyzer.scala:38)
	at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:241)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$2.apply(Global.scala:230)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$2.apply(Global.scala:230)
	at scala.Iterator$class.foreach(Iterator.scala:369)
	at scala.collection.mutable.ListBuffer$$anon$0.foreach(ListBuffer.scala:245)
	at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:230)
	at scala.tools.nsc.Global$Run.compileSources(Global.scala:498)
	at scala.tools.nsc.Global$Run.compile(Global.scala:572)
	at scala.tools.nsc.Main$.process(Main.scala:57)
	at scala.tools.nsc.Main$.main(Main.scala:77)
	at scala.tools.nsc.Main.main(Main.scala)


*/

what happened
compiler stack trace
what expected one or more error messages, as occur with 2.4.0-final
[back to overview]
Changes of this bug report
Nikolay  edited on  2007-05-06 23:10:19.0
contribution #454. I assigned to Martin but maybe Sean should take a look whether some problem with positions is not the culprit.
Sean  edited on  2007-05-07 06:43:13.0
I added a blank NoPosition case to the console reporter. This is still a bug though, since a position should be associated with the error.
Martin  edited on  2007-05-17 14:59:55.0