Skip to content

Commit

Permalink
fix getType on object/distinct types giving bare generic sym
Browse files Browse the repository at this point in the history
  • Loading branch information
metagn committed Dec 5, 2024
1 parent eaf35fd commit 71a60de
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 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)
# result.typ can be tyGenericBody, give it a proper type:
result.typ() = t.skipModifier
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)
# result.typ can be tyGenericBody, give it a proper type:
result.typ() = t.skipModifier
of tyGenericBody:
if inst:
result = mapTypeToAstR(t.typeBodyImpl, info)
Expand All @@ -161,7 +157,7 @@ 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:
result = mapTypeToBracket("distinct", mDistinct, t, info)
else:
result = atomicType(t.sym)
Expand All @@ -185,7 +181,7 @@ 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:
result = newNodeIT(nkObjectTy, if t.n.isNil: info else: t.n.info, t)
result.add newNodeI(nkEmpty, info)
if t.baseClass == nil:
Expand Down

0 comments on commit 71a60de

Please sign in to comment.