Skip to content

Make the partial match suggestion easier to copy-paste #6656

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

Merged
merged 2 commits into from
Mar 5, 2024
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
- Fix making the static import for the dynamic import of external ffi https://github.com/rescript-lang/rescript-compiler/pull/6664

#### :nail-care: Polish

- Omit `undefined` in external function calls for trailing optional arguments when not supplied. https://github.com/rescript-lang/rescript-compiler/pull/6653
- Make pattern match suggestions to be easier to copy-paste. https://github.com/rescript-lang/rescript-compiler/pull/6656

# 11.1.0-rc.3

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
14 │

You forgot to handle a possible case here, for example:
#second(_) | #fourth | #third
| #second(_) | #fourth | #third
22 changes: 11 additions & 11 deletions jscomp/build_tests/super_errors/expected/warnings5.res.expected
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Either bind these labels explicitly or add ', _' to the pattern.
15 │ switch y {

You forgot to handle a possible case here, for example:
{otherValue: true, _}
| {otherValue: true, _}


Warning number 9
Expand Down Expand Up @@ -52,7 +52,7 @@ Either bind these labels explicitly or add ', _' to the pattern.
19 │ let arr = [1]

You forgot to handle a possible case here, for example:
{typ: WithPayload(false), _}
| {typ: WithPayload(false), _}
| {typ: Variant | One | Two | Three | Four | Five | Six | Seven(_), _}


Expand All @@ -68,7 +68,7 @@ Either bind these labels explicitly or add ', _' to the pattern.
25 │ switch arr {

You forgot to handle a possible case here, for example:
[_]
| [_]


Warning number 8
Expand All @@ -83,7 +83,7 @@ Either bind these labels explicitly or add ', _' to the pattern.
29 │ switch arr {

You forgot to handle a possible case here, for example:
[]
| []


Warning number 8
Expand All @@ -98,7 +98,7 @@ Either bind these labels explicitly or add ', _' to the pattern.
33 │ let lst = list{}

You forgot to handle a possible case here, for example:
[1, 0] | [0, _] | []
| [1, 0] | [0, _] | []


Warning number 8
Expand All @@ -113,7 +113,7 @@ Either bind these labels explicitly or add ', _' to the pattern.
39 │ switch lst {

You forgot to handle a possible case here, for example:
list{_, ..._}
| list{_, ..._}


Warning number 8
Expand All @@ -128,7 +128,7 @@ Either bind these labels explicitly or add ', _' to the pattern.
43 │ switch lst {

You forgot to handle a possible case here, for example:
list{1, 2, _, ..._} | list{1, 0, ..._} | list{1} | list{0, ..._} | list{}
| list{1, 2, _, ..._} | list{1, 0, ..._} | list{1} | list{0, ..._} | list{}


Warning number 8
Expand All @@ -143,7 +143,7 @@ Either bind these labels explicitly or add ', _' to the pattern.
47 │ switch "abc" {

You forgot to handle a possible case here, for example:
list{1, _, ..._} | list{0, ..._} | list{}
| list{1, _, ..._} | list{0, ..._} | list{}


Warning number 8
Expand All @@ -158,7 +158,7 @@ Either bind these labels explicitly or add ', _' to the pattern.
51 │ switch 0 {

You forgot to handle a possible case here, for example:
"*"
| "*"


Warning number 8
Expand All @@ -173,7 +173,7 @@ Either bind these labels explicitly or add ', _' to the pattern.
55 │ let tuple = (1, true)

You forgot to handle a possible case here, for example:
0
| 0


Warning number 8
Expand All @@ -187,4 +187,4 @@ Either bind these labels explicitly or add ', _' to the pattern.
60 │

You forgot to handle a possible case here, for example:
(_, true)
| (_, true)
1 change: 1 addition & 0 deletions jscomp/ml/parmatch.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2099,6 +2099,7 @@ let do_check_partial ?pred exhaust loc casel pss = match pss with
let errmsg =
try
let buf = Buffer.create 16 in
Buffer.add_string buf "| ";
Buffer.add_string buf (!print_res_pat v);
begin match check_partial_all v casel with
| None -> ()
Expand Down