From 690e2a174c7f145288e42334bc944e8b44362665 Mon Sep 17 00:00:00 2001 From: metagn Date: Fri, 6 Dec 2024 17:09:14 +0300 Subject: [PATCH] test restricting to invalid cases --- compiler/vmdeps.nim | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/compiler/vmdeps.nim b/compiler/vmdeps.nim index b49e57d38e120..0670b004005ed 100644 --- a/compiler/vmdeps.nim +++ b/compiler/vmdeps.nim @@ -161,8 +161,9 @@ proc mapTypeToAstX(cache: IdentCache; t: PType; info: TLineInfo; result = mapTypeToBracket("distinct", mDistinct, t, info) else: result = atomicType(t.sym) - # keep original type, t.sym can have type tyGenericBody: - result.typ() = t + if tfFromGeneric in t.flags and t.sym.typ.kind == tyGenericBody: + # keep original type, t.sym can have type tyGenericBody: + result.typ() = t of tyGenericParam, tyForward: result = atomicType(t.sym) of tyObject: @@ -193,8 +194,9 @@ proc mapTypeToAstX(cache: IdentCache; t: PType; info: TLineInfo; result.add copyTree(t.n) else: result = atomicType(t.sym) - # keep original type, t.sym can have type tyGenericBody: - result.typ() = t + if tfFromGeneric in t.flags and t.sym.typ.kind == tyGenericBody: + # keep original type, t.sym can have type tyGenericBody: + result.typ() = t of tyEnum: result = newNodeIT(nkEnumTy, if t.n.isNil: info else: t.n.info, t) result.add newNodeI(nkEmpty, info) # pragma node, currently always empty for enum