aboutsummaryrefslogtreecommitdiff
path: root/tests/pos/tailcall/t6479.scala
diff options
context:
space:
mode:
Diffstat (limited to 'tests/pos/tailcall/t6479.scala')
-rw-r--r--tests/pos/tailcall/t6479.scala56
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/pos/tailcall/t6479.scala b/tests/pos/tailcall/t6479.scala
new file mode 100644
index 000000000..e4a4ff601
--- /dev/null
+++ b/tests/pos/tailcall/t6479.scala
@@ -0,0 +1,56 @@
+object TailrecAfterTryCatch {
+
+ @annotation.tailrec
+ final def good1(): Unit = {
+ 1 match {
+ case 2 => {
+ try {
+ // return
+ } catch {
+ case e: ClassNotFoundException =>
+ }
+ good1()
+ }
+ }
+ }
+
+ @annotation.tailrec
+ final def good2(): Unit = {
+ //1 match {
+ // case 2 => {
+ try {
+ return
+ } catch {
+ case e: ClassNotFoundException =>
+ }
+ good2()
+ // }
+ //}
+ }
+
+ @annotation.tailrec
+ final def good3(): Unit = {
+ val 1 = 2
+ try {
+ return
+ } catch {
+ case e: ClassNotFoundException =>
+ }
+ good3()
+ }
+
+ @annotation.tailrec
+ final def bad(): Unit = {
+ 1 match {
+ case 2 => {
+ try {
+ return
+ } catch {
+ case e: ClassNotFoundException =>
+ }
+ bad()
+ }
+ }
+ }
+
+}