diff options
-rw-r--r-- | compiler/vmdeps.nim | 9 | ||||
-rw-r--r-- | tests/macros/tgettypeinst.nim | 4 |
2 files changed, 11 insertions, 2 deletions
diff --git a/compiler/vmdeps.nim b/compiler/vmdeps.nim index ebd2f557f..779d6d2a4 100644 --- a/compiler/vmdeps.nim +++ b/compiler/vmdeps.nim @@ -218,8 +218,13 @@ proc mapTypeToAstX(t: PType; info: TLineInfo; of tyTuple: if inst: result = newNodeX(nkTupleTy) - for s in t.n.sons: - result.add newIdentDefs(s) + # only named tuples have a node, unnamed tuples don't + if t.n.isNil: + for subType in t.sons: + result.add mapTypeToAst(subType, info) + else: + for s in t.n.sons: + result.add newIdentDefs(s) else: result = mapTypeToBracket("tuple", mTuple, t, info) of tySet: result = mapTypeToBracket("set", mSet, t, info) diff --git a/tests/macros/tgettypeinst.nim b/tests/macros/tgettypeinst.nim index 22e03a119..255eff949 100644 --- a/tests/macros/tgettypeinst.nim +++ b/tests/macros/tgettypeinst.nim @@ -120,3 +120,7 @@ test(Tree): right: ref Tree test(proc (a: int, b: Foo[2,float])) test(proc (a: int, b: Foo[2,float]): Bar[3,int]) + +# bug #4862 +static: + discard typedesc[(int, int)].getTypeImpl |