summaryrefslogtreecommitdiff
path: root/test/files/run/tailcalls.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-02-28 15:35:08 -0800
committerPaul Phillips <paulp@improving.org>2012-02-28 16:54:14 -0800
commitfc2866efee1bcf17aee18d427ed41e172f440f62 (patch)
tree649322d0c27af4a5d6712bd60af69b5b4a4da2b3 /test/files/run/tailcalls.scala
parent872c825192b30faa1b20f9cc2b1e3a0adeed8617 (diff)
downloadscala-fc2866efee1bcf17aee18d427ed41e172f440f62.tar.gz
scala-fc2866efee1bcf17aee18d427ed41e172f440f62.tar.bz2
scala-fc2866efee1bcf17aee18d427ed41e172f440f62.zip
Reworking synchronized patch.
Eliminated annotation and custom phase. Kept SYNCHRONIZED flag.
Diffstat (limited to 'test/files/run/tailcalls.scala')
-rw-r--r--test/files/run/tailcalls.scala13
1 files changed, 4 insertions, 9 deletions
diff --git a/test/files/run/tailcalls.scala b/test/files/run/tailcalls.scala
index 4cf6dd46d3..04a1a8ba19 100644
--- a/test/files/run/tailcalls.scala
+++ b/test/files/run/tailcalls.scala
@@ -182,8 +182,6 @@ class TailCall[S](s: S) {
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);
- final def s1(n: Int, v: Int): Int = synchronized { if (n == 0) v else s1(n - 1, v - 1) }
-
// !!! test return in non-tail-call position
// !!! test non-same-instance calls
// !!! test non-same-type calls
@@ -231,13 +229,11 @@ class NonTailCall {
Console.print(" " + n)
}
- final def f2(n: Int): Int = {
- val next = n - 1
- synchronized {
- if (n == 0) 0
- else f2(next)
- }
+ final def f2(n: Int): Int = synchronized {
+ if (n == 0) 0
+ else f2(n - 1)
}
+
}
//############################################################################
@@ -370,7 +366,6 @@ object Test {
check_success("TailCall.g2", TailCall.g2(max, max ), 0)
check_success("TailCall.g3", TailCall.g3(max, max, Nil), 0)
check_success("TailCall.h1", TailCall.h1(max, max ), 0)
- check_success("TailCall.s1", TailCall.s1(max, max ), 0)
println
val NonTailCall = new NonTailCall