diff options
author | Iulian Dragos <jaguarul@gmail.com> | 2007-03-28 12:49:27 +0000 |
---|---|---|
committer | Iulian Dragos <jaguarul@gmail.com> | 2007-03-28 12:49:27 +0000 |
commit | bccb84e1e45009b8e38dc3d1d8ec87ef030a907d (patch) | |
tree | 98ef5b6a8114c6b9d430335845b941e1eb5deb71 /test/files/run | |
parent | 43185f20f4c71d9dce678f5d2c8253884fd61727 (diff) | |
download | scala-bccb84e1e45009b8e38dc3d1d8ec87ef030a907d.tar.gz scala-bccb84e1e45009b8e38dc3d1d8ec87ef030a907d.tar.bz2 scala-bccb84e1e45009b8e38dc3d1d8ec87ef030a907d.zip |
Fixed tail call elimination for calls in the rh...
Fixed tail call elimination for calls in the rhs of boolean &&.
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/tailcalls.check | 1 | ||||
-rw-r--r-- | test/files/run/tailcalls.scala | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/test/files/run/tailcalls.check b/test/files/run/tailcalls.check index 49af1207a0..e1e23c4ae1 100644 --- a/test/files/run/tailcalls.check +++ b/test/files/run/tailcalls.check @@ -49,3 +49,4 @@ test NonTailCall.f1 0 1 2 was successful test NonTailCall.f2 was successful test TailCall.b1 was successful +test TailCall.b2 was successful diff --git a/test/files/run/tailcalls.scala b/test/files/run/tailcalls.scala index 87a14b3f53..8b198b53a0 100644 --- a/test/files/run/tailcalls.scala +++ b/test/files/run/tailcalls.scala @@ -182,6 +182,8 @@ class TailCall[S](s: S) { final def b1(x: Int): Boolean = (x == 1) || b1(x - 1) + final def b2(x: Int): Boolean = + (x > 0) && ((x == 1) || b1(x - 1)) def h1(n: Int, v: Int): Int = hP(n, v); private def hP(n: Int, v: Int): Int = if (n == 0) v else hP(n - 1, v - 1); @@ -345,6 +347,7 @@ object Test { check_overflow("NonTailCall.f2", NonTailCall.f2(max)) check_success_b("TailCall.b1", TailCall.b1(max), true); + check_success_b("TailCall.b2", TailCall.b2(max), true); } } |