Skip to content

Commit 85d5826

Browse files
committed
more formatting and cases for array pattern matching
1 parent 82a2314 commit 85d5826

File tree

6 files changed

+24
-5
lines changed

6 files changed

+24
-5
lines changed

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,21 @@ Either bind these labels explicitly or add ', _' to the pattern.
8080
26 │ | [one] => Js.log(one)
8181
27 │ }
8282
28 │
83+
29 │ switch arr {
8384

8485
You forgot to handle a possible case here, for example:
85-
[]
86+
[]
87+
88+
89+
Warning number 8
90+
/.../fixtures/warnings5.res:29:1-31:1
91+
92+
27 │ }
93+
28 │
94+
29 │ switch arr {
95+
30 │ | [1, 2] => ()
96+
31 │ }
97+
32 │
98+
99+
You forgot to handle a possible case here, for example:
100+
[1, 0] | [0, _] | []

jscomp/build_tests/super_errors/fixtures/warnings5.res

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,7 @@ switch arr {
2525
switch arr {
2626
| [one] => Js.log(one)
2727
}
28+
29+
switch arr {
30+
| [1, 2] => ()
31+
}

jscomp/ml/parmatch.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ let rec pretty_val ppf v =
432432
pretty_lvals filtered_lvs elision_mark
433433
end
434434
| Tpat_array vs ->
435-
fprintf ppf "@[[%a]@]" (pretty_vals " ;") vs
435+
fprintf ppf "@[[%a]@]" (pretty_vals ",") vs
436436
| Tpat_lazy v ->
437437
fprintf ppf "@[<2>lazy@ %a@]" pretty_arg v
438438
| Tpat_alias (v, x,_) ->

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26838,7 +26838,7 @@ let rec pretty_val ppf v =
2683826838
pretty_lvals filtered_lvs elision_mark
2683926839
end
2684026840
| Tpat_array vs ->
26841-
fprintf ppf "@[[%a]@]" (pretty_vals " ;") vs
26841+
fprintf ppf "@[[%a]@]" (pretty_vals ",") vs
2684226842
| Tpat_lazy v ->
2684326843
fprintf ppf "@[<2>lazy@ %a@]" pretty_arg v
2684426844
| Tpat_alias (v, x,_) ->

lib/4.06.1/unstable/js_playground_compiler.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26838,7 +26838,7 @@ let rec pretty_val ppf v =
2683826838
pretty_lvals filtered_lvs elision_mark
2683926839
end
2684026840
| Tpat_array vs ->
26841-
fprintf ppf "@[[%a]@]" (pretty_vals " ;") vs
26841+
fprintf ppf "@[[%a]@]" (pretty_vals ",") vs
2684226842
| Tpat_lazy v ->
2684326843
fprintf ppf "@[<2>lazy@ %a@]" pretty_arg v
2684426844
| Tpat_alias (v, x,_) ->

lib/4.06.1/whole_compiler.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186779,7 +186779,7 @@ let rec pretty_val ppf v =
186779186779
pretty_lvals filtered_lvs elision_mark
186780186780
end
186781186781
| Tpat_array vs ->
186782-
fprintf ppf "@[[%a]@]" (pretty_vals " ;") vs
186782+
fprintf ppf "@[[%a]@]" (pretty_vals ",") vs
186783186783
| Tpat_lazy v ->
186784186784
fprintf ppf "@[<2>lazy@ %a@]" pretty_arg v
186785186785
| Tpat_alias (v, x,_) ->

0 commit comments

Comments
 (0)