You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6a9e84a
Browse filesBrowse the repository at this point in the historyBrowse files
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>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,7 @@
23
23
24
24
#### :bug: Bug fix
25
25
26
+
- Keep `@warning("-4")` on `if` expressions when formatting; the formatter dropped it. PR_LINK
26
27
- Fix the formatter dropping a `@res.ternary` attribute written in source, e.g. `let b = @res.ternary x`, and print `@JSX` and `@res.ternary` with the same parens as other attributes, e.g. `(@JSX x) + 1`. https://github.com/rescript-lang/rescript/pull/8740
27
28
- Respect `@warning` attributes on the module in `module type of`, e.g. `module type of @warning("-3") DeprecatedModule`, which still reported the warning. https://github.com/rescript-lang/rescript/pull/8738
28
29
- Fix the formatter dropping or moving attributes and `await` on module expressions, such as `module M = @attr F(X)`, and printing invalid code for module constraints and functors in some positions, such as `module M: T = (X: S)`. https://github.com/rescript-lang/rescript/pull/8735
@@ -46,6 +47,7 @@
46
47
47
48
#### :house: Internal
48
49
50
+
- Remove the unused `res.iflet` encoding of `if let`, which the parser always rejects with a syntax error suggesting a `switch`. The error is unchanged. PR_LINK
49
51
- Remove the obsolete `res.ternary` and `JSX` attributes from the formatter's internal attribute filters and merge the filters into one. https://github.com/rescript-lang/rescript/pull/8740
50
52
- Represent `await` on module expressions with a dedicated `Pmod_await` parsetree node instead of a `res.await` attribute, which remains only in the PPX wire representation. https://github.com/rescript-lang/rescript/pull/8738
51
53
- Remove dead compiler code: warning 24, the `J.String_index` JS IR node, the `Pisint` and `Parraysets` Lambda primitives with their unused `%` primitive names (`%obj_is_int`, `%obj_dup`, `%obj_field`, `%array_safe_set`, `%null_to_opt`, `%nullable_to_opt`), the no-op `-pp` bsc flag and unread `Clflags` fields (`-unsafe` stays accepted as an explicit no-op), and the unused `unit` slot of `Pexp_coerce`. https://github.com/rescript-lang/rescript/pull/8731
0 commit comments