summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2007-02-01 17:57:01 +0000
committerMartin Odersky <odersky@gmail.com>2007-02-01 17:57:01 +0000
commit29f933b60ace6dbbeb45e0b31b0ed6d724dc74e9 (patch)
treef2c11c08576c4f0f387c1a0a7d6ad425270cd23c /src/compiler/scala/tools/nsc/typechecker/Contexts.scala
parent039e9821820695dc90ea712126a4de22e3a23341 (diff)
downloadscala-29f933b60ace6dbbeb45e0b31b0ed6d724dc74e9.tar.gz
scala-29f933b60ace6dbbeb45e0b31b0ed6d724dc74e9.tar.bz2
scala-29f933b60ace6dbbeb45e0b31b0ed6d724dc74e9.zip
added private[this] and protected[this] modifiers.
added modifiers for primary constructors.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Contexts.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Contexts.scala9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
index a77098a50f..0fb3d02cc5 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
@@ -339,12 +339,19 @@ trait Contexts requires Analyzer {
def isSubClassOfEnclosing(clazz: Symbol): boolean =
enclosingSuperClassContext(clazz) != NoContext
+ def isSubThisType(pre: Type, clazz: Symbol): boolean = pre match {
+ case ThisType(pclazz) => pclazz isNonBottomSubClass clazz
+ case _ => false
+ }
+
(pre == NoPrefix) || {
val ab = sym.accessBoundary(sym.owner)
((ab == NoSymbol)
||
(accessWithin(ab) || accessWithin(ab.linkedClassOfClass)) &&
- (!sym.hasFlag(LOCAL) || pre =:= sym.owner.thisType)
+ (!sym.hasFlag(LOCAL) ||
+ (sym hasFlag PROTECTED) && isSubThisType(pre, sym.owner) ||
+ pre =:= sym.owner.thisType)
||
(sym hasFlag PROTECTED) &&
(superAccess ||