Skip to content

Commit daf49ba

Browse files
authored
Make the partial match suggestion easier to copy-paste (#6656)
* make the partial match suggestion easier to copy * add changelog
1 parent 9a779e9 commit daf49ba

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
- Fix making the static import for the dynamic import of external ffi https://github.com/rescript-lang/rescript-compiler/pull/6664
1818

1919
#### :nail-care: Polish
20+
2021
- Omit `undefined` in external function calls for trailing optional arguments when not supplied. https://github.com/rescript-lang/rescript-compiler/pull/6653
22+
- Make pattern match suggestions to be easier to copy-paste. https://github.com/rescript-lang/rescript-compiler/pull/6656
2123

2224
# 11.1.0-rc.3
2325

jscomp/build_tests/super_errors/expected/warnings4.res.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
14 │
1111

1212
You forgot to handle a possible case here, for example:
13-
#second(_) | #fourth | #third
13+
| #second(_) | #fourth | #third

jscomp/build_tests/super_errors/expected/warnings5.res.expected

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Either bind these labels explicitly or add ', _' to the pattern.
2424
15 │ switch y {
2525

2626
You forgot to handle a possible case here, for example:
27-
{otherValue: true, _}
27+
| {otherValue: true, _}
2828

2929

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

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

5858

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

7070
You forgot to handle a possible case here, for example:
71-
[_]
71+
| [_]
7272

7373

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

8585
You forgot to handle a possible case here, for example:
86-
[]
86+
| []
8787

8888

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

100100
You forgot to handle a possible case here, for example:
101-
[1, 0] | [0, _] | []
101+
| [1, 0] | [0, _] | []
102102

103103

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

115115
You forgot to handle a possible case here, for example:
116-
list{_, ..._}
116+
| list{_, ..._}
117117

118118

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

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

133133

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

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

148148

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

160160
You forgot to handle a possible case here, for example:
161-
"*"
161+
| "*"
162162

163163

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

175175
You forgot to handle a possible case here, for example:
176-
0
176+
| 0
177177

178178

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

189189
You forgot to handle a possible case here, for example:
190-
(_, true)
190+
| (_, true)

jscomp/ml/parmatch.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2099,6 +2099,7 @@ let do_check_partial ?pred exhaust loc casel pss = match pss with
20992099
let errmsg =
21002100
try
21012101
let buf = Buffer.create 16 in
2102+
Buffer.add_string buf "| ";
21022103
Buffer.add_string buf (!print_res_pat v);
21032104
begin match check_partial_all v casel with
21042105
| None -> ()

0 commit comments

Comments
 (0)