diff --git a/compiler/vmdeps.nim b/compiler/vmdeps.nim index 1803d4d6217fe..ba5cde8fc1535 100644 --- a/compiler/vmdeps.nim +++ b/compiler/vmdeps.nim @@ -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) @@ -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) @@ -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) @@ -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: