summary refs log tree commit diff stats
path: root/tests/trmacros/tnoendlessrec.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/trmacros/tnoendlessrec.nim')
-rw-r--r--tests/trmacros/tnoendlessrec.nim10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/trmacros/tnoendlessrec.nim b/tests/trmacros/tnoendlessrec.nim
new file mode 100644
index 000000000..53891bcc0
--- /dev/null
+++ b/tests/trmacros/tnoendlessrec.nim
@@ -0,0 +1,10 @@
+discard """
+  output: "4"
+"""
+
+# test that an endless recursion is avoided:
+
+template optLen{len(x)}(x: expr): expr = len(x)
+
+var s = "lala"
+echo len(s)