Print coercions with context-aware parentheses - #8614
Conversation
Signed-off-by: Christoph Knittel <ck@cca.io>
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. |
Signed-off-by: Christoph Knittel <ck@cca.io>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 00d09b5a27
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Christoph Knittel <ck@cca.io>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #8614 +/- ##
=======================================
Coverage 77.32% 77.33%
=======================================
Files 467 467
Lines 63313 63322 +9
=======================================
+ Hits 48957 48969 +12
+ Misses 14356 14353 -3
🚀 New features to boost your workflow:
|
rescript
@rescript/belt
@rescript/darwin-arm64
@rescript/darwin-x64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
|
Developer playground preview: https://rescript-lang.github.io/rescript/dev-playground/?version=pr-8614 |
The formatter currently turns
foo(v :> b)intofoo((v :> b)). Reuse the existing parentheses rules to omit unnecessary parentheses in calls, collections, and array indices while preserving grouping where required.Keep parentheses for binding right-hand sides, arrow bodies, operators, field access, block sequences, constrained operands, and attributes. Bindings remain parenthesized because a following JSX element can otherwise be parsed as coercion type arguments. The parser is unchanged.
Add regression coverage for constrained operands and bindings followed by JSX, and reformat existing sources affected by the new rules.
Validation:
make test,make checkformat,make test-syntax, andmake test-syntax-roundtrip, plus structure-preservation and formatting-stability checks at widths 20, 80, and 100.Fixes #6254.