diff options
author | Iulian Dragos <jaguarul@gmail.com> | 2007-11-19 13:39:59 +0000 |
---|---|---|
committer | Iulian Dragos <jaguarul@gmail.com> | 2007-11-19 13:39:59 +0000 |
commit | d0c65dcd15b24d0ec17dc99eeff7c0d3cb59d45a (patch) | |
tree | 574fe29fa2bd6f4e654688372fa0d8b1889be86e /test | |
parent | 82c5f83abc60d080a4809e9c7891e2f0c9f07934 (diff) | |
download | scala-d0c65dcd15b24d0ec17dc99eeff7c0d3cb59d45a.tar.gz scala-d0c65dcd15b24d0ec17dc99eeff7c0d3cb59d45a.tar.bz2 scala-d0c65dcd15b24d0ec17dc99eeff7c0d3cb59d45a.zip |
Added tests for lazy values of type Unit.
Diffstat (limited to 'test')
-rw-r--r-- | test/files/run/lazy-traits.check | 6 | ||||
-rw-r--r-- | test/files/run/lazy-traits.scala | 18 |
2 files changed, 24 insertions, 0 deletions
diff --git a/test/files/run/lazy-traits.check b/test/files/run/lazy-traits.check index dcc8228ac1..2f0bc1869c 100644 --- a/test/files/run/lazy-traits.check +++ b/test/files/run/lazy-traits.check @@ -152,3 +152,9 @@ zc29 = lazy zc29 zc30 = lazy zc30 zc31 = lazy zc31 z1 = lazy z1 +Unit lazy values test: +UnitLazy.lz forced +UnitLazyT.lzt forced +MixedUnitLazy +MixedUnitLazy +MixedUnitLazy 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) } |