diff options
author | Martin Odersky <odersky@gmail.com> | 2016-07-29 20:37:38 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-07-29 20:40:20 +0200 |
commit | 290200037ba9633d1dc23dc02750c1396ee11045 (patch) | |
tree | 5694bd154d6947562dd3ef953f5d613c9822e72f | |
parent | 9ab6ce7c351e428d09a690cc8c841f0750fe8973 (diff) | |
download | dotty-290200037ba9633d1dc23dc02750c1396ee11045.tar.gz dotty-290200037ba9633d1dc23dc02750c1396ee11045.tar.bz2 dotty-290200037ba9633d1dc23dc02750c1396ee11045.zip |
Index members of a class before evaluating its parents
Avoids missing member in tangledCompanion.scala, which is a minimization
of intermittent failures in CollectionStrawMan6. Intermittent, because it
depended on order of compilation. CollectionTests have to be compiled together with
but before CollectionStrawMan6 (this was _sometimes_ the case because partest did not
honor indicated compilation order so far). I.e.
dotc CollectionTests_2.scala CollectionStrawMan6_1.scala
would trigger the error. tangledCompanion.scala captures the dependencies
in a single file.
-rw-r--r-- | src/dotty/tools/dotc/typer/Namer.scala | 3 | ||||
-rw-r--r-- | tests/pos/tangledCompanion.scala | 26 |
2 files changed, 28 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/typer/Namer.scala b/src/dotty/tools/dotc/typer/Namer.scala index 26c8f5c95..69ab35a7c 100644 --- a/src/dotty/tools/dotc/typer/Namer.scala +++ b/src/dotty/tools/dotc/typer/Namer.scala @@ -698,13 +698,14 @@ class Namer { typer: Typer => // the parent types are elaborated. index(constr) symbolOfTree(constr).ensureCompleted() + + index(rest)(inClassContext(selfInfo)) val tparamAccessors = decls.filter(_ is TypeParamAccessor).toList val parentTypes = ensureFirstIsClass(parents.map(checkedParentType(_, tparamAccessors))) val parentRefs = ctx.normalizeToClassRefs(parentTypes, cls, decls) typr.println(s"completing $denot, parents = $parents, parentTypes = $parentTypes, parentRefs = $parentRefs") - index(rest)(inClassContext(selfInfo)) tempInfo.finalize(denot, parentRefs) Checking.checkWellFormed(cls) diff --git a/tests/pos/tangledCompanion.scala b/tests/pos/tangledCompanion.scala new file mode 100644 index 000000000..5853f8675 --- /dev/null +++ b/tests/pos/tangledCompanion.scala @@ -0,0 +1,26 @@ +object Test { + + import Coll._ + import LazyList.#:: + + val xs = LazyList.Empty + +} + +object Coll { + + trait IterableFactory[+C[X]] + + class LazyList[+A](expr: => LazyList.Evaluated[A]) + + object LazyList extends IterableFactory[LazyList] { + + type Evaluated[+A] = Option[(A, LazyList[A])] + + object Empty extends LazyList[Nothing](None) + + object #:: { + def unapply[A](s: LazyList[A]): Evaluated[A] = ??? + } + } +} |