aboutsummaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-04-10 22:30:04 +0200
committerMartin Odersky <odersky@gmail.com>2017-04-11 09:33:13 +0200
commita5b6bd6ac30b3ef618314ee8eff7b1d71b0fe131 (patch)
treec9c7b55b74826bd61029c42414c752c7c468f0f6 /compiler
parent800b1ad042044d8902c76fe353f7adf0491b5f20 (diff)
downloaddotty-a5b6bd6ac30b3ef618314ee8eff7b1d71b0fe131.tar.gz
dotty-a5b6bd6ac30b3ef618314ee8eff7b1d71b0fe131.tar.bz2
dotty-a5b6bd6ac30b3ef618314ee8eff7b1d71b0fe131.zip
Adapt isPackageObject to semantic naming
Used a hardcoded string before, which caused test failures.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/src/dotty/tools/dotc/core/StdNames.scala1
-rw-r--r--compiler/src/dotty/tools/dotc/core/SymDenotations.scala6
2 files changed, 4 insertions, 3 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/StdNames.scala b/compiler/src/dotty/tools/dotc/core/StdNames.scala
index 306a84589..92befdacb 100644
--- a/compiler/src/dotty/tools/dotc/core/StdNames.scala
+++ b/compiler/src/dotty/tools/dotc/core/StdNames.scala
@@ -135,7 +135,6 @@ object StdNames {
val OPS_PACKAGE: N = "<special-ops>"
val OVERLOADED: N = "<overloaded>"
val PACKAGE: N = "package"
- val PACKAGE_CLS: N = "package$"
val ROOT: N = "<root>"
val SPECIALIZED_SUFFIX: N = "$sp"
val SUPER_PREFIX: N = "super$"
diff --git a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala
index 5a277cacb..1e0beb5f3 100644
--- a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -513,8 +513,10 @@ object SymDenotations {
/** Is this symbol a package object or its module class? */
def isPackageObject(implicit ctx: Context): Boolean = {
- val poName = if (isType) nme.PACKAGE_CLS else nme.PACKAGE
- (name.toTermName == poName) && (owner is Package) && (this is Module)
+ val nameMatches =
+ if (isType) name == tpnme.PACKAGE.moduleClassName
+ else name == nme.PACKAGE
+ nameMatches && (owner is Package) && (this is Module)
}
/** Is this symbol an abstract type? */