Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
- Fix bug where a ref assignment is moved ouside a conditional. https://github.com/rescript-lang/rescript/pull/7176
- Fix nullable to opt conversion. https://github.com/rescript-lang/rescript/pull/7193
- Raise error when defining external React components with `@react.componentWithProps`. https://github.com/rescript-lang/rescript/pull/7217
- Fix formatter handling of wildcard in pattern matching records with no fields specified. https://github.com/rescript-lang/rescript/pull/7224

#### :house: Internal

Expand Down
2 changes: 2 additions & 0 deletions compiler/syntax/src/res_printer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2420,6 +2420,8 @@ and print_pattern ~state (p : Parsetree.pattern) cmt_tbl =
Doc.soft_line;
Doc.rbrace;
]
| Ppat_record ([], Open) ->
Doc.concat [Doc.lbrace; Doc.text "_"; Doc.rbrace]
| Ppat_record (rows, open_flag) ->
Doc.group
(Doc.concat
Expand Down
11 changes: 11 additions & 0 deletions tests/syntax_tests/data/printer/pattern/expected/record.res.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,14 @@ let get_age3 = ({age: module(P: S), name: _}) => age2
let get_age3 = ({age: exception Exit, name: _}) => age2

let get_age3 = ({age: %raw("__GC"), name: _}) => age2

let get_age3 = ({age, _}) => age
let get_age3 = ({_}) => ""
let get_age3 = () =>
switch x {
| {age, _} => age
}
let get_age3 = () =>
switch x {
| {_} => ""
}
11 changes: 11 additions & 0 deletions tests/syntax_tests/data/printer/pattern/record.res
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,14 @@ let get_age3 = ({age: module(P: S), name: _}) => age2
let get_age3 = ({age: exception Exit, name: _}) => age2

let get_age3 = ({age: %raw("__GC"), name: _}) => age2

let get_age3 = ({age, _}) => age
let get_age3 = ({_}) => ""
let get_age3 = () =>
switch x {
| {age, _} => age
}
let get_age3 = () =>
switch x {
| {_} => ""
}
Loading