summaryrefslogtreecommitdiff
path: root/src/reflect/scala/reflect/api/Symbols.scala
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2014-01-27 15:19:07 +0300
committerEugene Burmako <xeno.by@gmail.com>2014-02-12 14:50:17 +0100
commit7c06c9d7f6a12c2b13c83b195fffa30c5a4ec3ce (patch)
tree6b99b01a0de8330174afef9ae615651e7ffcecc8 /src/reflect/scala/reflect/api/Symbols.scala
parent30174f9453a44845156f4abca0cd6317da3e27cc (diff)
downloadscala-7c06c9d7f6a12c2b13c83b195fffa30c5a4ec3ce.tar.gz
scala-7c06c9d7f6a12c2b13c83b195fffa30c5a4ec3ce.tar.bz2
scala-7c06c9d7f6a12c2b13c83b195fffa30c5a4ec3ce.zip
SI-6733 LOCAL, isLocal, and private[this]
Due to an unfortunate name collision, internal.Symbols#Symbol.isLocal means something different from Flag.LOCAL. Therefore api.Symbols#Symbol.isLocal was directly violating its documentation. Since we can’t give api#isLocal an implementation different from internal#isLocal, we have to rename, and for that occasion I have come up with names api#isPrivateThis and api#isProtectedThis, which in my opinion suits the public API better than internal#isPrivateLocal and internal#isProtectedLocal. Given the extraordinary circumstances of having no way for api#isLocal to work correctly, I’m forced to remove api#isLocal without a deprecation notice, exercising our right to break experimental APIs, something that we have never done before for reflection or macros. This is sad.
Diffstat (limited to 'src/reflect/scala/reflect/api/Symbols.scala')
-rw-r--r--src/reflect/scala/reflect/api/Symbols.scala21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/reflect/scala/reflect/api/Symbols.scala b/src/reflect/scala/reflect/api/Symbols.scala
index 1c3ae77d45..15d4fae59b 100644
--- a/src/reflect/scala/reflect/api/Symbols.scala
+++ b/src/reflect/scala/reflect/api/Symbols.scala
@@ -380,16 +380,13 @@ trait Symbols { self: Universe =>
*/
def isImplementationArtifact: Boolean
- /** Does this symbol represent a local declaration or definition?
- *
- * If yes, either `isPrivate` or `isProtected` are guaranteed to be true.
- * Local symbols can only be accessed from the same object instance.
- *
- * If yes, `privateWithin` might tell more about this symbol's visibility scope.
+ /** Does this symbol represent a declaration or definition written in a source file as `private[this]`
+ * or generated in tree/symbol form with the combination of flags LOCAL and PRIVATE?
+ * If yes, `isPrivate` is guaranteed to be true,
*
* @group Tests
*/
- def isLocal: Boolean
+ def isPrivateThis: Boolean
/** Does this symbol represent a private declaration or definition?
* If yes, `privateWithin` might tell more about this symbol's visibility scope.
@@ -398,6 +395,14 @@ trait Symbols { self: Universe =>
*/
def isPrivate: Boolean
+ /** Does this symbol represent a declaration or definition written in a source file as `protected[this]`
+ * or generated in tree/symbol form with the combination of flags LOCAL and PROTECTED?
+ * If yes, `isProtected` is guaranteed to be true,
+ *
+ * @group Tests
+ */
+ def isProtectedThis: Boolean
+
/** Does this symbol represent a protected declaration or definition?
* If yes, `privateWithin` might tell more about this symbol's visibility scope.
*
@@ -412,7 +417,7 @@ trait Symbols { self: Universe =>
def isPublic: Boolean
/**
- * Set when symbol has a modifier of the form private[X], NoSymbol otherwise.
+ * Set when symbol has a modifier of the form private[X] or protected[X], NoSymbol otherwise.
*
* Access level encoding: there are three scala flags (PRIVATE, PROTECTED,
* and LOCAL) which combine with value privateWithin (the "foo" in private[foo])