@@ -157,7 +157,7 @@ abstract class ExplicitOuter extends InfoTransform
157
157
if (hasOuterField(clazz)) // 2
158
158
decls1 enter newOuterField(clazz)
159
159
}
160
- if (! clazz.isTrait && ! parents.isEmpty) {
160
+ if (! clazz.isTrait && ! parents.isEmpty) { // 4
161
161
for (mc <- clazz.mixinClasses) {
162
162
val mixinOuterAcc : Symbol = exitingExplicitOuter(outerAccessor(mc))
163
163
if (mixinOuterAcc != NoSymbol ) {
@@ -264,7 +264,12 @@ abstract class ExplicitOuter extends InfoTransform
264
264
}
265
265
}
266
266
267
- /** <p>
267
+ /** TODO: Revise this.... We shouldn't use makeNotPrivate until all subsequent phases are able to resolve symbolically
268
+ * (e.g., if we name mangle a getter, we can no longer look up the setter unless its name is also name mangled)
269
+ * We also shouldn't be messing with privacy that's unrelated to outer accessors.
270
+ * Since traits are now compiled to java interfaces, protected has the same applicability as for classes.
271
+ *
272
+ * <p>
268
273
* The phase performs the following transformations on terms:
269
274
* </p>
270
275
* <ol>
@@ -411,8 +416,12 @@ abstract class ExplicitOuter extends InfoTransform
411
416
else atPos(tree.pos)(outerPath(outerValue, currentClass.outerClass, sym)) // (5)
412
417
413
418
case Select (qual, name) =>
414
- // make not private symbol accessed from inner classes, as well as
419
+ // TODO: move this to the end of the pipeline, as it breaks member lookup
420
+ // (e.g., getter <> setter correlation is by name, but we could use the referenced field for that...?)
421
+ //
422
+ // symbols accessed from inner classes, as well as
415
423
// symbols accessed from @inline methods
424
+ // are made not-private (name mangling to emulate privacy)
416
425
//
417
426
// See SI-6552 for an example of why `sym.owner.enclMethod hasAnnotation ScalaInlineClass`
418
427
// is not suitable; if we make a method-local class non-private, it mangles outer pointer names.
@@ -422,10 +431,12 @@ abstract class ExplicitOuter extends InfoTransform
422
431
if ((currentClass != sym.owner || enclMethodIsInline) && ! sym.isMethodWithExtension)
423
432
sym.makeNotPrivate(sym.owner)
424
433
425
- val qsym = qual.tpe.widen.typeSymbol
426
- if (sym.isProtected && // (4)
427
- (qsym.isTrait || ! (qual.isInstanceOf [Super ] || (qsym isSubClass currentClass))))
434
+ // (4)
435
+ if (sym.isProtected &&
436
+ ! qual.isInstanceOf [Super ] &&
437
+ ! (qual.tpe.widen.typeSymbol isSubClass currentClass))
428
438
sym setFlag notPROTECTED
439
+
429
440
super .transform(tree)
430
441
431
442
case Apply (sel @ Select (qual, nme.CONSTRUCTOR ), args) if isInner(sel.symbol.owner) =>
0 commit comments