summaryrefslogtreecommitdiff
path: root/test/files/run/t4047.scala
diff options
context:
space:
mode:
authorHubert Plociniczak <hubert.plociniczak@epfl.ch>2011-02-24 10:41:37 +0000
committerHubert Plociniczak <hubert.plociniczak@epfl.ch>2011-02-24 10:41:37 +0000
commitb0b63f1901668d0d2acd7de00dd26157f28751f3 (patch)
treea1ec44683918a7ea68f4db9c6a1c9ff1a323386b /test/files/run/t4047.scala
parentdd45d81acf8b4e8961406b5b940e1dd70153c2a4 (diff)
downloadscala-b0b63f1901668d0d2acd7de00dd26157f28751f3.tar.gz
scala-b0b63f1901668d0d2acd7de00dd26157f28751f3.tar.bz2
scala-b0b63f1901668d0d2acd7de00dd26157f28751f3.zip
lazy val calls shouldn't be included in pure ex...
lazy val calls shouldn't be included in pure expressions in general. closes 4047. fixed also bug in optimizer (was eliminating a.foo call in the test). review by dragos
Diffstat (limited to 'test/files/run/t4047.scala')
-rw-r--r--test/files/run/t4047.scala34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/files/run/t4047.scala b/test/files/run/t4047.scala
new file mode 100644
index 0000000000..cd42a8b4df
--- /dev/null
+++ b/test/files/run/t4047.scala
@@ -0,0 +1,34 @@
+trait Foo[T] { val foo: T}
+
+class A extends Foo[Unit]{
+ lazy val foo = println("Unit: called A.foo")
+}
+
+class B extends Foo[Unit]{
+ val foo = println("Unit: called B.foo")
+}
+
+trait Bar[T] { def foo: T}
+
+class C extends Bar[Unit]{
+ lazy val foo = println("Unit: called C.foo")
+}
+
+class D extends Bar[Unit]{
+ def foo = println("Unit: called D.foo")
+}
+
+object Test extends Application {
+ val a: Foo[Unit] = new A
+ a.foo
+ a.foo
+ val b: Foo[Unit] = new B
+ b.foo
+ b.foo
+ val c: Bar[Unit] = new C
+ c.foo
+ c.foo
+ val d: Bar[Unit] = new D
+ d.foo
+ d.foo
+}