aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/pos/tailcall/i1089.scala26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/pos/tailcall/i1089.scala b/tests/pos/tailcall/i1089.scala
new file mode 100644
index 000000000..8eb69cb9b
--- /dev/null
+++ b/tests/pos/tailcall/i1089.scala
@@ -0,0 +1,26 @@
+package hello
+
+import scala.annotation.tailrec
+
+class Enclosing {
+ class SomeData(val x: Int)
+
+ def localDef(): Unit = {
+ def foo(data: SomeData): Int = data.x
+
+ @tailrec
+ def test(i: Int, data: SomeData): Unit = {
+ if (i != 0) {
+ println(foo(data))
+ test(i - 1, data)
+ }
+ }
+
+ test(3, new SomeData(42))
+ }
+}
+
+object world extends App {
+ println("hello dotty!")
+ new Enclosing().localDef()
+}