diff options
author | Martin Odersky <odersky@gmail.com> | 2009-01-08 16:23:11 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2009-01-08 16:23:11 +0000 |
commit | 86397c940a2b4df6166a9bc9ed3e03d008f4dd57 (patch) | |
tree | d42ce9c60542a512689331e086f9b44f46fce4f3 /src/compiler | |
parent | 0313e1c018d89fc4e4474f42308e81cfc60fdfb6 (diff) | |
download | scala-86397c940a2b4df6166a9bc9ed3e03d008f4dd57.tar.gz scala-86397c940a2b4df6166a9bc9ed3e03d008f4dd57.tar.bz2 scala-86397c940a2b4df6166a9bc9ed3e03d008f4dd57.zip |
fixed erroneous cyclic reference error conditio...
fixed erroneous cyclic reference error condition; generated new starr.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/CompilationUnits.scala | 5 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Analyzer.scala | 7 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 18 |
3 files changed, 20 insertions, 10 deletions
diff --git a/src/compiler/scala/tools/nsc/CompilationUnits.scala b/src/compiler/scala/tools/nsc/CompilationUnits.scala index bf02e114ab..aa7dc21909 100644 --- a/src/compiler/scala/tools/nsc/CompilationUnits.scala +++ b/src/compiler/scala/tools/nsc/CompilationUnits.scala @@ -8,7 +8,7 @@ package scala.tools.nsc import scala.tools.nsc.util.{FreshNameCreator,OffsetPosition,Position,SourceFile} import scala.tools.nsc.io.AbstractFile -import scala.collection.mutable.{HashSet, HashMap} +import scala.collection.mutable.{HashSet, HashMap, ListBuffer} trait CompilationUnits { self: Global => @@ -34,6 +34,9 @@ trait CompilationUnits { self: Global => */ val synthetics = new HashMap[Symbol, Tree] + /** things to check at end of compilation unit */ + val toCheck = new ListBuffer[() => Unit] + /** used to track changes in a signature */ var pickleHash : Long = 0 diff --git a/src/compiler/scala/tools/nsc/typechecker/Analyzer.scala b/src/compiler/scala/tools/nsc/typechecker/Analyzer.scala index ca9f654b76..7315c6f2c5 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Analyzer.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Analyzer.scala @@ -38,7 +38,12 @@ trait Analyzer extends AnyRef def newPhase(_prev: Phase): StdPhase = new StdPhase(_prev) { if (!inIDE) resetTyper() def apply(unit: CompilationUnit) { - unit.body = newTyper(rootContext(unit)).typed(unit.body) + try { + unit.body = newTyper(rootContext(unit)).typed(unit.body) + for (workItem <- unit.toCheck) workItem() + } finally { + unit.toCheck.clear() + } } } } diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 34a7eb5732..8cc87d2321 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -1556,17 +1556,19 @@ trait Typers { self: Analyzer => } } - def typedRefinement(stats: List[Tree]): List[Tree] = { + def typedRefinement(stats: List[Tree]) { namer.enterSyms(stats) - val stats1 = typedStats(stats, NoSymbol) - for (stat <- stats1 if stat.isDef) { - val member = stat.symbol - if (!(context.owner.info.baseClasses.tail forall - (bc => member.matchingSymbol(bc, context.owner.thisType) == NoSymbol))) { - member setFlag OVERRIDE + // need to delay rest of typedRefinement to avoid cyclic reference errors + unit.toCheck += { () => + val stats1 = typedStats(stats, NoSymbol) + for (stat <- stats1 if stat.isDef) { + val member = stat.symbol + if (!(context.owner.info.baseClasses.tail forall + (bc => member.matchingSymbol(bc, context.owner.thisType) == NoSymbol))) { + member setFlag OVERRIDE + } } } - stats1 } def typedImport(imp : Import) : Import = imp |