File tree Expand file tree Collapse file tree 3 files changed +73
-0
lines changed
jscomp/syntax/tests/parsing/grammar/pattern Expand file tree Collapse file tree 3 files changed +73
-0
lines changed Original file line number Diff line number Diff line change
1
+
2
+ Syntax error!
3
+ tests/parsing/grammar/pattern/variantSpreads.res:37:10-12
4
+
5
+ 35 │ let lookupOpt = (b: option<b>) =>
6
+ 36 │ switch b {
7
+ 37 │ | Some(...a as a) => doWithA(a)
8
+ 38 │ | Some(Four) => Js.log("four")
9
+ 39 │ | Some(Five) => Js.log("five")
10
+
11
+ Did you forget a `)` here?
12
+
13
+
14
+ Syntax error!
15
+ tests/parsing/grammar/pattern/variantSpreads.res:37:10-12
16
+
17
+ 35 │ let lookupOpt = (b: option<b>) =>
18
+ 36 │ switch b {
19
+ 37 │ | Some(...a as a) => doWithA(a)
20
+ 38 │ | Some(Four) => Js.log("four")
21
+ 39 │ | Some(Five) => Js.log("five")
22
+
23
+ Did you forget a `}` here?
24
+
Original file line number Diff line number Diff line change
1
+ type a = One | Two | Three
2
+ type b = | ... a | Four | Five
3
+ type c = Six | Seven
4
+ type d = | ... b | ... c
5
+
6
+ let doWithA = (a : a ) => {
7
+ switch a {
8
+ | One => Js .log ("aaa" )
9
+ | Two => Js .log ("twwwoooo" )
10
+ | Three => Js .log ("threeeee" )
11
+ }
12
+ }
13
+
14
+ let doWithB = (b : b ) => {
15
+ switch b {
16
+ | One => Js .log ("aaa" )
17
+ | _ => Js .log ("twwwoooo" )
18
+ }
19
+ }
20
+
21
+ let lookup = (b : b ) =>
22
+ switch b {
23
+ | ... a as a => doWithA (a )
24
+ | Four => Js .log ("four" )
25
+ | Five => Js .log ("five" )
26
+ }
27
+
28
+ let lookup2 = (d : d ) =>
29
+ switch d {
30
+ | ... a as a => doWithA (a )
31
+ | ... b as b => doWithB (b )
32
+ | Six | Seven => Js .log ("Got rest of d" )
33
+ }
34
+
35
+ let lookupOpt = (b : option <b >) =>
36
+ switch b {
37
+ | Some (... a as a ) => doWithA (a )
38
+ | Some (Four ) => Js .log ("four" )
39
+ | Some (Five ) => Js .log ("five" )
40
+ | None => Js .log ("None" )
41
+ }
Original file line number Diff line number Diff line change @@ -31,3 +31,11 @@ let lookup2 = (d: d) =>
31
31
| ... b as b => doWithB (b )
32
32
| Six | Seven => Js .log ("Got rest of d" )
33
33
}
34
+
35
+ let lookupOpt = (b : option <b >) =>
36
+ switch b {
37
+ | Some (... a as a ) => doWithA (a )
38
+ | Some (Four ) => Js .log ("four" )
39
+ | Some (Five ) => Js .log ("five" )
40
+ | None => Js .log ("None" )
41
+ }
You can’t perform that action at this time.
0 commit comments