summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2018-06-21 22:21:24 +0200
committerLemonBoy <thatlemon@gmail.com>2018-06-22 13:09:33 +0200
commitaf66258dca695d932e76ea31bdee2b2f185139cb (patch)
treedcefe96abe0cde0c24913474be47fb6ad7170d60 /tests
parent0da87939d136f90eeb0ec613ff484b8f2992e7b0 (diff)
downloadNim-af66258dca695d932e76ea31bdee2b2f185139cb.tar.gz
Discriminate gensym'd type names in sigHash
The root cause of #7905 lies in the codegen phase. The two template
instantiations generate two different MyType types with different
members but same t.sym.name leading the caching mechanism to confuse
the two.

Fixes #7905
Diffstat (limited to 'tests')
-rw-r--r--tests/types/t7905.nim18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/types/t7905.nim b/tests/types/t7905.nim
new file mode 100644
index 000000000..ddb371039
--- /dev/null
+++ b/tests/types/t7905.nim
@@ -0,0 +1,18 @@
+discard """
+  output: '''
+(member: "hello world")
+(member: 123.456)
+'''
+"""
+
+template foobar(arg: typed): untyped =
+  type
+    MyType = object
+      member: type(arg)
+
+  var myVar: MyType
+  myVar.member = arg
+  echo myVar
+
+foobar("hello world")
+foobar(123.456'f64)