diff options
author | LemonBoy <LemonBoy@users.noreply.github.com> | 2019-02-08 09:56:32 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-02-08 09:56:32 +0100 |
commit | 631a8ab57f6935d34d290089b7cc36d23dc03504 (patch) | |
tree | 670c548fab551624518c0d1aab43699ed52f4716 /tests/ccgbugs | |
parent | 4572568045452cad29eddf1ee80eb26199db2b41 (diff) | |
download | Nim-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.nim | 15 |
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) |