summaryrefslogtreecommitdiff
path: root/test/files/neg
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/neg')
-rw-r--r--test/files/neg/t1672b.check5
-rw-r--r--test/files/neg/t1672b.scala11
2 files changed, 15 insertions, 1 deletions
diff --git a/test/files/neg/t1672b.check b/test/files/neg/t1672b.check
index 288e47c315..60ccf77174 100644
--- a/test/files/neg/t1672b.check
+++ b/test/files/neg/t1672b.check
@@ -10,4 +10,7 @@ t1672b.scala:29: error: could not optimize @tailrec annotated method boz: it con
t1672b.scala:34: error: could not optimize @tailrec annotated method bez: it contains a recursive call not in tail position
def bez : Nothing = {
^
-four errors found
+t1672b.scala:46: error: could not optimize @tailrec annotated method bar: it contains a recursive call not in tail position
+ else 1 + (try {
+ ^
+5 errors found
diff --git a/test/files/neg/t1672b.scala b/test/files/neg/t1672b.scala
index 7d02ddc710..0ccdd03633 100644
--- a/test/files/neg/t1672b.scala
+++ b/test/files/neg/t1672b.scala
@@ -38,4 +38,15 @@ object Test {
???
}
}
+
+ // the `liftedTree` local method will prevent a tail call here.
+ @annotation.tailrec
+ def bar(i : Int) : Int = {
+ if (i == 0) 0
+ else 1 + (try {
+ throw new RuntimeException
+ } catch {
+ case _: Throwable => bar(i - 1)
+ })
+ }
}