fix(hir): infer array mapping results independently of input types - #11461
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughArray ChangesArray mapping inference
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The regression fixture checks mapped-object behavior against Node, and no remaining issue has been identified that would prevent merging after normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 3 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 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 |
|
Independent verification on perrymaster (Linux x86-64, Node 26.5.1,
Not run: HIR unit tests (the PR reports them), the full gap sweep, and macOS. |
Fixes #11446.
Array.mapandflatMapinherited the input element type in the early AST inference table. Mapping cron expression strings to task objects therefore lefttaskstyped asstring[], andtasks[0].match(date)took the string fast path and returnednullinstead of calling the task's method.Infer an unknown result element type at that callee-only stage and let the existing callback-aware HIR inference refine it. Element-preserving methods keep their existing types. Add lowering tests and a native parity fixture for mapped class methods, flatMap, and string/numeric results.
Validation:
nullfor both mapping methods).node-cron@4.6.0reproducer returnstruethroughmap; its four-task benchmark (2,000 warmup + 50,000 measured iterations) matches Node checksum70e63a61.No version bump.
Summary by CodeRabbit
mapandflatMapoperations so results reflect the values produced by their callbacks, including when operations are chained.