fix #19426 compile error using when/elif/else and typedesc in template (#20550)

(cherry picked from commit 04c48e3c5b)
This commit is contained in:
Bung
2022-10-21 15:26:46 +08:00
committed by narimiran
parent a76f36b4e5
commit 6274bc35dd
2 changed files with 17 additions and 0 deletions

View File

@@ -454,6 +454,7 @@ proc foldArrayAccess(m: PSym, n: PNode; idgen: IdGenerator; g: ModuleGraph): PNo
proc foldFieldAccess(m: PSym, n: PNode; idgen: IdGenerator; g: ModuleGraph): PNode =
# a real field access; proc calls have already been transformed
if n[1].kind != nkSym: return nil
var x = getConstExpr(m, n[0], idgen, g)
if x == nil or x.kind notin {nkObjConstr, nkPar, nkTupleConstr}: return