summaryrefslogtreecommitdiff
path: root/test/files/neg/t9849.scala
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2016-07-08 10:11:07 +0200
committerLukas Rytz <lukas.rytz@gmail.com>2016-07-12 17:55:25 +0200
commitd33f2993782c259831e10beacc8274424b3a6250 (patch)
treea0fd9d35e061a716730f6a91f3daddb9c8d928d5 /test/files/neg/t9849.scala
parent6612ba010b0e70c53550d1e47141c8dc89a55f23 (diff)
downloadscala-d33f2993782c259831e10beacc8274424b3a6250.tar.gz
scala-d33f2993782c259831e10beacc8274424b3a6250.tar.bz2
scala-d33f2993782c259831e10beacc8274424b3a6250.zip
SI-9849 set privateWithin on default getters
A default getter get the same access flag (private / protected) as the method whose default it implements. However, we forgot to set the privateWithin flag, which defines the scope in a qualified private / protected modifier. For a private[p], the default getter was therefore public, which is less restricted (a private[p] method has privateWithin set to p, but the private flag is not set). For a protected[p], the default getter was protected, which is more restricted.
Diffstat (limited to 'test/files/neg/t9849.scala')
-rw-r--r--test/files/neg/t9849.scala16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/files/neg/t9849.scala b/test/files/neg/t9849.scala
new file mode 100644
index 0000000000..bcd18b6916
--- /dev/null
+++ b/test/files/neg/t9849.scala
@@ -0,0 +1,16 @@
+package p
+
+object O {
+ protected[p] def f(x: Int = 1) = x
+ private[p] def g(x: Int = 1) = x
+ private def h(x: Int = 1) = x
+}
+
+object Test {
+ O.f()
+ O.f$default$1
+ O.g()
+ O.g$default$1
+ O.h()
+ O.h$default$1
+}