summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
index 13cbfacb61..6fba6dcc39 100644
--- a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
+++ b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
@@ -46,13 +46,13 @@ abstract class ExplicitOuter extends InfoTransform
private def haveSameOuter(parent: Type, clazz: Symbol) = parent match {
case TypeRef(pre, sym, _) =>
val owner = clazz.owner
-
+
//println(s"have same outer $parent $clazz $sym ${sym.owner} $owner $pre")
sym.isClass && owner.isClass &&
- (owner isSubClass sym.owner) &&
+ (owner isSubClass sym.owner) &&
owner.thisType =:= pre
-
+
case _ => false
}
@@ -497,8 +497,18 @@ abstract class ExplicitOuter extends InfoTransform
else atPos(tree.pos)(outerPath(outerValue, currentClass.outerClass, sym)) // (5)
case Select(qual, name) =>
- if (currentClass != sym.owner) // (3)
+ /** return closest enclosing method, unless shadowed by an enclosing class;
+ * no use of closures here in the interest of speed.
+ */
+ def closestEnclMethod(from: Symbol): Symbol =
+ if (from.isSourceMethod) from
+ else if (from.isClass) NoSymbol
+ else closestEnclMethod(from.owner)
+
+ if (currentClass != sym.owner ||
+ (closestEnclMethod(currentOwner) hasAnnotation ScalaInlineClass))
sym.makeNotPrivate(sym.owner)
+
val qsym = qual.tpe.widen.typeSymbol
if (sym.isProtected && //(4)
(qsym.isTrait || !(qual.isInstanceOf[Super] || (qsym isSubClass currentClass))))