Skip to content

Commit 988f9ee

Browse files
committed
Revert "Fix #1878: Generate fields for final vars."
This reverts commit 63d68bf.
1 parent be64643 commit 988f9ee

File tree

3 files changed

+1
-25
lines changed

3 files changed

+1
-25
lines changed

compiler/src/dotty/tools/dotc/transform/Memoize.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ import Decorators._
102102
case _ => t
103103
}
104104
skipBlocks(tree.rhs) match {
105-
case lit: Literal if sym.is(Final, butNot = Mutable) && isIdempotentExpr(tree.rhs) =>
105+
case lit: Literal if sym.is(Final) && isIdempotentExpr(tree.rhs) =>
106106
// duplicating scalac behavior: for final vals that have rhs as constant, we do not create a field
107107
// and instead return the value. This seemingly minor optimization has huge effect on initialization
108108
// order and the values that can be observed during superconstructor call

tests/run/final-var.check

Lines changed: 0 additions & 4 deletions
This file was deleted.

tests/run/final-var.scala

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)