diff options
author | Hubert Plociniczak <hubert.plociniczak@epfl.ch> | 2011-02-24 10:41:37 +0000 |
---|---|---|
committer | Hubert Plociniczak <hubert.plociniczak@epfl.ch> | 2011-02-24 10:41:37 +0000 |
commit | b0b63f1901668d0d2acd7de00dd26157f28751f3 (patch) | |
tree | a1ec44683918a7ea68f4db9c6a1c9ff1a323386b /test/files/run/t4047.scala | |
parent | dd45d81acf8b4e8961406b5b940e1dd70153c2a4 (diff) | |
download | scala-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.scala | 34 |
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 +} |