Skip to content

Commit c3645d8

Browse files
committed
Refine the refined condition further
Previous one fails in tastyBootstrap, but it's not clear why.
1 parent b979200 commit c3645d8

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

compiler/src/dotty/tools/dotc/typer/Typer.scala

+10-3
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,16 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
270270
if (isSelfDenot(defDenot)) curOwner.enclosingClass.thisType
271271
else {
272272
val effectiveOwner =
273-
if (curOwner.isTerm && defDenot.symbol.maybeOwner.isType) defDenot.symbol.owner
274-
else curOwner
275-
//println(i"typed ID $name in $curOwner, ${defDenot.symbol.owner}")
273+
if (curOwner.isTerm && defDenot.symbol.isType)
274+
// Don't mix NoPrefix and thisType prefixes, since type comparer
275+
// would not detect types to be compatible. Note: If we replace the
276+
// 2nd condition by `defDenot.symbol.maybeOwner.isType` we get lots
277+
// of failures in the `tastyBootstrap` test. Trying to compile these
278+
// files in isolation works though.
279+
// TODO: Investigate why that happens.
280+
defDenot.symbol.owner
281+
else
282+
curOwner
276283
effectiveOwner.thisType.select(name, defDenot)
277284
}
278285
if (!(curOwner is Package) || isDefinedInCurrentUnit(defDenot))

0 commit comments

Comments
 (0)