Serialization: Move a returned `define_method` call into a statement #65121
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.35) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.35 · 160 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.304
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #65121"
general
weight: 0.35
JeffBezanson
Lowering before v1.12 put the creation of a generic function directly in the
returnof a nested thunk, as inreturn $(Expr(:method, :f)).deserialize_exprrewrites this:methodexpression into aCore.define_methodcall in place, so code deserialized from v1.11 containsreturn Core.define_method(Main, :f). This violates the IR invariant that areturnvalue is an argument (is_valid_return). The native interpreter still runs it, sinceeval_valueevaluates calls in value position, but other consumers of the IR do not expect it, e.g. JuliaInterpreter fails withinvalid lookup exprwhen it interprets such a thunk (aviatesk/JETLS.jl#1071).This change makes
deserialize(::Type{CodeInfo})move a call returned by aReturnNodeinto a statement of its own. The implementation replaces theReturnNodewith aGotoNodeto the call, which it appends to the code together with areturnof its value, so that no SSA value or label needs renumbering. The deserializedCodeInfohasNullDebugInfo, so no debug info needs to be extended.The test of method definitions from v1.11 now also checks that no
returnin the deserialized code returns an expression, and that the nested thunk still returns the generic function.Assisted-by: Claude Code (Opus 5.5)