diff options
author | Nicolas Stucki <nicolas.stucki@gmail.com> | 2017-01-05 09:58:21 +0100 |
---|---|---|
committer | Nicolas Stucki <nicolas.stucki@gmail.com> | 2017-01-05 09:58:21 +0100 |
commit | 63d68bf4d3cbac82f6d9faf19acd5589603a17ee (patch) | |
tree | a3533127f188d03420576c7f4a7aecf2c5c1a9e4 /compiler | |
parent | 3922cce7afc295f7816397ebf2d2f59446a89041 (diff) | |
download | dotty-63d68bf4d3cbac82f6d9faf19acd5589603a17ee.tar.gz dotty-63d68bf4d3cbac82f6d9faf19acd5589603a17ee.tar.bz2 dotty-63d68bf4d3cbac82f6d9faf19acd5589603a17ee.zip |
Fix #1878: Generate fields for final vars.
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/src/dotty/tools/dotc/transform/Memoize.scala | 2 |
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 |