aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorodersky <odersky@gmail.com>2016-11-17 11:22:53 +0100
committerGitHub <noreply@github.com>2016-11-17 11:22:53 +0100
commit156a9d978c9dab8e63ce1677a8743487057533ba (patch)
tree85c865b928f5f194aba78cfea776fe37892c97a5
parent6f04ca7f497212df4172bdb119d523388c42d5fd (diff)
parente8a09cd0e21d4d51fb877ddd4d2b0c409ff906b9 (diff)
downloaddotty-156a9d978c9dab8e63ce1677a8743487057533ba.tar.gz
dotty-156a9d978c9dab8e63ce1677a8743487057533ba.tar.bz2
dotty-156a9d978c9dab8e63ce1677a8743487057533ba.zip
Merge pull request #1720 from dotty-staging/fix-i1701
fix #1701: disqualify package name in type name resolution
-rw-r--r--src/dotty/tools/dotc/core/Symbols.scala2
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala4
-rw-r--r--tests/neg/i1643.scala2
-rw-r--r--tests/neg/i1701.scala5
4 files changed, 9 insertions, 4 deletions
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 a93262314..667e1f82e 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -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,
diff --git a/tests/neg/i1643.scala b/tests/neg/i1643.scala
index d836a4255..889233b3a 100644
--- a/tests/neg/i1643.scala
+++ b/tests/neg/i1643.scala
@@ -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
}
diff --git a/tests/neg/i1701.scala b/tests/neg/i1701.scala
new file mode 100644
index 000000000..6b5e04692
--- /dev/null
+++ b/tests/neg/i1701.scala
@@ -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
+}