Skip to content

Commit 2902000

Browse files
committed
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.
1 parent 9ab6ce7 commit 2902000

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

src/dotty/tools/dotc/typer/Namer.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,13 +698,14 @@ class Namer { typer: Typer =>
698698
// the parent types are elaborated.
699699
index(constr)
700700
symbolOfTree(constr).ensureCompleted()
701+
702+
index(rest)(inClassContext(selfInfo))
701703

702704
val tparamAccessors = decls.filter(_ is TypeParamAccessor).toList
703705
val parentTypes = ensureFirstIsClass(parents.map(checkedParentType(_, tparamAccessors)))
704706
val parentRefs = ctx.normalizeToClassRefs(parentTypes, cls, decls)
705707
typr.println(s"completing $denot, parents = $parents, parentTypes = $parentTypes, parentRefs = $parentRefs")
706708

707-
index(rest)(inClassContext(selfInfo))
708709
tempInfo.finalize(denot, parentRefs)
709710

710711
Checking.checkWellFormed(cls)

tests/pos/tangledCompanion.scala

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
object Test {
2+
3+
import Coll._
4+
import LazyList.#::
5+
6+
val xs = LazyList.Empty
7+
8+
}
9+
10+
object Coll {
11+
12+
trait IterableFactory[+C[X]]
13+
14+
class LazyList[+A](expr: => LazyList.Evaluated[A])
15+
16+
object LazyList extends IterableFactory[LazyList] {
17+
18+
type Evaluated[+A] = Option[(A, LazyList[A])]
19+
20+
object Empty extends LazyList[Nothing](None)
21+
22+
object #:: {
23+
def unapply[A](s: LazyList[A]): Evaluated[A] = ???
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)