diff options
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/lazy-locals.check | 5 | ||||
-rw-r--r-- | test/files/run/lazy-locals.scala | 24 |
2 files changed, 29 insertions, 0 deletions
diff --git a/test/files/run/lazy-locals.check b/test/files/run/lazy-locals.check index 63beca0717..7d14da243b 100644 --- a/test/files/run/lazy-locals.check +++ b/test/files/run/lazy-locals.check @@ -82,3 +82,8 @@ forced lazy val t at n = 5 First 5 elements of ones: List(1, 1, 1, 1, 1) I am initialized when the constructor is run false +forcing x +forcing y +42 +15 +42 diff --git a/test/files/run/lazy-locals.scala b/test/files/run/lazy-locals.scala index 5279901795..be738a0f70 100644 --- a/test/files/run/lazy-locals.scala +++ b/test/files/run/lazy-locals.scala @@ -161,6 +161,28 @@ object Test extends Application { } } + // see #1589 + object NestedLazyVals extends Application { + lazy val x = { + lazy val y = { println("forcing y"); 42; } + println("forcing x") + y + } + + val x1 = 5 + { lazy val y = 10 ; y } + + println(x) + println(x1) + } + + trait TNestedLazyVals { + lazy val x = { lazy val y = 42; y } + } + + object ONestedLazyVals extends Application with TNestedLazyVals { + println(x) + } + println(testLazy) testLazy32 testLazy33 @@ -169,4 +191,6 @@ object Test extends Application { testRecVal new CtorBlock println(testReturnInLazyVal) + NestedLazyVals + ONestedLazyVals } |