@@ -137,13 +137,8 @@ abstract class Fields extends InfoTransform with ast.TreeDSL with TypingTransfor
137
137
// not stored, no side-effect
138
138
val pureConstant = tp.isInstanceOf [ConstantType ]
139
139
140
- val stored = ! (pureConstant || isUnitType(tp))
140
+ val stored = ! (pureConstant) // || isUnitType(tp))
141
141
142
- // - setter (for var) or getter (for val) that isn't stored
143
- // (pureConstant already shortcircuits this, but it may still be a unit-typed val)
144
- def deriveStoredAccessor (stat : Tree )(deriveUnitDef : Tree => Tree ) =
145
- if (! stored) deriveUnitDef(stat)
146
- else stat
147
142
148
143
// println(s"fieldMemoizationIn $sym $site = $tp")
149
144
def assignSym : Symbol =
@@ -448,7 +443,11 @@ abstract class Fields extends InfoTransform with ast.TreeDSL with TypingTransfor
448
443
449
444
def dropRhs = deriveDefDef(stat)(_ => EmptyTree )
450
445
implicit val fieldMemoization = fieldMemoizationIn(statSym, clazz)
451
- def deriveStoredAccessor (tree : Tree ) = fieldMemoization.deriveStoredAccessor(tree)(deriveUnitDef)
446
+
447
+ def deriveStoredAccessor (stat : Tree ) = stat
448
+ // if we decide to have non-stored fields with initialization effects:
449
+ // if (!fieldMemoization.stored) deriveUnitDef(stat)
450
+ // else stat
452
451
453
452
if (clazz.isTrait)
454
453
if (fieldMemoization.pureConstant) stat :: Nil
@@ -464,7 +463,7 @@ abstract class Fields extends InfoTransform with ast.TreeDSL with TypingTransfor
464
463
// drop the val for (a) constant (pure & not-stored) and (b) not-stored (but still effectful) fields
465
464
if (fieldMemoization.pureConstant) Nil // (a)
466
465
else if (fieldMemoization.stored) dropRhs :: init(rhs)
467
- else init(rhs) // (b)
466
+ else init(rhs) // (b) -- not used currently
468
467
469
468
case tree => List (
470
469
if (exprOwner != currentOwner && tree.isTerm) atOwner(exprOwner)(super .transform(tree))
0 commit comments