Skip to content

Commit 5b409f3

Browse files
committed
Fix remaining syntax tests manually
1 parent f9259b0 commit 5b409f3

File tree

14 files changed

+78
-71
lines changed

14 files changed

+78
-71
lines changed

tests/syntax_tests/data/parsing/errors/other/breadcrumbs170.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// it should report an error on the `}` on line 9
2-
let l = Some(list{1, 2, 3}) |> Obj.magic
2+
let l = Some(list{1, 2, 3})->Obj.magic
33
module M = {
44
switch l {
55
| None => list{}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
I'm not sure what to parse here when looking at "}".
1212

13-
let l = Obj.magic (Some [1; 2; 3])
13+
let l = (Some [1; 2; 3]) -> Obj.magic
1414
module M = struct ;;match l with | None -> [] | Some l -> l#prop end
1515
;;from
1616
;;now

tests/syntax_tests/data/parsing/grammar/expressions/binary.res

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ node :=
1414
node
1515
}
1616

17-
let x = z |> switch z {| _ => false}
18-
let x = z |> @attr switch z {| _ => false}
19-
let x = z |> assert(z)
20-
let x = z |> @attr assert(z)
21-
let x = z |> try sideEffect() catch { | _ => f() }
22-
let x = z |> @attr try sideEffect() catch { | _ => f() }
23-
let x = z |> for i in 0 to 10 { () }
24-
let x = z |> @attr for i in 0 to 10 { () }
25-
let x = z |> while condition { () }
26-
let x = z |> @attr while condition { () }
17+
let x = z->(switch z {| _ => false})
18+
let x = z->(@attr switch z {| _ => false} )
19+
let x = z->(assert(z))
20+
let x = z->(@attr assert(z))
21+
let x = z->(try sideEffect() catch { | _ => f() })
22+
let x = z->(@attr try sideEffect() catch { | _ => f() })
23+
let x = z->(for i in 0 to 10 { () })
24+
let x = z->(@attr for i in 0 to 10 { () })
25+
let x = z->(while condition { () })
26+
let x = z->(@attr while condition { () })
2727

2828
let x = a + -1 + -2
2929
let x = a + @attr -1 + @attr -2

tests/syntax_tests/data/parsing/grammar/expressions/bracedOrRecord.res

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ let e = {-a}
1717
let e = {a + b}
1818
// ternary
1919
let e = {a ? true : false}
20-
let e = {a |> computation ? true : false}
20+
let e = {a->computation ? true : false}
2121
// primary expr
2222
let e = {a[0]}
2323
let e = {f(b)}
@@ -26,11 +26,11 @@ let e = {arr[x] = 20}
2626

2727
// es6 arrow
2828
let e = {
29-
x => x + 1 |> doStuff(config)
29+
x => x + 1->doStuff(config)
3030
}
3131

3232
let e = {
33-
(x => x + 1) |> doStuff(config)
33+
(x => x + 1)->doStuff(config)
3434
}
3535

3636
let e = {
@@ -39,7 +39,7 @@ let e = {
3939

4040

4141
let e = {
42-
(x => x + 1) |> sideEffect
42+
(x => x + 1)->sideEffect
4343
logToAnalytics(Shady.ml)
4444
}
4545

tests/syntax_tests/data/parsing/grammar/expressions/expected/binary.res.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
;;node := (if newBalance === 2 then avl -> (rotateRight node) else node)
22
;;node := ((if newBalance === 2 then avl -> (rotateRight node) else node)
33
[@attr ])
4-
let x = (match z with | _ -> false) z
5-
let x = ((match z with | _ -> false)[@attr ]) z
6-
let x = (assert z) z
7-
let x = ((assert z)[@attr ]) z
8-
let x = (try sideEffect () with | _ -> f ()) z
9-
let x = ((try sideEffect () with | _ -> f ())[@attr ]) z
10-
let x = for i = 0 to 10 do () done z
11-
let x = ((for i = 0 to 10 do () done)[@attr ]) z
12-
let x = while condition do () done z
13-
let x = ((while condition do () done)[@attr ]) z
4+
let x = z -> (match z with | _ -> false)
5+
let x = z -> ((match z with | _ -> false)[@attr ])
6+
let x = z -> (assert z)
7+
let x = z -> ((assert z)[@attr ])
8+
let x = z -> (try sideEffect () with | _ -> f ())
9+
let x = z -> ((try sideEffect () with | _ -> f ())[@attr ])
10+
let x = z -> for i = 0 to 10 do () done
11+
let x = z -> ((for i = 0 to 10 do () done)[@attr ])
12+
let x = z -> while condition do () done
13+
let x = z -> ((while condition do () done)[@attr ])
1414
let x = (a + (-1)) + (-2)
1515
let x = (a + (((-1))[@attr ])) + (((-2))[@attr ])
1616
let x = (a % a) == 0

tests/syntax_tests/data/parsing/grammar/expressions/expected/bracedOrRecord.res.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ let e = ((a; b ())[@res.braces ])
1010
let e = ((- a)[@res.braces ])
1111
let e = ((a + b)[@res.braces ])
1212
let e = ((if a then true else false)[@res.braces ][@res.ternary ])
13-
let e = ((if computation a then true else false)
13+
let e = ((if a -> computation then true else false)
1414
[@res.braces ][@res.ternary ])
1515
let e = ((a.(0))[@res.braces ])
1616
let e = ((f b)[@res.braces ])
1717
let e = (((a.b).c)[@res.braces ])
1818
let e = ((arr.(x) <- 20)[@res.braces ])
19-
let e = ((fun [arity:1]x -> doStuff config (x + 1))[@res.braces ])
20-
let e = ((doStuff config (fun [arity:1]x -> x + 1))[@res.braces ])
19+
let e = ((fun [arity:1]x -> x + (1 -> (doStuff config)))[@res.braces ])
20+
let e = (((fun [arity:1]x -> x + 1) -> (doStuff config))[@res.braces ])
2121
let e = ((if fun [arity:1]x -> x + 1 then true else false)
2222
[@res.braces ][@res.ternary ])
23-
let e = ((sideEffect (fun [arity:1]x -> x + 1); logToAnalytics Shady.ml)
23+
let e = (((fun [arity:1]x -> x + 1) -> sideEffect; logToAnalytics Shady.ml)
2424
[@res.braces ])
2525
let f = ((fun [arity:1]event -> (event.target).value)[@res.braces ])
2626
let f = ((fun [arity:1]event -> ((event.target).value : string))

tests/syntax_tests/data/parsing/grammar/expressions/expected/jsx.res.txt

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -289,15 +289,15 @@ let _ = <div callback=((reduce (fun [arity:1]() -> not state))
289289
[@res.braces ]) />
290290
let _ =
291291
<button ?id className=((Cn.make [|{js|button|js};{js|is-fullwidth|js}|])
292-
[@res.braces ]) onClick>((ste {js|Submit|js})[@res.braces ])</button>
292+
[@res.braces ]) onClick>(({js|Submit|js} -> ste)[@res.braces ])</button>
293293
let _ =
294294
<button ?id className=((Cn.make [{js|button|js}; {js|is-fullwidth|js}])
295-
[@res.braces ]) onClick>((ste {js|Submit|js})[@res.braces ])</button>
295+
[@res.braces ]) onClick>(({js|Submit|js} -> ste)[@res.braces ])</button>
296296
let _ =
297297
<button ?id className=((Cn.make ({js|button|js}, {js|is-fullwidth|js}))
298-
[@res.braces ]) onClick>((ste {js|Submit|js})[@res.braces ])</button>
298+
[@res.braces ]) onClick>(({js|Submit|js} -> ste)[@res.braces ])</button>
299299
let _ = <button ?id className=((Cn.make { a = b })
300-
[@res.braces ]) onClick>((ste {js|Submit|js})[@res.braces ])</button>
300+
[@res.braces ]) onClick>(({js|Submit|js} -> ste)[@res.braces ])</button>
301301
let _ = <X y=((z -> (Belt.Option.getWithDefault {js||js}))[@res.braces ]) />
302302
let _ = <div style=((getStyle ())
303303
[@res.braces ])>((ReasonReact.string {js|BugTest|js})[@res.braces ])</div>
@@ -313,16 +313,19 @@ let _ =
313313
<Image resizeMode=Contain style=(
314314
styles#backgroundImage) uri />)
315315
[@res.braces ])</View>
316-
;;<div>((ReasonReact.array
317-
(Array.of_list
318-
(List.map
319-
(fun [arity:1]possibleGradeValue ->
320-
<option key=((string_of_int possibleGradeValue)
321-
[@res.braces ]) value=((string_of_int possibleGradeValue)
322-
[@res.braces ])>((str (string_of_int possibleGradeValue))
323-
[@res.braces ])</option>)
324-
(List.filter (fun [arity:1]g -> g <= state.maxGrade)
325-
possibleGradeValues))))[@res.braces ])</div>
316+
;;<div>(((((possibleGradeValues ->
317+
(List.filter (fun [arity:1]g -> g <= state.maxGrade)))
318+
->
319+
(List.map
320+
(fun [arity:1]possibleGradeValue ->
321+
<option key=((possibleGradeValue -> string_of_int)
322+
[@res.braces ]) value=((possibleGradeValue ->
323+
string_of_int)
324+
[@res.braces ])>(((possibleGradeValue -> string_of_int) ->
325+
str)
326+
[@res.braces ])</option>)))
327+
-> Array.of_list)
328+
-> ReasonReact.array)[@res.braces ])</div>
326329
;;<div>((Js.log (a <= 10))[@res.braces ])</div>
327330
;;<div><div>((Js.log (a <= 10))[@res.braces ])</div></div>
328331
;;<div><div onClick=((fun [arity:1]_ -> Js.log (a <= 10))

tests/syntax_tests/data/parsing/grammar/expressions/expected/underscoreApply.res.txt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,19 @@ let l =
66
let x [arity:1]__x = List.length __x
77
let nested [arity:1]x [arity:1]__x = List.length __x
88
let incr [arity:1]~v = v + 1
9-
let l1 = List.length (List.map (fun [arity:1]__x -> incr ~v:__x) [1; 2; 3])
10-
let l2 = List.length (List.map (fun [arity:1]__x -> incr ~v:__x) [1; 2; 3])
9+
let l1 =
10+
([1; 2; 3] -> (List.map (fun [arity:1]__x -> incr ~v:__x))) -> List.length
11+
let l2 =
12+
([1; 2; 3] -> (List.map (fun [arity:1]__x -> incr ~v:__x))) -> List.length
1113
let optParam [arity:2]?v () = ((if v == None then 0 else 1)[@res.ternary ])
1214
let l1 =
13-
List.length
14-
(List.map (fun [arity:1]__x -> optParam ?v:__x ()) [Some 1; None; Some 2])
15+
([Some 1; None; Some 2] ->
16+
(List.map (fun [arity:1]__x -> optParam ?v:__x ())))
17+
-> List.length
1518
let l2 =
16-
List.length
17-
(List.map (fun [arity:1]__x -> optParam ?v:__x ()) [Some 1; None; Some 2])
19+
([Some 1; None; Some 2] ->
20+
(List.map (fun [arity:1]__x -> optParam ?v:__x ())))
21+
-> List.length
1822
;;fun [arity:1]__x ->
1923
underscoreWithComments (fun [arity:1]x -> ((something ())[@res.braces ]))
2024
__x

tests/syntax_tests/data/parsing/grammar/expressions/jsx.res

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -443,19 +443,19 @@ let _ = <Animated initialValue=0.0 value>
443443
let _ = <div callback={reduce(() => !state)} />
444444

445445
let _ = <button ?id className={Cn.make(["button", "is-fullwidth"])} onClick>
446-
{"Submit" |> ste}
446+
{"Submit"->ste}
447447
</button>
448448

449449
let _ = <button ?id className={Cn.make(list{"button", "is-fullwidth"})} onClick>
450-
{"Submit" |> ste}
450+
{"Submit"->ste}
451451
</button>
452452

453453
let _ = <button ?id className={Cn.make(("button", "is-fullwidth"))} onClick>
454-
{"Submit" |> ste}
454+
{"Submit"->ste}
455455
</button>
456456

457457
let _ = <button ?id className={Cn.make({a: b})} onClick>
458-
{"Submit" |> ste}
458+
{"Submit"->ste}
459459
</button>
460460

461461
let _ = <X y={z->Belt.Option.getWithDefault("")} />
@@ -483,16 +483,16 @@ let _ = <View style=styles["backgroundImageWrapper"]>
483483

484484
<div>
485485
{possibleGradeValues
486-
|> List.filter(g => g <= state.maxGrade)
487-
|> List.map(possibleGradeValue =>
486+
->List.filter(g => g <= state.maxGrade)
487+
->List.map(possibleGradeValue =>
488488
<option
489-
key={possibleGradeValue |> string_of_int}
490-
value={possibleGradeValue |> string_of_int}>
491-
{possibleGradeValue |> string_of_int |> str}
489+
key={possibleGradeValue->string_of_int}
490+
value={possibleGradeValue->string_of_int}>
491+
{possibleGradeValue->string_of_int->str}
492492
</option>
493493
)
494-
|> Array.of_list
495-
|> ReasonReact.array}
494+
->Array.of_list
495+
->ReasonReact.array}
496496
</div>;
497497

498498
// https://github.com/rescript-lang/syntax/issues/113

tests/syntax_tests/data/parsing/grammar/expressions/underscoreApply.res

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ let nested = x => List.length(_)
88

99
let incr = (~v) => v+1
1010

11-
let l1 = list{1, 2, 3} |> List.map(incr(~v=_)) |> List.length
11+
let l1 = list{1, 2, 3}->List.map(incr(~v=_))->List.length
1212

13-
let l2 = list{1, 2, 3} |>List.map(incr(~v=_)) |> List.length
13+
let l2 = list{1, 2, 3}->List.map(incr(~v=_))->List.length
1414

1515
let optParam = (~v=?, ()) => v == None ? 0 : 1
1616

1717
let l1 =
18-
list{Some(1), None, Some(2)} |> List.map(optParam(~v=?_, ())) |> List.length
18+
list{Some(1), None, Some(2)}->List.map(optParam(~v=?_, ()))->List.length
1919

2020
let l2 =
21-
list{Some(1), None, Some(2)} |> List.map(optParam(~v=?_, ())) |> List.length
21+
list{Some(1), None, Some(2)}->List.map(optParam(~v=?_, ()))->List.length
2222

2323
underscoreWithComments(
2424
// Comment 1

tests/syntax_tests/data/parsing/grammar/pattern/constant.res

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ for ((i as x) in 0 to 10) { () }
5353

5454
switch listPatterns {
5555
| list{(true, pattern), ...patterns} =>
56-
let patterns = patterns |> List.map(filterSpread) |> List.rev
56+
let patterns = patterns->List.map(filterSpread)->List.rev
5757
makeListPattern(loc, patterns, Some(pattern))
5858
| patterns =>
59-
let patterns = patterns |> List.map(filterSpread) |> List.rev
59+
let patterns = patterns->List.map(filterSpread)->List.rev
6060
makeListPattern(loc, patterns, None)
6161
}
6262

tests/syntax_tests/data/parsing/grammar/pattern/expected/constant.res.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ let f [arity:1](1 : int) = ()
4242
;;for i as x = 0 to 10 do () done
4343
;;match listPatterns with
4444
| (true, pattern)::patterns ->
45-
let patterns = List.rev (List.map filterSpread patterns) in
45+
let patterns = (patterns -> (List.map filterSpread)) -> List.rev in
4646
makeListPattern loc patterns (Some pattern)
4747
| patterns ->
48-
let patterns = List.rev (List.map filterSpread patterns) in
48+
let patterns = (patterns -> (List.map filterSpread)) -> List.rev in
4949
makeListPattern loc patterns None
5050
let _0 = 0x9A
5151
let print [arity:2]ppf i =

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ let flags =
3737
((Belt.Array.concatMany)[@res.spread ]) [|[|x|];(loop rest)|]
3838
| [||] -> [||])
3939
[@res.braces ]) in
40-
String.concat {js| |js} (loop parts))
40+
(loop parts) -> (String.concat {js| |js}))
4141
[@res.braces ])
4242
else flags)
4343
[@res.ternary ])

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ let flags = reasonFormat ? {
88
| [] => []
99
}
1010
};
11-
loop(parts) |> String.concat(" ")
11+
loop(parts)->String.concat(" ")
1212
} : flags

0 commit comments

Comments
 (0)