summary refs log tree commit diff stats
path: root/tests/template
diff options
context:
space:
mode:
authordef <dennis@felsin9.de>2015-02-04 19:53:50 +0100
committerdef <dennis@felsin9.de>2015-02-04 19:53:50 +0100
commit69b794cd7dcfe553ab19ad78630d0b237c096050 (patch)
treeaa08dc9e455cef770656d4be69964eb3828dc6de /tests/template
parentd91368c8d0602b343546e16c26c8ad297d48d188 (diff)
downloadNim-69b794cd7dcfe553ab19ad78630d0b237c096050.tar.gz
Add test for #1259
Diffstat (limited to 'tests/template')
-rw-r--r--tests/template/tscope.nim12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/template/tscope.nim b/tests/template/tscope.nim
new file mode 100644
index 000000000..2d5841af3
--- /dev/null
+++ b/tests/template/tscope.nim
@@ -0,0 +1,12 @@
+discard """
+  errormsg: "redefinition of 'x'"
+"""
+
+var x = 1
+template quantity(): stmt {.immediate.} =
+  # Causes internal error in compiler/sem.nim
+  proc unit*(x = 1.0): float = 12
+  # Throws the correct error: redefinition of 'x'
+  #proc unit*(y = 1.0): float = 12
+quantity()
+var x = 2