summary refs log tree commit diff stats
path: root/tests/template
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2017-02-23 19:47:09 +0100
committerAndreas Rumpf <rumpf_a@web.de>2017-02-24 00:32:14 +0100
commit22789a0bfc326ae6a292679b4e9d9eb2a295c26a (patch)
tree1fc7ab515208fb1854384b3312fc9c54d2c5db27 /tests/template
parent92c2a51bf763c16579da6b9e2ceaede5552bf5ff (diff)
downloadNim-22789a0bfc326ae6a292679b4e9d9eb2a295c26a.tar.gz
fixes #5419
Diffstat (limited to 'tests/template')
-rw-r--r--tests/template/mgensym_generic_cross_module.nim14
-rw-r--r--tests/template/tgensym_generic_cross_module.nim14
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/template/mgensym_generic_cross_module.nim b/tests/template/mgensym_generic_cross_module.nim
new file mode 100644
index 000000000..80b681db4
--- /dev/null
+++ b/tests/template/mgensym_generic_cross_module.nim
@@ -0,0 +1,14 @@
+
+template makeDomElement(x: untyped, name: string = nil) =
+  const tag {.gensym.} = if name == nil: astToStr(x) else: name
+
+  proc x*(p: int|float) =
+    echo tag, p
+
+  proc x*(p: string|cstring) =
+    echo tag, p
+
+#proc wrappedUp[T](x: T) =
+#  mixin foo, bar
+makeDomElement(foo, "foo")
+makeDomElement(bar)
diff --git a/tests/template/tgensym_generic_cross_module.nim b/tests/template/tgensym_generic_cross_module.nim
new file mode 100644
index 000000000..856ab676d
--- /dev/null
+++ b/tests/template/tgensym_generic_cross_module.nim
@@ -0,0 +1,14 @@
+discard """
+  output: '''foo55
+foo8.0
+fooaha
+bar7'''
+"""
+# bug #5419
+import mgensym_generic_cross_module
+
+foo(55)
+foo 8.0
+foo "aha"
+bar 7
+