summaryrefslogtreecommitdiff
path: root/test/files/run/t6733.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 /test/files/run/t6733.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 'test/files/run/t6733.scala')
-rw-r--r--test/files/run/t6733.scala35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/files/run/t6733.scala b/test/files/run/t6733.scala
new file mode 100644
index 0000000000..525b276811
--- /dev/null
+++ b/test/files/run/t6733.scala
@@ -0,0 +1,35 @@
+import scala.reflect.runtime.universe._
+
+trait Foo {
+ private[this] val pri1a = 0
+ // private[this] val pri1b: Int
+ private[this] def pri2a = 1
+ // private[this] def pri2b: Int
+ private[this] var pri3a = 0
+ // private[this] var pri3b: Int
+ private[this] lazy val pri4a = 0
+ // private[this] lazy val pri4b: Int
+ private[this] type Pri5a = Int
+ // private[this] type Pri5b <: Int
+ private[this] class Pri6
+ private[this] trait Pri7
+ private[this] object Pri8
+
+ protected[this] val pro1a = 0
+ protected[this] val pro1b: Int
+ protected[this] def pro2a = 1
+ protected[this] def pro2b: Int
+ protected[this] var pro3a = 0
+ protected[this] var pro3b: Int
+ protected[this] lazy val pro4a = 0
+ // protected[this] lazy val pro4b: Int
+ protected[this] type Pro5a = Int
+ protected[this] type Pro5b <: Int
+ protected[this] class Pro6
+ protected[this] trait Pro7
+ protected[this] object Pro8
+}
+
+object Test extends App {
+ typeOf[Foo].declarations.sorted.foreach(m => println(s"$m: isPrivateThis = ${m.isPrivateThis}, isProtectedThis = ${m.isProtectedThis}"))
+} \ No newline at end of file