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
3535 /** the following two members override abstract members in Transform */
3636 val phaseName : String = " fields"
3737
38+ // TODO: replace SYNTHESIZE_IMPL_IN_SUBCLASS by (late)DEFERRED | FINAL, which would also obviate need for FINAL_TRAIT_ACCESSOR
39+
3840 // used for internal communication between info and tree transform of this phase -- not pickled, not in initialflags
3941 override def phaseNewFlags : Long = NEEDS_TREES | OVERRIDDEN_TRAIT_SETTER | FINAL_TRAIT_ACCESSOR
4042
@@ -135,13 +137,14 @@ abstract class Fields extends InfoTransform with ast.TreeDSL with TypingTransfor
135137 // instead of the concrete (desired) one in the class
136138 if (accessor.isProtected) accessor setFlag notPROTECTED
137139
138- // trait members cannot be final (but the synthesized ones should be)
139140 // must not reset LOCAL, as we must maintain protected[this]ness to allow that variance hole
140141 // (not sure why this only problem only arose when we started setting the notPROTECTED flag)
141- accessor resetFlag (FINAL )
142142
143143 // derive trait setter after calling makeNotPrivate (so that names are mangled consistently)
144144 if (memoizedGetter) {
145+ // memoized trait members cannot be final (but the synthesized ones should be)
146+ accessor resetFlag (FINAL )
147+
145148 // a memoized accessor in a trait is made deferred now (mixins will deal with non-memoized getters like any other method)
146149 // can't mark getter as FINAL in trait, but remember for when we synthetisize the impl in the subclass to make it FINAL
147150 // (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