aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Namer.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-10-24 20:09:30 +0200
committerMartin Odersky <odersky@gmail.com>2013-10-24 21:21:04 +0200
commite8a160c8c64354b12423b908067a1ba328d6248f (patch)
treeec500dc68c0309eb5522b17d919fd70a40344d68 /src/dotty/tools/dotc/typer/Namer.scala
parentaddd4a645c0b3adb898c74cb9b1197bb04597467 (diff)
downloaddotty-e8a160c8c64354b12423b908067a1ba328d6248f.tar.gz
dotty-e8a160c8c64354b12423b908067a1ba328d6248f.tar.bz2
dotty-e8a160c8c64354b12423b908067a1ba328d6248f.zip
Fixed problem in handing of self types.
Self types were not taken into account when doing a typedIdent. The fix in typedIdent caused as CyclicReference when typing the self type itself. This in turn is fixed by distinguishing more carefully in denotNamed in Namer which context we are in.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Namer.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Namer.scala11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/typer/Namer.scala b/src/dotty/tools/dotc/typer/Namer.scala
index 79b1750dc..fb2aef90d 100644
--- a/src/dotty/tools/dotc/typer/Namer.scala
+++ b/src/dotty/tools/dotc/typer/Namer.scala
@@ -26,9 +26,14 @@ trait NamerContextOps { this: Context =>
sym
}
- def denotsNamed(name: Name): PreDenotation =
- if (owner.isClass) owner.asClass.membersNamed(name)
- else scope.denotsNamed(name)
+ def denotNamed(name: Name): Denotation =
+ if (owner.isClass)
+ if (outer.owner == owner)
+ owner.thisType.member(name)
+ else // we are in the outermost context belonging to a class; self is invisible here. See inClassContext.
+ owner.findMember(name, owner.thisType, EmptyFlags)
+ else
+ scope.denotsNamed(name).toDenot(NoPrefix)
def effectiveScope =
if (owner != null && owner.isClass) owner.asClass.decls