File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
src/compiler/scala/tools/nsc/transform Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -211,7 +211,8 @@ abstract class Fields extends InfoTransform with ast.TreeDSL with TypingTransfor
211
211
if (! localLazyVal) reflect.NameTransformer .LOCAL_SUFFIX_STRING
212
212
else reflect.NameTransformer .LAZY_LOCAL_SUFFIX_STRING
213
213
214
- // TODO: should end up final in bytecode
214
+ // the underlying field for a lazy val should not be final because we write to it outside of a constructor,
215
+ // so, set the MUTABLE flag
215
216
val fieldFlags =
216
217
if (! localLazyVal) flags & FieldFlags | PrivateLocal | MUTABLE
217
218
else (flags & FieldFlags | ARTIFACT | MUTABLE ) & ~ (IMPLICIT | STABLE )
@@ -514,7 +515,7 @@ abstract class Fields extends InfoTransform with ast.TreeDSL with TypingTransfor
514
515
val refClass = lazyHolders.getOrElse(lazyValType.typeSymbol, LazyRefClass )
515
516
val refTpe = if (refClass != LazyRefClass ) refClass.tpe else appliedType(refClass.typeConstructor, List (lazyValType))
516
517
517
- val flags = (lazyVal.flags & FieldFlags | ARTIFACT | MUTABLE ) & ~ (IMPLICIT | STABLE )
518
+ val flags = (lazyVal.flags & FieldFlags | ARTIFACT | MUTABLE ) & ~ (IMPLICIT | STABLE ) // TODO: why include MUTABLE???
518
519
val name = lazyVal.name.toTermName.append(nme.LAZY_LOCAL_SUFFIX_STRING )
519
520
val holderSym =
520
521
lazyVal.owner.newValue(name, lazyVal.pos, flags) setInfo refTpe
You can’t perform that action at this time.
0 commit comments