aboutsummaryrefslogtreecommitdiff
path: root/tests/untried/neg/t1672b.scala
diff options
context:
space:
mode:
Diffstat (limited to 'tests/untried/neg/t1672b.scala')
-rw-r--r--tests/untried/neg/t1672b.scala52
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/untried/neg/t1672b.scala b/tests/untried/neg/t1672b.scala
new file mode 100644
index 000000000..0ccdd0363
--- /dev/null
+++ b/tests/untried/neg/t1672b.scala
@@ -0,0 +1,52 @@
+object Test {
+ @annotation.tailrec
+ def bar : Nothing = {
+ try {
+ throw new RuntimeException
+ } catch {
+ case _: Throwable => bar
+ } finally {
+ bar
+ }
+ }
+
+ @annotation.tailrec
+ def baz : Nothing = {
+ try {
+ throw new RuntimeException
+ } catch {
+ case _: Throwable => baz
+ } finally {
+ ???
+ }
+ }
+
+ @annotation.tailrec
+ def boz : Nothing = {
+ try {
+ throw new RuntimeException
+ } catch {
+ case _: Throwable => boz; ???
+ }
+ }
+
+ @annotation.tailrec
+ def bez : Nothing = {
+ try {
+ bez
+ } finally {
+ ???
+ }
+ }
+
+ // 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)
+ })
+ }
+}