aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/SymDenotations.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-01-18 18:05:43 +0100
committerMartin Odersky <odersky@gmail.com>2014-01-18 18:05:52 +0100
commitd172c1687eb4558369616696d93ed944f2fc8776 (patch)
treeba14d2bb7d8752d3ed0a0a167b3c4dd233c2b85f /src/dotty/tools/dotc/core/SymDenotations.scala
parent55c84fb40bccf7ab7c42f3544bd5f92e69b20ac4 (diff)
downloaddotty-d172c1687eb4558369616696d93ed944f2fc8776.tar.gz
dotty-d172c1687eb4558369616696d93ed944f2fc8776.tar.bz2
dotty-d172c1687eb4558369616696d93ed944f2fc8776.zip
Make signatures use fully qualified names.
Needed a refactoring of fullname to be able to refer to fullName without passing a context explicitly. Also, relax isAccessible check. The prefix condition for protected access need not hold for constructors.
Diffstat (limited to 'src/dotty/tools/dotc/core/SymDenotations.scala')
-rw-r--r--src/dotty/tools/dotc/core/SymDenotations.scala12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala
index 9da918867..40f155ed9 100644
--- a/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -229,7 +229,7 @@ object SymDenotations {
* Never translates expansions of operators back to operator symbol.
* Drops package objects. Represents terms in the owner chain by a simple `separator`.
*/
- def fullName(separator: Char)(implicit ctx: Context): Name =
+ def fullNameSeparated(separator: Char)(implicit ctx: Context): Name =
if (symbol == NoSymbol || owner == NoSymbol || owner.isEffectiveRoot) name
else {
var owner = this
@@ -238,11 +238,12 @@ object SymDenotations {
owner = owner.owner
sep += separator
} while (!owner.isClass)
- owner.skipPackageObject.fullName(separator) ++ sep ++ name
+ val fn = owner.skipPackageObject.fullNameSeparated(separator) ++ sep ++ name
+ if (isType) fn.toTypeName else fn.toTermName
}
/** `fullName` where `.' is the separator character */
- def fullName(implicit ctx: Context): Name = fullName('.')
+ def fullName(implicit ctx: Context): Name = fullNameSeparated('.')
// ----- Tests -------------------------------------------------
@@ -426,6 +427,7 @@ object SymDenotations {
else if (
!( isType // allow accesses to types from arbitrary subclasses fixes #4737
|| pre.baseType(cls).exists
+ || isConstructor
|| (owner is ModuleClass) // don't perform this check for static members
))
fail(
@@ -1092,11 +1094,11 @@ object SymDenotations {
}
private[this] var fullNameCache: SimpleMap[Character, Name] = SimpleMap.Empty
- override final def fullName(separator: Char)(implicit ctx: Context): Name = {
+ override final def fullNameSeparated(separator: Char)(implicit ctx: Context): Name = {
val cached = fullNameCache(separator)
if (cached != null) cached
else {
- val fn = super.fullName(separator)
+ val fn = super.fullNameSeparated(separator)
fullNameCache = fullNameCache.updated(separator, fn)
fn
}