Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions compiler/vmdeps.nim
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@ proc mapTypeToAstX(cache: IdentCache; t: PType; info: TLineInfo;
if inst:
if allowRecursion:
result = mapTypeToAstR(t.skipModifier, info)
# keep original type info for getType calls on the output node:
result.typ() = t
else:
result = newNodeX(nkBracketExpr)
#result.add mapTypeToAst(t.last, info)
Expand All @@ -145,8 +143,6 @@ proc mapTypeToAstX(cache: IdentCache; t: PType; info: TLineInfo;
result.add mapTypeToAst(a, info)
else:
result = mapTypeToAstX(cache, t.skipModifier, info, idgen, inst, allowRecursion)
# keep original type info for getType calls on the output node:
result.typ() = t
of tyGenericBody:
if inst:
result = mapTypeToAstR(t.typeBodyImpl, info)
Expand All @@ -161,7 +157,8 @@ proc mapTypeToAstX(cache: IdentCache; t: PType; info: TLineInfo;
result = newNodeX(nkDistinctTy)
result.add mapTypeToAst(t.skipModifier, info)
else:
if allowRecursion or t.sym == nil:
if allowRecursion or t.sym == nil or
(tfFromGeneric in t.flags and t.sym.typ.kind == tyGenericBody):
result = mapTypeToBracket("distinct", mDistinct, t, info)
else:
result = atomicType(t.sym)
Expand All @@ -185,7 +182,8 @@ proc mapTypeToAstX(cache: IdentCache; t: PType; info: TLineInfo;
else:
result.add newNodeI(nkEmpty, info)
else:
if allowRecursion or t.sym == nil:
if allowRecursion or t.sym == nil or
(tfFromGeneric in t.flags and t.sym.typ.kind == tyGenericBody):
result = newNodeIT(nkObjectTy, if t.n.isNil: info else: t.n.info, t)
result.add newNodeI(nkEmpty, info)
if t.baseClass == nil:
Expand Down
Loading