Skip to content

Commit

Permalink
test restricting invalid cases
Browse files Browse the repository at this point in the history
  • Loading branch information
metagn committed Dec 6, 2024
1 parent 71a60de commit 686139c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions compiler/vmdeps.nim
Original file line number Diff line number Diff line change
Expand Up @@ -157,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 or tfFromGeneric in t.flags:
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 @@ -181,7 +182,8 @@ proc mapTypeToAstX(cache: IdentCache; t: PType; info: TLineInfo;
else:
result.add newNodeI(nkEmpty, info)
else:
if allowRecursion or t.sym == nil or tfFromGeneric in t.flags:
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

0 comments on commit 686139c

Please sign in to comment.