Skip to content

Commit 22c9e56

Browse files
committed
Refine determination of prefix in typedIdent
1 parent 75e15b9 commit 22c9e56

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,13 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
268268
if (qualifies(defDenot)) {
269269
val found =
270270
if (isSelfDenot(defDenot)) curOwner.enclosingClass.thisType
271-
else curOwner.thisType.select(name, defDenot)
271+
else {
272+
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}")
276+
effectiveOwner.thisType.select(name, defDenot)
277+
}
272278
if (!(curOwner is Package) || isDefinedInCurrentUnit(defDenot))
273279
result = checkNewOrShadowed(found, definition) // no need to go further out, we found highest prec entry
274280
else {

0 commit comments

Comments
 (0)