File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
src/compiler/scala/tools/nsc/transform Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,8 @@ abstract class Fields extends InfoTransform with ast.TreeDSL with TypingTransfor
35
35
/** the following two members override abstract members in Transform */
36
36
val phaseName : String = " fields"
37
37
38
+ // TODO: replace SYNTHESIZE_IMPL_IN_SUBCLASS by (late)DEFERRED | FINAL, which would also obviate need for FINAL_TRAIT_ACCESSOR
39
+
38
40
// used for internal communication between info and tree transform of this phase -- not pickled, not in initialflags
39
41
override def phaseNewFlags : Long = NEEDS_TREES | OVERRIDDEN_TRAIT_SETTER | FINAL_TRAIT_ACCESSOR
40
42
@@ -135,13 +137,14 @@ abstract class Fields extends InfoTransform with ast.TreeDSL with TypingTransfor
135
137
// instead of the concrete (desired) one in the class
136
138
if (accessor.isProtected) accessor setFlag notPROTECTED
137
139
138
- // trait members cannot be final (but the synthesized ones should be)
139
140
// must not reset LOCAL, as we must maintain protected[this]ness to allow that variance hole
140
141
// (not sure why this only problem only arose when we started setting the notPROTECTED flag)
141
- accessor resetFlag (FINAL )
142
142
143
143
// derive trait setter after calling makeNotPrivate (so that names are mangled consistently)
144
144
if (memoizedGetter) {
145
+ // memoized trait members cannot be final (but the synthesized ones should be)
146
+ accessor resetFlag (FINAL )
147
+
145
148
// a memoized accessor in a trait is made deferred now (mixins will deal with non-memoized getters like any other method)
146
149
// can't mark getter as FINAL in trait, but remember for when we synthetisize the impl in the subclass to make it FINAL
147
150
// (it'll receive an implementation in the first real class to extend this trait)
You can’t perform that action at this time.
0 commit comments