diff options
Diffstat (limited to 'test/files/run')
-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) } |