Skip to content

Commit bb60449

Browse files
committed
Update snapshot tests
1 parent 81ed1d6 commit bb60449

File tree

3 files changed

+23
-11
lines changed

3 files changed

+23
-11
lines changed

tests/syntax_tests/data/parsing/errors/other/expected/spread.res.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@
66
2 │
77
3 │ let record = {...x, ...y}
88

9-
Array's `...` spread is not supported in pattern matches.
10-
Explanation: such spread would create a subarray; out of performance concern, our pattern matching currently guarantees to never create new intermediate data.
11-
Solution: if it's to validate the first few elements, use a `when` clause + Array size check + `get` checks on the current pattern. If it's to obtain a subarray, use `Array.sub` or `Belt.Array.slice`.
9+
Array spread (`...`) is not supported in pattern matches.
10+
11+
Explanation: Allowing `...` here would require creating a new subarray at match time, but for performance reasons pattern matching is guaranteed to never create intermediate data.
12+
13+
Possible solutions:
14+
- To validate specific elements: Use `if` with length checks and `Array.get`
15+
- To extract a subarray: Use `Array.slice`
1216

1317

1418
Syntax error!
@@ -33,7 +37,7 @@ Explanation: since records have a known, fixed shape, a spread like `{a, ...b}`
3337
5 │
3438
6 │ let list{...x, ...y} = myList
3539

36-
Record's `...` spread is not supported in pattern matches.
40+
Record spread (`...`) is not supported in pattern matches.
3741
Explanation: you can't collect a subset of a record's field into its own record, since a record needs an explicit declaration and that subset wouldn't have one.
3842
Solution: you need to pull out each field you want explicitly.
3943

tests/syntax_tests/data/parsing/recovery/expression/expected/list.res.txt

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@
88
7 ┆ | [x, ...rest] => [x, ...loop(rest)]
99
8 ┆ | [] => []
1010

11-
Array's `...` spread is not supported in pattern matches.
12-
Explanation: such spread would create a subarray; out of performance concern, our pattern matching currently guarantees to never create new intermediate data.
13-
Solution: if it's to validate the first few elements, use a `when` clause + Array size check + `get` checks on the current pattern. If it's to obtain a subarray, use `Array.sub` or `Belt.Array.slice`.
11+
Array spread (`...`) is not supported in pattern matches.
12+
13+
Explanation: Allowing `...` here would require creating a new subarray at match time, but for performance reasons pattern matching is guaranteed to never create intermediate data.
14+
15+
Possible solutions:
16+
- To validate specific elements: Use `if` with length checks and `Array.get`
17+
- To extract a subarray: Use `Array.slice`
1418

1519

1620
Syntax error!
@@ -22,9 +26,13 @@ Solution: if it's to validate the first few elements, use a `when` clause + Arra
2226
8 ┆ | [] => []
2327
9 ┆ }
2428

25-
Array's `...` spread is not supported in pattern matches.
26-
Explanation: such spread would create a subarray; out of performance concern, our pattern matching currently guarantees to never create new intermediate data.
27-
Solution: if it's to validate the first few elements, use a `when` clause + Array size check + `get` checks on the current pattern. If it's to obtain a subarray, use `Array.sub` or `Belt.Array.slice`.
29+
Array spread (`...`) is not supported in pattern matches.
30+
31+
Explanation: Allowing `...` here would require creating a new subarray at match time, but for performance reasons pattern matching is guaranteed to never create intermediate data.
32+
33+
Possible solutions:
34+
- To validate specific elements: Use `if` with length checks and `Array.get`
35+
- To extract a subarray: Use `Array.slice`
2836

2937
let flags =
3038
((if reasonFormat

tests/syntax_tests/data/parsing/recovery/pattern/expected/record.res.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
4 │ | {a, _, b} => ()
2020
5 │ }
2121

22-
Record's `...` spread is not supported in pattern matches.
22+
Record spread (`...`) is not supported in pattern matches.
2323
Explanation: you can't collect a subset of a record's field into its own record, since a record needs an explicit declaration and that subset wouldn't have one.
2424
Solution: you need to pull out each field you want explicitly.
2525

0 commit comments

Comments
 (0)