From 69b794cd7dcfe553ab19ad78630d0b237c096050 Mon Sep 17 00:00:00 2001 From: def Date: Wed, 4 Feb 2015 19:53:50 +0100 Subject: [PATCH] Add test for #1259 --- tests/template/tscope.nim | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tests/template/tscope.nim diff --git a/tests/template/tscope.nim b/tests/template/tscope.nim new file mode 100644 index 0000000000..2d5841af39 --- /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