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 | |
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')
6 files changed, 24 insertions, 13 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 diff --git a/src/library/scalax/collection/generic/VectorTemplate.scala b/src/library/scalax/collection/generic/VectorTemplate.scala index bc18ac45c2..cd3412498d 100644 --- a/src/library/scalax/collection/generic/VectorTemplate.scala +++ b/src/library/scalax/collection/generic/VectorTemplate.scala @@ -34,7 +34,7 @@ self => x } else Iterator.empty.next def head = - self(i) + if (i < end) self(i) else Iterator.empty.next /** drop is overridden to enable fast searching in the middle of random access sequences */ override def drop(n: Int): Iterator[A] = if (n > 0) new Elements(start + n, end) else this diff --git a/src/library/scalax/collection/generic/covartest/VectorTemplate.scala b/src/library/scalax/collection/generic/covartest/VectorTemplate.scala index 6e44b6a6c5..474fb9ad7e 100644 --- a/src/library/scalax/collection/generic/covartest/VectorTemplate.scala +++ b/src/library/scalax/collection/generic/covartest/VectorTemplate.scala @@ -34,7 +34,7 @@ self => x } else Iterator.empty.next def head = - self(i) + if (i < end) self(i) else Iterator.empty.next /** drop is overridden to enable fast searching in the middle of random access sequences */ override def drop(n: Int): Iterator[A] = if (n > 0) new Elements(start + n, end) else this diff --git a/src/library/scalax/collection/mutable/ArrayBuffer.scala b/src/library/scalax/collection/mutable/ArrayBuffer.scala index 3e4877cef7..634e002111 100644 --- a/src/library/scalax/collection/mutable/ArrayBuffer.scala +++ b/src/library/scalax/collection/mutable/ArrayBuffer.scala @@ -93,7 +93,8 @@ class ArrayBuffer[A] extends Buffer[A] with Builder[ArrayBuffer, A] with Resizab /** Removes the element on a given index position. It takes time linear in * the buffer size. * - * @param n the index which refers to the element to delete. + * @param n the index which refers to the first element to delete. + * @param count the number of elemenets to delete * @return the updated array buffer. * @throws Predef.IndexOutOfBoundsException if <code>n</code> is out of bounds. */ |