test typedesc field access

This commit is contained in:
ringabout
2026-05-13 22:02:43 +08:00
parent 6204e48ba5
commit 3330aa8a3c

View File

@@ -1500,7 +1500,8 @@ proc tryReadingTypeField(c: PContext, n: PNode, i: PIdent, ty: PType): PNode =
markUsed(c, n.info, f)
onUse(n.info, f)
of tyObject, tyTuple:
if ty.n != nil and ty.n.kind == nkRecList:
if c.inTypeofContext > 0 and
ty.n != nil and ty.n.kind == nkRecList:
let field = lookupInRecord(ty.n, i)
if field != nil:
n.typ = makeTypeDesc(c, field.typ)