diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2016-09-12 14:49:07 +1000 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2016-09-12 21:48:55 +1000 |
commit | a919fd7fa1f3c39dc396e7758240354e6fb0e79b (patch) | |
tree | f110734c398a8ed02fcf3446c31bdc108171bf8e /src/compiler/scala/tools/nsc/transform | |
parent | 05016d9035ab9b1c866bd9f12fdd0491f1ea0cbb (diff) | |
download | scala-a919fd7fa1f3c39dc396e7758240354e6fb0e79b.tar.gz scala-a919fd7fa1f3c39dc396e7758240354e6fb0e79b.tar.bz2 scala-a919fd7fa1f3c39dc396e7758240354e6fb0e79b.zip |
Avoid omitting constant typed vals in constructors
Fix for regression in 2.12.0-RC1 compiling shapeless tests.
They were given the same treatment as vals that are
members of classes on the definition side without the
requisite transformation of references to the val to
fold the constant into references.
This commit limits the transform to members of classes.
Co-Authored-By: Miles Sabin <miles@milessabin.com>
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/Fields.scala | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/Fields.scala b/src/compiler/scala/tools/nsc/transform/Fields.scala index a383b65192..0c7bc742d9 100644 --- a/src/compiler/scala/tools/nsc/transform/Fields.scala +++ b/src/compiler/scala/tools/nsc/transform/Fields.scala @@ -694,7 +694,7 @@ abstract class Fields extends InfoTransform with ast.TreeDSL with TypingTransfor // drop the val for (a) constant (pure & not-stored) and (b) not-stored (but still effectful) fields case ValDef(mods, _, _, rhs) if (rhs ne EmptyTree) && !excludedAccessorOrFieldByFlags(statSym) - && fieldMemoizationIn(statSym, currOwner).constantTyped => + && currOwner.isClass && fieldMemoizationIn(statSym, currOwner).constantTyped => EmptyThicket case ModuleDef(_, _, impl) => |