Repository navigation
Remove obsolete attributes from the formatter's filters and merge them - #8740
Conversation
Signed-off-by: Christoph Knittel <christoph@knittel.cc> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #8740 +/- ##
=======================================
Coverage 79.97% 79.97%
=======================================
Files 464 464
Lines 63236 63232 -4
=======================================
- Hits 50573 50571 -2
+ Misses 12663 12661 -2
🚀 New features to boost your workflow:
|
Signed-off-by: Christoph Knittel <christoph@knittel.cc> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
581fc5b to
a07fd90
Compare
rescript
@rescript/belt
@rescript/darwin-arm64
@rescript/darwin-x64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
Signed-off-by: Christoph Knittel <christoph@knittel.cc> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dbe3e47 to
c27a87f
Compare
Signed-off-by: Christoph Knittel <christoph@knittel.cc> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
26396f3 to
7ee1f60
Compare
Signed-off-by: Christoph Knittel <christoph@knittel.cc> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Christoph Knittel <christoph@knittel.cc> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7ee1f60 to
76f4916
Compare
Signed-off-by: Christoph Knittel <christoph@knittel.cc> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
76f4916 to
98af7f8
Compare
Signed-off-by: Christoph Knittel <christoph@knittel.cc> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
e934c71 to
42197a5
Compare
Signed-off-by: Christoph Knittel <christoph@knittel.cc> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 42197a5a4d
ℹ️ 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".
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
c3f4386 to
09be9c3
Compare
Signed-off-by: Christoph Knittel <christoph@knittel.cc> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`res.ternary` and `JSX` are now only part of the v0 PPX wire format: the parser produces `Pexp_ternary` and `Pexp_jsx_element`, and the v0 bridge converts both markers back into those nodes. Drop them from `is_parsing_attr`, `has_attributes` and `is_printable_attribute`. `is_printable_attribute` then only differed from `is_parsing_attr` in `res.patVariantSpread` and `res.dictPattern`, which the parser only puts on patterns, while the printable helpers are only used on expressions and module expressions. Define the printable helpers in terms of `is_parsing_attr`, so the printer has one list of internal attributes instead of two that disagreed (the cause of the `@JSX` review finding in #8735). `filter_printable_attributes` was the same as `filter_parsing_attrs` and is removed. A `@JSX` attribute written in source now gets the same parens as any other attribute, e.g. `(@jsx x) + 1`. Formatting of the repo's sources is unchanged. Signed-off-by: Christoph Knittel <christoph@knittel.cc> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Christoph Knittel <christoph@knittel.cc> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Printer cases for both marker names, and an ordinary attribute, on operands of binary operators, pipes, unary operators, field and array access, calls, ternaries and containers. Before the previous commit, @jsx lost its parens, e.g. @jsx x + 1, and @res.ternary was dropped. Signed-off-by: Christoph Knittel <christoph@knittel.cc> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
09be9c3 to
1f3b6d6
Compare
|
Developer playground preview: https://rescript-lang.github.io/rescript/dev-playground/?version=pr-8740 |
Stacked on #8738.
The formatter keeps lists of internal attributes it doesn't print. Two of the entries were obsolete, and two of the lists disagreed:
res.ternaryandJSXare only v0 wire markers now. The parser producesPexp_ternaryandPexp_jsx_element, and the v0 bridge turns both markers back into those nodes. They're removed fromis_parsing_attr,has_attributesandis_printable_attribute, likeres.awaitin Represent await on module expressions with a Pmod_await node #8738.is_printable_attributeandis_parsing_attrdisagreed. That mismatch caused the@JSXreview finding in Fix module expressions losing attributes, await or parens when formatting #8735: an attribute that was printed but not counted for parens. After removing the obsolete entries they differed only inres.patVariantSpreadandres.dictPattern, which the parser only puts on patterns. The printable helpers are only used on expressions and module expressions, so they're now defined in terms ofis_parsing_attr, leaving one list.filter_printable_attributeswas the same asfilter_parsing_attrsand is removed.has_attributesstays separate because of itsres.iflet/@warning("-4")rule; it only losesres.ternary.Behavior
.res/.resifiles and the module-expression round-trip cases from Fix module expressions losing attributes, await or parens when formatting #8735 gives byte-identical output to Represent await on module expressions with a Pmod_await node #8738.@JSXattribute written in source now gets the same parens as any other attribute:(@JSX x) + 1and(@JSX x)->gwere printed as@JSX x + 1and@JSX x->g. Both parse the same way, so only the style changes.@res.ternaryattribute written in source is no longer dropped:let b = @res.ternary xwas formatted aslet b = x. It's printed with the same parens as other attributes.Tests
printer/expr/markerAttributes.res:@JSXand@res.ternarywritten in source, with@foofor comparison, on operands of binary operators, pipes, unary operators, field and array access, calls, ternaries, arrays and records.🤖 Generated with Claude Code