summary refs log tree commit diff stats
path: root/tests/method/trecmeth.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/method/trecmeth.nim')
-rw-r--r--tests/method/trecmeth.nim22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/method/trecmeth.nim b/tests/method/trecmeth.nim
new file mode 100644
index 000000000..32f620f15
--- /dev/null
+++ b/tests/method/trecmeth.nim
@@ -0,0 +1,22 @@
+# Note: We only compile this to verify that code generation
+# for recursive methods works, no code is being executed
+
+type
+  Obj = ref object of TObject
+
+# Mutual recursion
+
+method alpha(x: Obj)
+method beta(x: Obj)
+
+method alpha(x: Obj) =
+  beta(x)
+
+method beta(x: Obj) =
+  alpha(x)
+
+# Simple recursion
+
+method gamma(x: Obj) =
+  gamma(x)
+