Skip to content

fix #1701: disqualify package name in type name resolution #1720

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/dotty/tools/dotc/core/Symbols.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
4 changes: 2 additions & 2 deletions src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
*/
def qualifies(denot: Denotation): Boolean =
reallyExists(denot) && !(
pt.isInstanceOf[UnapplySelectionProto] &&
(denot.symbol is (Method, butNot = Accessor)))
pt.isInstanceOf[UnapplySelectionProto] &&
(denot.symbol is (Method, butNot = Accessor)))

/** Find the denotation of enclosing `name` in given context `ctx`.
* @param previous A denotation that was found in a more deeply nested scope,
Expand Down
2 changes: 1 addition & 1 deletion tests/neg/i1643.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
trait T extends Array {
trait T extends Array { // error
def t1(as: String*): Array[String] = { varargs1(as: _*) } // error
def t2(as: String*): Array[String] = { super.varargs1(as: _*) } // error
}
Expand Down
5 changes: 5 additions & 0 deletions tests/neg/i1701.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
trait Foo {
def test (x : test) : Int // error: not found test
def f(x : src) : Int // error
def g(x : src.project) : Int // error
}