From a426eb1d91d1c5fecb546b01d06450fad3388f37 Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Fri, 9 Feb 2024 17:37:58 +0800 Subject: [PATCH] fixes #23295; don't expand constants for complex structures fixes #23295 --- compiler/trees.nim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/compiler/trees.nim b/compiler/trees.nim index 99b6a9d014f04..41b54eb096769 100644 --- a/compiler/trees.nim +++ b/compiler/trees.nim @@ -226,8 +226,7 @@ proc stupidStmtListExpr*(n: PNode): bool = proc dontInlineConstant*(orig, cnst: PNode): bool {.inline.} = # symbols that expand to a complex constant (array, etc.) should not be # inlined, unless it's the empty array: - result = orig.kind != cnst.kind and - cnst.kind in {nkCurly, nkPar, nkTupleConstr, nkBracket, nkObjConstr} and + result = cnst.kind in {nkCurly, nkPar, nkTupleConstr, nkBracket, nkObjConstr} and cnst.len > ord(cnst.kind == nkObjConstr) proc isRunnableExamples*(n: PNode): bool =