Skip to content

Commit dbd8af4

Browse files
committed
Update array parsing tests
1 parent 481d6b2 commit dbd8af4

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

jscomp/syntax/tests/parsing/grammar/expressions/array.res

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,18 @@ let x = [1, 2, 3,]
55

66
// with constrained expressions
77
let x = [1 :int, (2: int), 3 : int]
8+
9+
// spread
10+
let x = [4, 5, ...y]
11+
12+
// spread anywhere
13+
let x = [4, 5, ...y, 7, ...y]
14+
15+
// spread constrained expressions
16+
let x = [4, 5, ...y: array<int>]
17+
18+
// spread with other variable
19+
let x = [4, 5, k, ...y]
20+
21+
// the only spread
22+
let x = [...y]
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
let x = [|1;2;3|]
22
let x = [|1;2;3|]
3-
let x = [|(1 : int);(2 : int);(3 : int)|]
3+
let x = [|(1 : int);(2 : int);(3 : int)|]
4+
let x = ((Belt.Array.concatMany)[@res.spread ]) [|[|4;5|];y|]
5+
let x = ((Belt.Array.concatMany)[@res.spread ]) [|[|4;5|];y;[|7|];y|]
6+
let x = ((Belt.Array.concatMany)[@res.spread ]) [|[|4;5|];(y : int array)|]
7+
let x = ((Belt.Array.concatMany)[@res.spread ]) [|[|4;5;k|];y|]
8+
let x = ((Belt.Array.concatMany)[@res.spread ]) [|y|]

0 commit comments

Comments
 (0)