summaryrefslogtreecommitdiff
path: root/test/files/run/lazy-locals.scala
diff options
context:
space:
mode:
authorIulian Dragos <jaguarul@gmail.com>2009-03-30 14:50:49 +0000
committerIulian Dragos <jaguarul@gmail.com>2009-03-30 14:50:49 +0000
commit845c4fcd316ea0ec0b9ad38cad80d77a93607342 (patch)
treebd00d2dfe685d4afea75ce84d02641bf124fa5ef /test/files/run/lazy-locals.scala
parentfaa34dab7d0528cdaf9b0e0e5a47a39dc46adc87 (diff)
downloadscala-845c4fcd316ea0ec0b9ad38cad80d77a93607342.tar.gz
scala-845c4fcd316ea0ec0b9ad38cad80d77a93607342.tar.bz2
scala-845c4fcd316ea0ec0b9ad38cad80d77a93607342.zip
Fixed nested lazy values (#1589).
Diffstat (limited to 'test/files/run/lazy-locals.scala')
-rw-r--r--test/files/run/lazy-locals.scala24
1 files changed, 24 insertions, 0 deletions
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
}