refactor(checker): decompose infer_call into ordered stage helpers - #162
Conversation
|
Warning Review limit reachedNext included review available in 57 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Team Run ID: 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the complete diff (both files, single commit), with independent verification of the refactor's fidelity: a stage-by-stage order mapping of the new main body against the old line numbers, a whitespace-stripped multiset diff of base call.rs vs the new call.rs+construct.rs, and local gates (cargo test --workspace green, cargo clippy --workspace --all-targets -- -D warnings clean).
- Stage-sequence decomposition —
infer_call(1017 lines, ~49 sequential special cases) is now a 259-line readable stage sequence; every helper preserves the exact original order, and the load-bearing ordering constraints (foreach before quoting, namespace-assign before local-assign, schema before eager arg inference, assertion before dispatch tail, literal-length after FnTable) are stated at each seam. Meets issue #151's "no function over ~300 lines" acceptance. CallResolutionplumbing —arg_types/resolved_sig/user_function/lexical_callable/locally_shadows_stubare captured once byinfer_argument_typesand threaded through the post-inference stages; the one timing trap (locally_shadows_stubmust be computed after argument inference mutates the scope, at exactly the original position) is handled correctly bynote_dynamic_loader_scope.- Extracted clusters — syntax-shape diagnostics (RY093/RY100/RY101/RY094) as emit-and-fall-through checkers;
hasArg/on.exitintoinfer_deferred_call; the NSE/quoting cluster intoinfer_nse_quoting_call; the assertion cluster intoinfer_assert_scalar_call/infer_stub_assertion_call/apply_assertion_predicates; the lexical-callable resolution intoinfer_lexical_callable_call(theelse-ifchain → early-return restructure is equivalent because theFunction-mode branch always returns). - Constructor dispatchers in construct.rs —
infer_class_constructor_call(structure/factor/new),infer_atomic_constructor_call(c/list/data.frame/t/as.data.frame),infer_literal_length_call(vector/rep/seq/seq.int);infer_structure_callrelocated byte-identically. The two two-function splits are both order-preserving, not behavior changes. - Verbatim-move evidence — the multiset diff shows all 246 removed base lines reappear as mechanical transforms only (
Some(...)wrapping forOption<RType>returns,&String→&strborrow adjustments, guard inversions to?/early-return,resolution.prefixes, comment reflows); no behavioral line is unaccounted for. All six emit-and-fall-through stages remain fall-through, and local tests confirm snapshot parity.
openai-compatible/glm-5.3 | 𝕏
e938dbb to
c29c0ed
Compare
d8315b4 to
9b00721
Compare

Cleanup sprint, PR 7 of 7 (stacked on #161). Closes #151.
infer_callwent from 1017 lines of ~49 sequential special cases to a 256-line readable stage sequence; every case is now a named helper in exact original order, with the load-bearing ordering constraints stated at each seam. Net +296 lines — this PR buys structure, not size (issue #151's acceptance is "no function over ~300 lines, behavior identical, ordering documented"; the growth is extracted signatures,Option-plumbing per early-return stage, and the original rationale comments preserved verbatim in their new homes).Shape
The main body is now literally the stage sequence. Grouped extractions per the issue:
infer_nse_quoting_call;hasArg/on.exit→infer_deferred_call. The cluster is two functions because RY094 sits betweenon.exitandlibraryin the original order — preserved, nothing moved.infer_assert_scalar_call/infer_stub_assertion_call/apply_assertion_predicates.infer_atomic_constructor_call(c/list/data.frame/t/as.data.frame, construct.rs) andinfer_literal_length_call(vector/rep/seq) — two dispatchers, because the literal-length trio deliberately runs after the FnTable stage (a user-definedrep/seqwins);infer_structure_callrelocated to construct.rs byte-identically.apply_sig) stays as the readable main path; argument inference got aCallResolutionstruct capturing exactly the snapshots base's locals held.Verification
cargo test --workspace+ clippy-D warnings+ fmt, plus md5 checks over all tracked snapshot files at each step — final state 972/972 tests (exact baseline parity), snapshots byte-identical.CallResolutionhas no stale-state reads (the one value base computed later —locally_shadows_stub— is still computed at exactly the original position, after argument inference mutates the scope).Gates
43 suites green, clippy clean, fmt clean, snapshots byte-identical.