Repository navigation
Remove the unused res.iflet encoding of if let - #8741
Conversation
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>
2176c16 to
d4c16cb
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #8741 +/- ##
==========================================
+ Coverage 79.97% 80.00% +0.02%
==========================================
Files 464 464
Lines 63232 63149 -83
==========================================
- Hits 50571 50523 -48
+ Misses 12661 12626 -35
🚀 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: |
Signed-off-by: Christoph Knittel <christoph@knittel.cc> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
d4c16cb to
c1e74d3
Compare
Signed-off-by: Christoph Knittel <christoph@knittel.cc> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
c1e74d3 to
61064dd
Compare
61064dd to
77fe3be
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>
77fe3be to
2052ecc
Compare
Signed-off-by: Christoph Knittel <christoph@knittel.cc> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2052ecc to
c443016
Compare
Signed-off-by: Christoph Knittel <christoph@knittel.cc> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
c443016 to
c316d52
Compare
Signed-off-by: Christoph Knittel <christoph@knittel.cc> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
c316d52 to
7a64333
Compare
|
@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. |
|
Codex Review: Didn't find any major issues. 🚀 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". |
Signed-off-by: Christoph Knittel <christoph@knittel.cc> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7a64333 to
e998570
Compare
Signed-off-by: Christoph Knittel <christoph@knittel.cc> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
e998570 to
400196a
Compare
Signed-off-by: Christoph Knittel <christoph@knittel.cc> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
400196a to
2d8f340
Compare
The parser always rejects `if let` with a syntax error that suggests the
equivalent `switch`, and the formatter refuses files with syntax errors.
Still, the parser encoded `if let` as a `switch` marked with `res.iflet`
and `@warning("-4")`, and the viewer, printer and comment table carried
code to print it back. Its printer tests had been commented out.
Parse `if let` into a plain `switch` for recovery, keep the error, and
remove the encoding: `has_if_let_attribute`, `is_if_let_expr`, the
`IfLet` condition kind, `filter_fragile_match_attributes`, the
comment-table case, and `res.iflet` in `is_parsing_attr`. Without the
`res.iflet` exception, `has_attributes` meant "has any attribute" and is
inlined. The commented-out `if let` printer tests are removed.
`filter_fragile_match_attributes` also dropped a `@warning("-4")` written
on an ordinary `if` when formatting; it's now kept.
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>
2d8f340 to
121f150
Compare
|
Developer playground preview: https://rescript-lang.github.io/rescript/dev-playground/?version=pr-8741 |
Stacked on #8740. Resolves the
res.ifletitem of #8624 by removing the encoding rather than giving it a node.if lethas been in the syntax since at least 2020 (asns.iflet, renamed in #5862), but the parser always rejects it with a syntax error: "If-let is currently highly experimental. Use a regularswitchwith pattern matching instead", followed by the equivalentswitch. There's no flag that enables it, and the formatter refuses files with syntax errors. Still, the parser encodedif letas aswitchmarked withres.ifletand@warning("-4"), and the viewer, printer and comment table carried code to print it back. The printer tests for it had already been commented out.Changes
if letis still parsed for recovery and still reported with the same error and suggestion, but as a plainswitchwithout the two attributes.has_if_let_attribute,is_if_let_expr, theIfLetcase of the if-chain condition (theif_condition_kindtype goes away),filter_fragile_match_attributes, andres.ifletinis_parsing_attr;res.ifletexception,has_attributesmeant "has any attribute", so it's inlined at its callers.if letcases.if letprinter tests are removed; the error testparsing/errors/expressions/ifLet.reskeeps covering the message.Behavior
if leterror message is unchanged; the error test's snapshot only shows the recovered tree without the attributes.filter_fragile_match_attributesalso applied to ordinaryifexpressions, so the formatter dropped a@warning("-4")written on anif. It's now kept..res/.resifiles is unchanged.Tests
printer/expr/if.res:@warning("-4")on anifexpression.🤖 Generated with Claude Code