summary refs log tree commit diff stats
path: root/tests/compile
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2012-03-15 14:15:37 +0200
committerZahary Karadjov <zahary@gmail.com>2012-03-15 14:15:37 +0200
commit6975ba401b365a286336dd3dd66112395206c53e (patch)
tree9a123537a73a8d6c0d992ddb754beead0c47f98a /tests/compile
parentd1d5fc8254eb376de64106314686f2e8e7db459c (diff)
downloadNim-6975ba401b365a286336dd3dd66112395206c53e.tar.gz
fix for template redefinition. test cases added.
Diffstat (limited to 'tests/compile')
-rw-r--r--tests/compile/tredef.nim29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/compile/tredef.nim b/tests/compile/tredef.nim
new file mode 100644
index 000000000..02d1f7776
--- /dev/null
+++ b/tests/compile/tredef.nim
@@ -0,0 +1,29 @@
+template foo(a: int, b: string) = nil
+foo(1, "test")
+
+proc bar(a: int, b: string) = nil
+bar(1, "test")
+
+template foo(a: int, b: string) = bar(a, b)
+foo(1, "test")
+
+block:
+  proc bar(a: int, b: string) = nil
+  template foo(a: int, b: string) = nil
+  foo(1, "test")
+  bar(1, "test")
+  
+proc baz =
+  proc foo(a: int, b: string) = nil
+  proc foo(b: string) =
+    template bar(a: int, b: string) = nil
+    bar(1, "test")
+    
+  foo("test")
+
+  block:
+    proc foo(b: string) = nil
+    foo("test")
+    foo(1, "test")
+
+baz()