diff options
author | Adriaan Moors <adriaan@lightbend.com> | 2016-10-10 12:02:54 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-10 12:02:54 -0500 |
commit | 876401bbe7071083325e33c902e94abd93b0b60b (patch) | |
tree | 6726a261e6e8a1ab2d9cee7b9053d915b0aa9908 /test | |
parent | ada6b6b67a0ee3fd4e8251d22abce1cdd6cbb931 (diff) | |
parent | ef14a9af16d988e6240c8a3943fa3df84ee42606 (diff) | |
download | scala-876401bbe7071083325e33c902e94abd93b0b60b.tar.gz scala-876401bbe7071083325e33c902e94abd93b0b60b.tar.bz2 scala-876401bbe7071083325e33c902e94abd93b0b60b.zip |
Merge pull request #5445 from retronym/ticket/9946b
SI-9946 Fix regressions with nullification of singly used fields
Diffstat (limited to 'test')
-rw-r--r-- | test/files/run/t9946a.scala | 14 | ||||
-rw-r--r-- | test/files/run/t9946b.scala | 12 | ||||
-rw-r--r-- | test/files/run/t9946c.scala | 10 |
3 files changed, 36 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 + } +} diff --git a/test/files/run/t9946b.scala b/test/files/run/t9946b.scala new file mode 100644 index 0000000000..ac102a38f7 --- /dev/null +++ b/test/files/run/t9946b.scala @@ -0,0 +1,12 @@ +class Test(private val x: String) { + lazy val y = x.reverse +} +object Test { + def getX(t: Test) = t.x + def main(args: Array[String]): Unit = { + val t = new Test("foo") + assert(t.y == "oof", t.y) + assert(t.x == "foo", t.x) + } +} + diff --git a/test/files/run/t9946c.scala b/test/files/run/t9946c.scala new file mode 100644 index 0000000000..f9fe68d48f --- /dev/null +++ b/test/files/run/t9946c.scala @@ -0,0 +1,10 @@ +class Test(private[this] val x: String) { + lazy val y = x.reverse +} +object Test { + def main(args: Array[String]): Unit = { + val t = new Test("foo") + assert(t.y == "oof", t.y) + } +} + |