diff options
author | Martin Odersky <odersky@gmail.com> | 2015-11-02 09:26:33 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-11-02 09:26:33 +0100 |
commit | bf5f79cea0e2cd1f5cbdd5d3c0ed36a41039723f (patch) | |
tree | d22d2e70687d4746e83f383437b572ba163d1834 /src/dotty/tools/dotc/typer/Typer.scala | |
parent | 34608562fa4f3697ddf4034fb802182a18c9f687 (diff) | |
download | dotty-bf5f79cea0e2cd1f5cbdd5d3c0ed36a41039723f.tar.gz dotty-bf5f79cea0e2cd1f5cbdd5d3c0ed36a41039723f.tar.bz2 dotty-bf5f79cea0e2cd1f5cbdd5d3c0ed36a41039723f.zip |
Fix problem when accessing same identifier from nested packages.
The previous rules picked the once outer removed member rather than
the innermost one, of both members exist.
Seen in the wild in scala.sys.ShutdownHookThread. No separate test here,
because we'll include large parts of stdlib anyway as a build test.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 569e4f7d5..9f8701651 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -220,8 +220,10 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit val found = if (isSelfDenot(defDenot)) curOwner.enclosingClass.thisType else curOwner.thisType.select(name, defDenot) - if (!(curOwner is Package) || (defDenot.symbol is Package) || isDefinedInCurrentUnit(defDenot)) + if (!(curOwner is Package) || isDefinedInCurrentUnit(defDenot)) return checkNewOrShadowed(found, definition) // no need to go further out, we found highest prec entry + else if (defDenot.symbol is Package) + return checkNewOrShadowed(previous orElse found, packageClause) else if (prevPrec < packageClause) return findRef(found, packageClause, ctx)(outer) } |