From e8a09cd0e21d4d51fb877ddd4d2b0c409ff906b9 Mon Sep 17 00:00:00 2001 From: liu fengyun Date: Thu, 17 Nov 2016 10:17:45 +0100 Subject: don't enter package to owner's scope --- src/dotty/tools/dotc/core/Symbols.scala | 2 +- src/dotty/tools/dotc/typer/Typer.scala | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/dotty/tools/dotc/core/Symbols.scala b/src/dotty/tools/dotc/core/Symbols.scala index 38b2c8bd6..b5bd196d2 100644 --- a/src/dotty/tools/dotc/core/Symbols.scala +++ b/src/dotty/tools/dotc/core/Symbols.scala @@ -428,7 +428,7 @@ object Symbols { final def entered(implicit ctx: Context): this.type = { assert(this.owner.isClass, s"symbol ($this) entered the scope of non-class owner ${this.owner}") // !!! DEBUG this.owner.asClass.enter(this) - if (this is Module) this.owner.asClass.enter(this.moduleClass) + if (this.is(Module, butNot = Package)) this.owner.asClass.enter(this.moduleClass) this } diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 32d4a8336..667e1f82e 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -126,9 +126,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit * case x :: xs in class List would return the :: method). */ def qualifies(denot: Denotation): Boolean = - reallyExists(denot) && - !(name.isTypeName && denot.symbol.is(Package)) && - !(pt.isInstanceOf[UnapplySelectionProto] && + reallyExists(denot) && !( + pt.isInstanceOf[UnapplySelectionProto] && (denot.symbol is (Method, butNot = Accessor))) /** Find the denotation of enclosing `name` in given context `ctx`. -- cgit v1.2.3