summary refs log tree commit diff stats
path: root/tests/ccgbugs
diff options
context:
space:
mode:
authorLemonBoy <LemonBoy@users.noreply.github.com>2019-02-08 09:56:32 +0100
committerAndreas Rumpf <rumpf_a@web.de>2019-02-08 09:56:32 +0100
commit631a8ab57f6935d34d290089b7cc36d23dc03504 (patch)
tree670c548fab551624518c0d1aab43699ed52f4716 /tests/ccgbugs
parent4572568045452cad29eddf1ee80eb26199db2b41 (diff)
downloadNim-631a8ab57f6935d34d290089b7cc36d23dc03504.tar.gz
Fix edge case in type hashing (#10601) [backport]
Empty types introduced by a template produced the same hash of the
"clean" type sharing the same name.
Diffstat (limited to 'tests/ccgbugs')
-rw-r--r--tests/ccgbugs/tsighash_typename_regression.nim15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ccgbugs/tsighash_typename_regression.nim b/tests/ccgbugs/tsighash_typename_regression.nim
index 6e49bafc3..b93eebd20 100644
--- a/tests/ccgbugs/tsighash_typename_regression.nim
+++ b/tests/ccgbugs/tsighash_typename_regression.nim
@@ -15,3 +15,18 @@ proc foo[T](t: T) =
 
 foo(123)
 foo("baz")
+
+# Empty type in template is correctly disambiguated
+block:
+  template foo() =
+    type M = object
+      discard
+    var y = M()
+
+  foo()
+
+  type M = object
+    x: int
+
+  var x = M(x: 1)
+  doAssert(x.x == 1)