summary refs log tree commit diff stats
path: root/tests/method
diff options
context:
space:
mode:
authorReimer Behrends <behrends@gmail.com>2014-11-02 15:37:16 +0100
committerReimer Behrends <behrends@gmail.com>2014-11-02 15:37:16 +0100
commitbce2d57d95b71f3e4a5d4585ea735870251d1caa (patch)
tree422b9c20f7b6b695bb4cdc33942b662ed15a2ad9 /tests/method
parent1fc8bab6433982611b8dc3585e65dbd7be946a89 (diff)
downloadNim-bce2d57d95b71f3e4a5d4585ea735870251d1caa.tar.gz
Added test case for recursive methods.
Diffstat (limited to 'tests/method')
-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)
+