From d0c65dcd15b24d0ec17dc99eeff7c0d3cb59d45a Mon Sep 17 00:00:00 2001 From: Iulian Dragos Date: Mon, 19 Nov 2007 13:39:59 +0000 Subject: Added tests for lazy values of type Unit. --- test/files/run/lazy-traits.scala | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/files/run/lazy-traits.scala') 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) } -- cgit v1.2.3