fix(compiler): preserve optional-chain continuations and receivers - #220
metaphorics wants to merge 2 commits into
Conversation
|
Warning Review limit reachedNext included review available in 59 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: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
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 |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
This PR adds proper parenthesization handling for optional chain expressions when followed by call expressions. The change correctly extends the needs_parens logic to include CallExpression as a parent case, ensuring proper formatting precedence. The implementation is well-tested with comprehensive fixtures covering various optional chaining scenarios.
You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.
Change
Route nullish exits past an entire optional chain, including computed keys, following calls, non-null assertions, and delete operations. Preserve the receiver through parenthesized optional method calls. Replace separate member/call lowering paths with one chain-reference mechanism.
Evidence
The committed strict TypeScript fixture was compiled by TypeScript 7.0.2 and executed by Node 24.18.0. Before the fix, null chains performed four forbidden side effects and a grouped method lost its receiver. Both JIT and AOT now match the reference output.
Stack
Depends on #219; follows merged #217. Refs #157.
Known residuals
The checker can still report BAMTS-C064 for a valid optional-chain indexed access. This PR fixes execution semantics, not full checker compatibility or formal release admission.
Post-Deploy Monitoring & Validation
Owner: repository maintainers. Run the committed optional-chain regression and full CLI suite on the first CI run after integration. Healthy: exact oracle output and no existing regressions. Any output mismatch or const-enum regression blocks integration and triggers reverting this commit.