Skip to content

Commit 40202ee

Browse files
oderskygzm0
authored andcommitted
Fix of t1280 - type of self
The type of self name "x" was taken to be the thisType of the current owner. But the current owner was a local dummy of the class in question, so the ThisType was NoPrefix. Inserting an enclosingClass fixes the problem.
1 parent 7e51434 commit 40202ee

File tree

2 files changed

+1
-1
lines changed

2 files changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
209209
if (qualifies(defDenot)) {
210210
val curOwner = ctx.owner
211211
val found =
212-
if (isSelfDenot(defDenot)) curOwner.thisType
212+
if (isSelfDenot(defDenot)) curOwner.enclosingClass.thisType
213213
else curOwner.thisType.select(name, defDenot)
214214
if (!(curOwner is Package) || (defDenot.symbol is Package) || isDefinedInCurrentUnit(defDenot))
215215
return checkNewOrShadowed(found, definition) // no need to go further out, we found highest prec entry
File renamed without changes.

0 commit comments

Comments
 (0)