@@ -20,7 +20,7 @@ import collection.mutable
20
20
21
21
/** This phase performs the following transformations:
22
22
*
23
- * 1. (done in `traitDefs` and `transformSym`) Map every concrete trait getter
23
+ * 1. (done in `traitDefs` and `transformSym`) Map every concrete trait getter
24
24
*
25
25
* <mods> def x(): T = expr
26
26
*
@@ -83,6 +83,8 @@ import collection.mutable
83
83
* 4. (done in `transformTemplate` and `transformSym`) Drop all parameters from trait
84
84
* constructors.
85
85
*
86
+ * 5. (done in `transformSym`) Drop ParamAccessor flag from all parameter accessors in traits.
87
+ *
86
88
* Conceptually, this is the second half of the previous mixin phase. It needs to run
87
89
* after erasure because it copies references to possibly private inner classes and objects
88
90
* into enclosing classes where they are not visible. This can only be done if all references
@@ -97,7 +99,7 @@ class Mixin extends MiniPhaseTransform with SymTransformer { thisTransform =>
97
99
98
100
override def transformSym (sym : SymDenotation )(implicit ctx : Context ): SymDenotation =
99
101
if (sym.is(Accessor , butNot = Deferred ) && sym.owner.is(Trait ))
100
- sym.copySymDenotation(initFlags = sym.flags | Deferred ).ensureNotPrivate
102
+ sym.copySymDenotation(initFlags = sym.flags &~ ParamAccessor | Deferred ).ensureNotPrivate
101
103
else if (sym.isConstructor && sym.owner.is(Trait ) && sym.info.firstParamTypes.nonEmpty)
102
104
sym.copySymDenotation(info = MethodType (Nil , sym.info.resultType))
103
105
else
@@ -124,7 +126,7 @@ class Mixin extends MiniPhaseTransform with SymTransformer { thisTransform =>
124
126
def traitDefs (stats : List [Tree ]): List [Tree ] = {
125
127
val initBuf = new mutable.ListBuffer [Tree ]
126
128
stats.flatMap({
127
- case stat : DefDef if stat.symbol.isGetter && ! stat.rhs.isEmpty && ! stat.symbol.is(Flags .Lazy ) =>
129
+ case stat : DefDef if stat.symbol.isGetter && ! stat.rhs.isEmpty && ! stat.symbol.is(Flags .Lazy ) =>
128
130
// make initializer that has all effects of previous getter,
129
131
// replace getter rhs with empty tree.
130
132
val vsym = stat.symbol
@@ -197,7 +199,7 @@ class Mixin extends MiniPhaseTransform with SymTransformer { thisTransform =>
197
199
def initial = transformFollowing(superRef(initializer(getter)).appliedToNone)
198
200
if (isCurrent(getter) || getter.is(ExpandedName )) {
199
201
val rhs =
200
- if (getter.is(ParamAccessor )) nextArgument()
202
+ if (ctx.atPhase(thisTransform)( implicit ctx => getter.is(ParamAccessor ) )) nextArgument()
201
203
else if (isScala2x) Underscore (getter.info.resultType)
202
204
else transformFollowing(superRef(initializer(getter)).appliedToNone)
203
205
// transformFollowing call is needed to make memoize & lazy vals run
0 commit comments