diff options
author | Martin Odersky <odersky@gmail.com> | 2014-02-02 17:09:33 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-02-02 17:32:04 +0100 |
commit | 20c0a6a92dc2d618fa557bb19d78d8595ca527e6 (patch) | |
tree | 3fdbd3aac9bd22335ba5cb2b2fb0dc64577f4a72 /src/dotty/tools/dotc/typer/Typer.scala | |
parent | c683f1c1d8235fffc4475e7b51ddc7536ec7eaa1 (diff) | |
download | dotty-20c0a6a92dc2d618fa557bb19d78d8595ca527e6.tar.gz dotty-20c0a6a92dc2d618fa557bb19d78d8595ca527e6.tar.bz2 dotty-20c0a6a92dc2d618fa557bb19d78d8595ca527e6.zip |
Avoid accessing implicits that come from root imports that are hidden by some nested import.
This also changes the criterion when a root import is disabled.
A root import is now disabled if there is an inner import from the same package or module, and the inner import contains at least one disabling clause X => _. (The latter crierion is new; without it, we would consider something like
import scala.{collections => c}
as a hiding import for Scala, which seems to go too far.)
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 9ae8252a1..aad03c47c 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -185,11 +185,8 @@ class Typer extends Namer with Applications with Implicits { * import in the same program? */ def isDisabled(imp: ImportInfo, site: Type): Boolean = { - val qualSym = site.termSymbol - if (defn.RootImports contains qualSym) { - if (imp.isRootImport && (importedFromRoot contains qualSym)) return true - importedFromRoot += qualSym - } + if (imp.isRootImport && (importedFromRoot contains site.termSymbol)) return true + if (imp.hiddenRoot.exists) importedFromRoot += imp.hiddenRoot false } |