summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2014-01-27 15:45:18 +0300
committerEugene Burmako <xeno.by@gmail.com>2014-02-12 14:53:48 +0100
commitc34b24a6c4b75a6215bdb8fd8ff94ce869430435 (patch)
tree4792a96322e2f30b7fe1830091cf748503636bfc /src/compiler/scala/tools/nsc/typechecker/Contexts.scala
parent7c06c9d7f6a12c2b13c83b195fffa30c5a4ec3ce (diff)
downloadscala-c34b24a6c4b75a6215bdb8fd8ff94ce869430435.tar.gz
scala-c34b24a6c4b75a6215bdb8fd8ff94ce869430435.tar.bz2
scala-c34b24a6c4b75a6215bdb8fd8ff94ce869430435.zip
disambiguates uses of “local” in internal symbol API
There’s been a conflation of two distinct meanings of the word “local” in the internal symbol API: the first meaning being “local to this” (as in has the LOCAL flag set), the second meaning being “local to block” (as in declared in a block, i.e. having owner being a term symbol). Especially confusing is the fact that sym.isLocal isn’t the same as sym.hasFlag(LOCAL), which has led to now fixed SI-6733. This commit fixes the semantic mess by deprecating both Symbol.isLocal and Symbol.hasLocalFlag (that we were forced to use, because Symbol.isLocal had already been taken), and replacing them with Symbol.isLocalToThis and Symbol.isLocalToBlock. Unfortunately, we can’t remove the deprecated methods right away, because they are used in SBT, so I had to take small steps.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Contexts.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Contexts.scala7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
index c065fb54b7..a66925b948 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
@@ -516,7 +516,7 @@ trait Contexts { self: Analyzer =>
argContext.scope enter e.sym
}
}
- if (c.isLocal && !c.owner.isLocalDummy) {
+ if (c.owner.isTerm && !c.owner.isLocalDummy) {
enterElems(c.outer)
enterLocalElems(c.scope.elems)
}
@@ -589,9 +589,6 @@ trait Contexts { self: Analyzer =>
else if (bufferErrors) reportBuffer += (pos -> msg)
}
- /** Is the owning symbol of this context a term? */
- final def isLocal: Boolean = owner.isTerm
-
// nextOuter determines which context is searched next for implicits
// (after `this`, which contributes `newImplicits` below.) In
// most cases, it is simply the outer context: if we're owned by
@@ -714,7 +711,7 @@ trait Contexts { self: Analyzer =>
( (ab.isTerm || ab == rootMirror.RootClass)
|| (accessWithin(ab) || accessWithinLinked(ab)) &&
- ( !sym.hasLocalFlag
+ ( !sym.isLocalToThis
|| sym.owner.isImplClass // allow private local accesses to impl classes
|| sym.isProtected && isSubThisType(pre, sym.owner)
|| pre =:= sym.owner.thisType