We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent be64643 commit 1822623Copy full SHA for 1822623
compiler/src/dotty/tools/dotc/transform/LazyVals.scala
@@ -186,8 +186,9 @@ class LazyVals extends MiniPhaseTransform with IdentityDenotTransformer {
186
187
def mkNonThreadSafeDef(target: Tree, flag: Tree, rhs: Tree)(implicit ctx: Context) = {
188
val setFlag = flag.becomes(Literal(Constants.Constant(true)))
189
- val setTargets = if (isWildcardArg(rhs)) Nil else target.becomes(rhs) :: Nil
190
- val init = Block(setFlag :: setTargets, target.ensureApplied)
+ val flagSet = setFlag :: Nil
+ val targetSet = if (isWildcardArg(rhs)) flagSet else target.becomes(rhs) :: flagSet
191
+ val init = Block(targetSet, target.ensureApplied)
192
If(flag.ensureApplied, target.ensureApplied, init)
193
}
194
0 commit comments