aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/transform/Memoize.scala
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/src/dotty/tools/dotc/transform/Memoize.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/transform/Memoize.scala2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/src/dotty/tools/dotc/transform/Memoize.scala b/compiler/src/dotty/tools/dotc/transform/Memoize.scala
index 0314d4ec4..63edc0256 100644
--- a/compiler/src/dotty/tools/dotc/transform/Memoize.scala
+++ b/compiler/src/dotty/tools/dotc/transform/Memoize.scala
@@ -102,7 +102,7 @@ import Decorators._
case _ => t
}
skipBlocks(tree.rhs) match {
- case lit: Literal if sym.is(Final) && isIdempotentExpr(tree.rhs) =>
+ case lit: Literal if sym.is(Final, butNot = Mutable) && isIdempotentExpr(tree.rhs) =>
// duplicating scalac behavior: for final vals that have rhs as constant, we do not create a field
// and instead return the value. This seemingly minor optimization has huge effect on initialization
// order and the values that can be observed during superconstructor call