diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2016-07-08 10:11:07 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2016-07-12 17:55:25 +0200 |
commit | d33f2993782c259831e10beacc8274424b3a6250 (patch) | |
tree | a0fd9d35e061a716730f6a91f3daddb9c8d928d5 /test | |
parent | 6612ba010b0e70c53550d1e47141c8dc89a55f23 (diff) | |
download | scala-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')
-rw-r--r-- | test/files/neg/t9849.check | 7 | ||||
-rw-r--r-- | test/files/neg/t9849.scala | 16 |
2 files changed, 23 insertions, 0 deletions
diff --git a/test/files/neg/t9849.check b/test/files/neg/t9849.check new file mode 100644 index 0000000000..7b47150846 --- /dev/null +++ b/test/files/neg/t9849.check @@ -0,0 +1,7 @@ +t9849.scala:14: error: method h in object O cannot be accessed in object p.O + O.h() + ^ +t9849.scala:15: error: method h$default$1 in object O cannot be accessed in object p.O + O.h$default$1 + ^ +two errors found 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 +} |