From e1e372cc833e3e9d0d02c1ffa453667f50dbc784 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 16 Dec 2013 18:33:39 +0100 Subject: Better handling of cyclic reference errors. --- tests/pos/typers.scala | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/pos/typers.scala') diff --git a/tests/pos/typers.scala b/tests/pos/typers.scala index 900baef75..66c10f4b0 100644 --- a/tests/pos/typers.scala +++ b/tests/pos/typers.scala @@ -1,3 +1,5 @@ +import annotation.tailrec + object typers { class List[+T] { @@ -43,6 +45,12 @@ object typers { } class C { + + @tailrec def factorial(acc: Int, n: Int): Int = + if (n == 0) acc + else factorial(acc * n, n - 1) + + println(factorial(1, 10)) } class Refinements { -- cgit v1.2.3