mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 14:00:35 +00:00
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
This commit is contained in:
18
tests/types/t7905.nim
Normal file
18
tests/types/t7905.nim
Normal file
@@ -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)
|
||||
Reference in New Issue
Block a user