-
Notifications
You must be signed in to change notification settings - Fork 482
destructure record rest elements #8317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
b0b09b0
e8a5d9d
5ad799a
37ff1d5
a91764f
55f5e3f
c003d62
0d5634d
4627871
5026cc5
77f8d22
8c6e67f
b26edf4
802a930
e0667c9
debc408
bbf18e3
b4efe2b
9aec571
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,6 +88,7 @@ type t = | |
| | Bs_toplevel_expression_unit of | ||
| (string * top_level_unit_help) option (* 109 *) | ||
| | Bs_todo of string option (* 110 *) | ||
| | Bs_record_rest_empty (* 111 *) | ||
|
|
||
| (* If you remove a warning, leave a hole in the numbering. NEVER change | ||
| the numbers of existing warnings. | ||
|
|
@@ -154,8 +155,9 @@ let number = function | |
| | Bs_uninterpreted_delimiters _ -> 108 | ||
| | Bs_toplevel_expression_unit _ -> 109 | ||
| | Bs_todo _ -> 110 | ||
| | Bs_record_rest_empty -> 111 | ||
|
|
||
| let last_warning_number = 110 | ||
| let last_warning_number = 111 | ||
|
|
||
| let letter_all = | ||
| let rec loop i = if i = 0 then [] else i :: loop (i - 1) in | ||
|
|
@@ -532,6 +534,9 @@ let message = function | |
| `%s->ignore`" | ||
| help_text help_text | ||
| | _ -> "") | ||
| | Bs_record_rest_empty -> | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be an error rather than a warning?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I intentionally made it a warning for cases where you know the original record can have more fields than the ones listed in its record type (because it comes from JS), and you want to get the remaining ones in another record that can have a dummy record type. It's a bit of a stretch but it gives some extra flexibility. |
||
| "All fields of the rest type are already present in the explicit pattern. \ | ||
| The rest record will always be empty." | ||
| | Bs_todo maybe_text -> | ||
| (match maybe_text with | ||
| | None -> "Todo found." | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alphabetically it would make the difference visually smaller