fixes #25407; SIGSEGV when compiling when with typedesc

This commit is contained in:
ringabout
2026-02-25 20:45:09 +08:00
parent c292981fd3
commit 2a8e4dd977

View File

@@ -491,7 +491,11 @@ proc semAfterMacroCall(c: PContext, call, macroResult: PNode,
renderTree(result, {renderNoComments}))
result = newSymNode(errorSym(c, result))
else:
result.typ = makeTypeDesc(c, typ)
# Replace with a clean nkType node so that complex expressions
# (like `when` statements from template expansion) don't persist
# in the AST with potentially uninitialized children that would
# cause a SIGSEGV during the transform phase's constant folding.
result = newNodeIT(nkType, result.info, makeTypeDesc(c, typ))
#result = symNodeFromType(c, typ, n.info)
else:
if s.ast[genericParamsPos] != nil and retType.isMetaType: