summaryrefslogtreecommitdiff
path: root/test/files/run/lazy-traits.scala
diff options
context:
space:
mode:
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)
}