aboutsummaryrefslogtreecommitdiff
path: root/tests/pos/tailcall/tailcall.scala
diff options
context:
space:
mode:
Diffstat (limited to 'tests/pos/tailcall/tailcall.scala')
-rw-r--r--tests/pos/tailcall/tailcall.scala5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/pos/tailcall/tailcall.scala b/tests/pos/tailcall/tailcall.scala
new file mode 100644
index 000000000..9cf373cf0
--- /dev/null
+++ b/tests/pos/tailcall/tailcall.scala
@@ -0,0 +1,5 @@
+class tailcall {
+ val shift = 1
+ final def fact(x: Int, acc: Int = 1): Int = if (x == 0) acc else fact(x - shift, acc * x)
+ def id[T <: AnyRef](x: T): T = if (x eq null) x else id(x)
+}