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.
This commit is contained in:
parent
4572568045
commit
631a8ab57f
3 changed files with 32 additions and 13 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue