summaryrefslogtreecommitdiff
path: root/test/files/run/t9946a.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2016-10-06 17:45:38 +1100
committerJason Zaugg <jzaugg@gmail.com>2016-10-07 09:48:40 +1100
commit55c0581b476381fe66ff0df2ada44560f6511648 (patch)
tree069e3a658ebf669bd71d55c2f1d537538b1d400d /test/files/run/t9946a.scala
parentada6b6b67a0ee3fd4e8251d22abce1cdd6cbb931 (diff)
downloadscala-55c0581b476381fe66ff0df2ada44560f6511648.tar.gz
scala-55c0581b476381fe66ff0df2ada44560f6511648.tar.bz2
scala-55c0581b476381fe66ff0df2ada44560f6511648.zip
SI-9946 make nullification of lazy val dependencies module aware
If a non-transient lazy val is the only user of a private field in a class, the field is nulled out at the end of the lazy initializer. This is tested in the existing test `run/lazy-leaks.scala`. The analysis of which fields could be nulled out was recently moved from `mixin` to the new `fields` phase. This introduced a regression as a it didn't account for the richer pallete of trees and symbols at that juncture. This commit excludes references to private member modules from collection of private fields, thus avoiding a later compiler crash in the backend due to a nonsense tree trying to null out the module symbol. It might make sense to null out the module var, but I've opted to limit the scope of this analysis to paramaccessors and regular fields.
Diffstat (limited to 'test/files/run/t9946a.scala')
-rw-r--r--test/files/run/t9946a.scala14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/files/run/t9946a.scala b/test/files/run/t9946a.scala
new file mode 100644
index 0000000000..491fb31f7b
--- /dev/null
+++ b/test/files/run/t9946a.scala
@@ -0,0 +1,14 @@
+package p1 {
+ object O {
+ private case class N(a: Any)
+ lazy val x: AnyRef = N
+ lazy val y: AnyRef = new { assert(N != null) }
+ }
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ p1.O.x
+ p1.O.y
+ }
+}