fix getTypeInst for tyGenericInst (#6868)

This commit is contained in:
jcosborn 2017-12-04 10:37:25 -06:00 • committed by Andreas Rumpf
commit 35d7a99b6a
2 changed files with 32 additions and 9 deletions

View file

@ -121,22 +121,25 @@ proc mapTypeToAstX(t: PType; info: TLineInfo;
result = newNodeIT(nkBracketExpr, if t.n.isNil: info else: t.n.info, t)
for i in 0 ..< t.len:
result.add mapTypeToAst(t.sons[i], info)
of tyGenericInst, tyAlias:
of tyGenericInst:
if inst:
if allowRecursion:
result = mapTypeToAstR(t.lastSon, info)
else:
result = newNodeX(nkBracketExpr)
result.add mapTypeToAst(t.lastSon, info)
#result.add mapTypeToAst(t.lastSon, info)
result.add mapTypeToAst(t[0], info)
for i in 1 ..< t.len-1:
result.add mapTypeToAst(t.sons[i], info)
else:
result = mapTypeToAstX(t.lastSon, info, inst, allowRecursion)
of tyGenericBody:
if inst:
result = mapTypeToAstX(t.lastSon, info, inst, true)
result = mapTypeToAstR(t.lastSon, info)
else:
result = mapTypeToAst(t.lastSon, info)
of tyAlias:
result = mapTypeToAstX(t.lastSon, info, inst, allowRecursion)
of tyOrdinal:
result = mapTypeToAst(t.lastSon, info)
of tyDistinct: