summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2019-05-14 07:44:39 +0200
committerGitHub <noreply@github.com>2019-05-14 07:44:39 +0200
commit2fba65b29f0d98d0c7cbd58ba151ec8622ffbd14 (patch)
tree18056ef5886cfb75e928e7d92a9a49d2cae8f48c /tests
parenta6d44212415ba06ec4dff225246110d735e8ac43 (diff)
downloadNim-2fba65b29f0d98d0c7cbd58ba151ec8622ffbd14.tar.gz
fixes #7937 (#11244)
Diffstat (limited to 'tests')
-rw-r--r--tests/template/tgensym_instantiationinfo.nim24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/template/tgensym_instantiationinfo.nim b/tests/template/tgensym_instantiationinfo.nim
new file mode 100644
index 000000000..305e7e1c3
--- /dev/null
+++ b/tests/template/tgensym_instantiationinfo.nim
@@ -0,0 +1,24 @@
+discard """
+  action: "compile"
+"""
+
+# bug #7937
+
+template printError(error: typed) =
+  # Error: inconsistent typing for reintroduced symbol 'instInfo': previous type was: tuple[filename: string, line: int, column: int]; new type is: tuple of (string, int, int)
+  let instInfo {.gensym.} = instantiationInfo()
+  echo "Error at ", instInfo.filename, ':', instInfo.line, ": ", error
+
+# Removing this overload fixes the error
+template someTemplate(someBool: bool, body) =
+  discard
+
+template someTemplate(body) =
+  body
+
+proc main() =
+  someTemplate:
+    printError("ERROR 1")
+    printError("ERROR 2")
+
+main()