summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
diff options
context:
space:
mode:
authorIulian Dragos <jaguarul@gmail.com>2007-09-25 10:00:09 +0000
committerIulian Dragos <jaguarul@gmail.com>2007-09-25 10:00:09 +0000
commitddae8fd220ab376194e1827d908f6492274a9c5e (patch)
treeef8a0cdd49a0b097fe0c9e6735f65250f6277aee /src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
parentff6a4630be6c51fdb6e56271bd589821c51090da (diff)
downloadscala-ddae8fd220ab376194e1827d908f6492274a9c5e.tar.gz
scala-ddae8fd220ab376194e1827d908f6492274a9c5e.tar.bz2
scala-ddae8fd220ab376194e1827d908f6492274a9c5e.zip
Fixed ticket #116 (protected accessor crashes c...
Fixed ticket #116 (protected accessor crashes compiler).
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
index 7323529d94..26b4f9c72d 100644
--- a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
@@ -329,6 +329,9 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT
* A special case arises for classes with explicit self-types. If the
* self type is a Java class, and a protected accessor is needed, we issue
* an error. If the self type is a Scala class, we don't add an accessor.
+ * An accessor is not needed if the access boundary is larger than the
+ * enclosing package, since that translates to 'public' on the host system.
+ * (as Java has no real package nesting).
*
* If the access happens inside a 'trait', access is more problematic since
* the implementation code is moved to an '$class' class which does not
@@ -339,7 +342,8 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT
val res = /* settings.debug.value && */
((sym hasFlag PROTECTED)
&& (!validCurrentOwner || !(currentOwner.enclClass.thisSym isSubClass sym.owner))
- && (enclPackage(sym.owner) != enclPackage(currentOwner)))
+ && (enclPackage(sym.owner) != enclPackage(currentOwner))
+ && (enclPackage(sym.owner) == sym.accessBoundary(sym.owner)))
if (res) {
val host = hostForAccessorOf(sym, currentOwner.enclClass)