Skip to content

Commit 156a9d9

Browse files
authored
Merge pull request #1720 from dotty-staging/fix-i1701
fix #1701: disqualify package name in type name resolution
2 parents 6f04ca7 + e8a09cd commit 156a9d9

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

src/dotty/tools/dotc/core/Symbols.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ object Symbols {
428428
final def entered(implicit ctx: Context): this.type = {
429429
assert(this.owner.isClass, s"symbol ($this) entered the scope of non-class owner ${this.owner}") // !!! DEBUG
430430
this.owner.asClass.enter(this)
431-
if (this is Module) this.owner.asClass.enter(this.moduleClass)
431+
if (this.is(Module, butNot = Package)) this.owner.asClass.enter(this.moduleClass)
432432
this
433433
}
434434

src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
127127
*/
128128
def qualifies(denot: Denotation): Boolean =
129129
reallyExists(denot) && !(
130-
pt.isInstanceOf[UnapplySelectionProto] &&
131-
(denot.symbol is (Method, butNot = Accessor)))
130+
pt.isInstanceOf[UnapplySelectionProto] &&
131+
(denot.symbol is (Method, butNot = Accessor)))
132132

133133
/** Find the denotation of enclosing `name` in given context `ctx`.
134134
* @param previous A denotation that was found in a more deeply nested scope,

tests/neg/i1643.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
trait T extends Array {
1+
trait T extends Array { // error
22
def t1(as: String*): Array[String] = { varargs1(as: _*) } // error
33
def t2(as: String*): Array[String] = { super.varargs1(as: _*) } // error
44
}

tests/neg/i1701.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
trait Foo {
2+
def test (x : test) : Int // error: not found test
3+
def f(x : src) : Int // error
4+
def g(x : src.project) : Int // error
5+
}

0 commit comments

Comments
 (0)