Skip to content

Commit 1a88206

Browse files
Dale-Blackclaude
andcommitted
Also suppress NamedTuple constructor calls (kwcall dead code)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 54431fa commit 1a88206

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/compiler/codegen.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,12 +1008,16 @@ function compile_call(ctx::JSCompilationContext, expr::Expr)
10081008
return ""
10091009
end
10101010

1011-
# NamedTuple constructor: (%apply_type_result)(%tuple) — skip if result is NamedTuple
1011+
# NamedTuple constructor: (%apply_type_result)(%tuple) — skip, consumed by kwcall
10121012
if callee isa Core.SSAValue
1013-
ct = ctx.code_info.ssavaluetypes[callee.id]
1013+
ct = try ctx.code_info.ssavaluetypes[callee.id] catch; nothing end
10141014
if ct isa Core.Const && ct.val isa Type && ct.val <: NamedTuple
10151015
return ""
10161016
end
1017+
# Also catch the case where callee type is the NamedTuple type itself
1018+
if ct isa DataType && ct <: NamedTuple
1019+
return ""
1020+
end
10171021
end
10181022

10191023
# Core.tuple used for kwargs assembly — skip if result feeds into NamedTuple

0 commit comments

Comments
 (0)