From 11398dd393fe3eff544bfbafafb584d3acd66e05 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Thu, 15 Apr 2010 22:18:15 +0000 Subject: Improved @tailrec error messages to specify the... Improved @tailrec error messages to specify the reason. In the process fixed old bug involving tail call transformation. Closes #3275, #2018. Review by dragos. --- test/files/neg/tailrec.check | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'test/files/neg/tailrec.check') diff --git a/test/files/neg/tailrec.check b/test/files/neg/tailrec.check index 22d70e82a0..27d99f632e 100644 --- a/test/files/neg/tailrec.check +++ b/test/files/neg/tailrec.check @@ -1,10 +1,16 @@ -tailrec.scala:6: error: could not optimize @tailrec annotated method +tailrec.scala:43: error: could not optimize @tailrec annotated method: it contains a recursive call not in tail position def facfail(n: Int): Int = ^ -tailrec.scala:42: error: could not optimize @tailrec annotated method +tailrec.scala:50: error: could not optimize @tailrec annotated method: it is neither private nor final so can be overridden @tailrec def fail1(x: Int): Int = fail1(x) ^ -tailrec.scala:45: error: could not optimize @tailrec annotated method - @tailrec def fail2[T](xs: List[T]): List[T] = xs match { - ^ -three errors found +tailrec.scala:53: error: could not optimize @tailrec annotated method: it contains a recursive call not in tail position + @tailrec final def fail2[T](xs: List[T]): List[T] = xs match { + ^ +tailrec.scala:59: error: could not optimize @tailrec annotated method: it is called recursively with different type arguments + @tailrec final def fail3[T](x: Int): Int = fail3(x - 1) + ^ +tailrec.scala:63: error: could not optimize @tailrec annotated method: it changes type of 'this' on a polymorphic recursive call + @tailrec final def fail4[U](other: Tom[U], x: Int): Int = other.fail4[U](other, x - 1) + ^ +5 errors found -- cgit v1.2.3