fix(hir): preserve nested object callback methods (#9701) - #9715
fix(hir): preserve nested object callback methods (#9701)#9715proggeramlug wants to merge 1 commit into
Conversation
Nested property receivers were optimistically treated as arrays based on the method name. React.Children.map(children, callback) therefore became an ArrayLikeMethod call and interpreted children as the callback. Defer callback-taking methods on unproven nested property receivers to dynamic dispatch while retaining specialization for statically typed Array fields.
31b3292 to
ed7af75
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (6)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughNested callback-taking array methods now defer lowering for ambiguous nested property receivers. New unit and integration tests verify custom nested method dispatch and retain optimized lowering for statically typed arrays. ChangesNested array-method dispatch
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This change preserves custom nested method dispatch while retaining optimized handling for proven arrays, with targeted lowering and runtime regression coverage. No merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 5 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
Landed on |
Summary
not proven to be an Array
React
Children.map(children, callback)shapeRoot cause
The failing
Lw5frame callsqC.default.Children.map(children, callback).The arbitrary-expression Array lowering selected
ArrayLikeMethodfrom themethod name and two-argument shape alone. It therefore interpreted
childrenas the Array callback and threw
object is not a functionbefore React's ownmethod was entered.
Unknown nested property receivers now fall through to shape-aware dynamic
dispatch. Real Arrays still select the runtime Array implementation, while
plain objects retain their own methods. This is a deterministic dispatch bug,
not a Yoga or GC failure.
PR #9700's prerequisite promise fix has landed on
mainthrough merge train#9711; this branch is rebased on that result.
Validation
All compilation and runtime checks below ran on
perrymaster.skelpo.net:cargo build --release -j4 -p perry -p perry-runtime-static -p perry-stdlib-staticcargo test --release -p perry-hir --lib(382 passed, 1 ignored)cargo test --release -p perry --test issue_9701_nested_object_map -- --nocaptureTypeError: object is not a functioncustom-map-entered,3,6,8,10through theme selection and REPL entry (
VERDICT: PASS)PERRY_GC_PROTECT_FROMSPACE=1(VERDICT: PASS)cargo fmt --all -- --check./scripts/check_file_size.shpython3 scripts/check_test_registration.pygit diff --checkNo version metadata was changed.
Closes #9701.
Summary by CodeRabbit
map,filter, andreduce.Children.mapnow correctly use the object’s own implementation instead of being treated as array operations.