summaryrefslogtreecommitdiff
path: root/test/files/run/lazy-traits.scala
diff options
context:
space:
mode:
authorIulian Dragos <jaguarul@gmail.com>2007-11-19 13:39:59 +0000
committerIulian Dragos <jaguarul@gmail.com>2007-11-19 13:39:59 +0000
commitd0c65dcd15b24d0ec17dc99eeff7c0d3cb59d45a (patch)
tree574fe29fa2bd6f4e654688372fa0d8b1889be86e /test/files/run/lazy-traits.scala
parent82c5f83abc60d080a4809e9c7891e2f0c9f07934 (diff)
downloadscala-d0c65dcd15b24d0ec17dc99eeff7c0d3cb59d45a.tar.gz
scala-d0c65dcd15b24d0ec17dc99eeff7c0d3cb59d45a.tar.bz2
scala-d0c65dcd15b24d0ec17dc99eeff7c0d3cb59d45a.zip
Added tests for lazy values of type Unit.
Diffstat (limited to 'test/files/run/lazy-traits.scala')
-rw-r--r--test/files/run/lazy-traits.scala18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/files/run/lazy-traits.scala b/test/files/run/lazy-traits.scala
index bcfb2c45b8..5a8d3f3db7 100644
--- a/test/files/run/lazy-traits.scala
+++ b/test/files/run/lazy-traits.scala
@@ -136,6 +136,23 @@ package x.y {
}
}
+/** Test successful compilation of lazy values of type Unit. */
+class UnitLazy extends A {
+ lazy val lz = Console.println("UnitLazy.lz forced")
+}
+
+trait UnitLazyT {
+ lazy val lzt = Console.println("UnitLazyT.lzt forced")
+}
+
+class MixedUnitLazy extends UnitLazy with UnitLazyT {
+ override def toString() = {
+ lz
+ lzt
+ "MixedUnitLazy"
+ }
+}
+
object Test extends Application {
def test(name: String, v: A) {
@@ -149,4 +166,5 @@ object Test extends Application {
test("Cls2", new Cls2)
test("Cls with B", new ClsB)
test("OverflownLazyFields with A", new OverflownLazyFields)
+ test("Unit lazy values", new MixedUnitLazy)
}