From 2423ad020a44a6c2f55fe776e632d6bbb6992f3c Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Thu, 12 Dec 2024 10:57:29 +0100 Subject: [PATCH] Fix arity of inner functions. The parser gives arity to inner functions while it should only give it to the toplevel for a nested function. E.g. (x,y) => x+y should give toplevel arity 2, and no inner arity 1 --- compiler/syntax/src/res_core.ml | 4 +- .../errors/expressions/expected/arrow.res.txt | 3 +- .../errors/expressions/expected/block.res.txt | 4 +- .../expressions/expected/consecutive.res.txt | 5 +- .../expressions/expected/emptyBlock.res.txt | 2 +- .../other/expected/labelledParameters.res.txt | 8 +- .../errors/structure/expected/gh16B.res.txt | 2 +- .../expected/UncurriedAlways.res.txt | 4 +- .../expected/UncurriedByDefault.res.txt | 46 ++++++------ .../expressions/expected/apply.res.txt | 3 +- .../expressions/expected/arrow.res.txt | 74 ++++++++----------- .../expressions/expected/async.res.txt | 7 +- .../expressions/expected/block.res.txt | 2 +- .../expected/firstClassModule.res.txt | 8 +- .../grammar/expressions/expected/jsx.res.txt | 47 ++++++------ .../expected/locallyAbstractTypes.res.txt | 14 ++-- .../expressions/expected/uncurried.res.txt | 15 ++-- .../expected/underscoreApply.res.txt | 2 +- .../expected/firstClassModules.res.txt | 2 +- .../grammar/modexpr/expected/functor.res.txt | 2 +- .../grammar/pattern/expected/any.res.txt | 4 +- .../grammar/pattern/expected/constant.res.txt | 2 +- .../pattern/expected/extension.res.txt | 3 +- .../expected/firstClassModules.res.txt | 13 ++-- .../pattern/expected/polyvariants.res.txt | 2 +- .../grammar/pattern/expected/unit.res.txt | 4 +- .../expected/equalAfterBinaryExpr.res.txt | 4 +- .../expected/nonRecTypes.res.txt | 54 +++++++------- .../expression/expected/emptyBlock.res.txt | 2 +- 29 files changed, 149 insertions(+), 193 deletions(-) diff --git a/compiler/syntax/src/res_core.ml b/compiler/syntax/src/res_core.ml index 610a37b734..e99a4ec156 100644 --- a/compiler/syntax/src/res_core.ml +++ b/compiler/syntax/src/res_core.ml @@ -1596,8 +1596,8 @@ and parse_es6_arrow_expression ?(arrow_attrs = []) ?(arrow_start_pos = None) {attrs; label = lbl; expr = default_expr; pat; pos = start_pos} -> let loc = mk_loc start_pos end_pos in let fun_expr = - Ast_helper.Exp.fun_ ~loc ~attrs ~arity:(Some arity) lbl default_expr - pat expr + Ast_helper.Exp.fun_ ~loc ~attrs ~arity:None lbl default_expr pat + expr in if term_param_num = 1 then ( term_param_num - 1, diff --git a/tests/syntax_tests/data/parsing/errors/expressions/expected/arrow.res.txt b/tests/syntax_tests/data/parsing/errors/expressions/expected/arrow.res.txt index 921b269614..c21d3abef2 100644 --- a/tests/syntax_tests/data/parsing/errors/expressions/expected/arrow.res.txt +++ b/tests/syntax_tests/data/parsing/errors/expressions/expected/arrow.res.txt @@ -11,5 +11,4 @@ ;;(Object.keys providers).reduce (Function$ (fun [arity:2]elements -> - fun [arity:1]providerId -> ((let x = 1 in let b = 2 in x + b) - [@res.braces ]))) \ No newline at end of file + fun providerId -> ((let x = 1 in let b = 2 in x + b)[@res.braces ]))) \ No newline at end of file diff --git a/tests/syntax_tests/data/parsing/errors/expressions/expected/block.res.txt b/tests/syntax_tests/data/parsing/errors/expressions/expected/block.res.txt index 636937df30..13d6efcccf 100644 --- a/tests/syntax_tests/data/parsing/errors/expressions/expected/block.res.txt +++ b/tests/syntax_tests/data/parsing/errors/expressions/expected/block.res.txt @@ -66,11 +66,11 @@ let findThreadByIdLinearScan = Function$ (fun [arity:2]~threads:((threads)[@res.namedArgLoc ]) -> - fun [arity:1]~id:((id)[@res.namedArgLoc ]) -> + fun ~id:((id)[@res.namedArgLoc ]) -> ((Js.Array2.findi ThreadsModel.threads (Function$ (fun [arity:2]thread -> - fun [arity:1]i -> + fun i -> ((let thisId = match thread with | ServerData.OneToOne diff --git a/tests/syntax_tests/data/parsing/errors/expressions/expected/consecutive.res.txt b/tests/syntax_tests/data/parsing/errors/expressions/expected/consecutive.res.txt index 9d12fcc36f..431ca31f84 100644 --- a/tests/syntax_tests/data/parsing/errors/expressions/expected/consecutive.res.txt +++ b/tests/syntax_tests/data/parsing/errors/expressions/expected/consecutive.res.txt @@ -44,9 +44,8 @@ consecutive expressions on a line must be separated by ';' or a newline -let f = Function$ (fun [arity:2]a -> fun [arity:1]b -> a + 3) +let f = Function$ (fun [arity:2]a -> fun b -> a + 3) ;;b -let f = - Function$ (fun [arity:2]g -> fun [arity:1]h -> ((a + 3; b)[@res.braces ])) +let f = Function$ (fun [arity:2]g -> fun h -> ((a + 3; b)[@res.braces ])) let () = ((sideEffect1 (); sideEffect2 ())[@res.braces ]) let () = ((let open Foo in let exception End in x ())[@res.braces ]) \ No newline at end of file diff --git a/tests/syntax_tests/data/parsing/errors/expressions/expected/emptyBlock.res.txt b/tests/syntax_tests/data/parsing/errors/expressions/expected/emptyBlock.res.txt index b08fdd7412..fca8935cc9 100644 --- a/tests/syntax_tests/data/parsing/errors/expressions/expected/emptyBlock.res.txt +++ b/tests/syntax_tests/data/parsing/errors/expressions/expected/emptyBlock.res.txt @@ -1,2 +1,2 @@ let x = { } -let f = Function$ (fun [arity:2]a -> fun [arity:1]b -> { }) \ No newline at end of file +let f = Function$ (fun [arity:2]a -> fun b -> { }) \ No newline at end of file diff --git a/tests/syntax_tests/data/parsing/errors/other/expected/labelledParameters.res.txt b/tests/syntax_tests/data/parsing/errors/other/expected/labelledParameters.res.txt index ad41ffd983..d42c21ede3 100644 --- a/tests/syntax_tests/data/parsing/errors/other/expected/labelledParameters.res.txt +++ b/tests/syntax_tests/data/parsing/errors/other/expected/labelledParameters.res.txt @@ -31,12 +31,10 @@ A labeled parameter starts with a `~`. Did you mean: `~x`? -let f = - Function$ - (fun [arity:3]x -> fun [arity:2]?(y= 2) -> fun [arity:1]z -> (x + y) + z) +let f = Function$ (fun [arity:3]x -> fun ?(y= 2) -> fun z -> (x + y) + z) let g = Function$ (fun [arity:3]~x:((x)[@res.namedArgLoc ]) -> - fun [arity:2]?y:(((y)[@res.namedArgLoc ])= 2) -> - fun [arity:1]~z:((z)[@res.namedArgLoc ]) -> (x + y) + z) + fun ?y:(((y)[@res.namedArgLoc ])= 2) -> + fun ~z:((z)[@res.namedArgLoc ]) -> (x + y) + z) type nonrec f = (x:int -> y:int -> int, [ `Has_arity2 ]) function$ \ No newline at end of file diff --git a/tests/syntax_tests/data/parsing/errors/structure/expected/gh16B.res.txt b/tests/syntax_tests/data/parsing/errors/structure/expected/gh16B.res.txt index 278e3ab31b..39d03805ec 100644 --- a/tests/syntax_tests/data/parsing/errors/structure/expected/gh16B.res.txt +++ b/tests/syntax_tests/data/parsing/errors/structure/expected/gh16B.res.txt @@ -35,7 +35,7 @@ module ClientSet = let cmp = Function$ (fun [arity:2]a -> - fun [arity:1]b -> + fun b -> ((compare (a |.u Client.getUniqueId) (b |.u Client.getUniqueId)) diff --git a/tests/syntax_tests/data/parsing/grammar/expressions/expected/UncurriedAlways.res.txt b/tests/syntax_tests/data/parsing/grammar/expressions/expected/UncurriedAlways.res.txt index 8e6a52419c..cd268cd8a5 100644 --- a/tests/syntax_tests/data/parsing/grammar/expressions/expected/UncurriedAlways.res.txt +++ b/tests/syntax_tests/data/parsing/grammar/expressions/expected/UncurriedAlways.res.txt @@ -1,7 +1,7 @@ [@@@uncurried ] -let foo = Function$ (fun [arity:2]x -> fun [arity:1]y -> x + y) +let foo = Function$ (fun [arity:2]x -> fun y -> x + y) let z = foo 3 4 -let bar = Function$ (fun [arity:2]x -> fun [arity:1]y -> x + y) +let bar = Function$ (fun [arity:2]x -> fun y -> x + y) let b = bar 3 4 let w = 3 |.u (foo 4) let a = 3 |.u (foo 4) \ No newline at end of file diff --git a/tests/syntax_tests/data/parsing/grammar/expressions/expected/UncurriedByDefault.res.txt b/tests/syntax_tests/data/parsing/grammar/expressions/expected/UncurriedByDefault.res.txt index 4d86f16622..1d60dbec09 100644 --- a/tests/syntax_tests/data/parsing/grammar/expressions/expected/UncurriedByDefault.res.txt +++ b/tests/syntax_tests/data/parsing/grammar/expressions/expected/UncurriedByDefault.res.txt @@ -5,17 +5,15 @@ let uFun = Function$ (fun [arity:1]x -> 3) let mixFun = Function$ (fun [arity:3]a -> - fun [arity:2]b -> - fun [arity:1]c -> + fun b -> + fun c -> Function$ (fun [arity:3]d -> - fun [arity:2]e -> - fun [arity:1]f -> - Function$ (fun [arity:2]g -> fun [arity:1]h -> 4))) + fun e -> fun f -> Function$ (fun [arity:2]g -> fun h -> 4))) let bracesFun = Function$ (fun [arity:1]x -> Function$ (fun [arity:1]y -> x + y)) -let cFun2 = Function$ (fun [arity:2]x -> fun [arity:1]y -> 3) -let uFun2 = Function$ (fun [arity:2]x -> fun [arity:1]y -> 3) +let cFun2 = Function$ (fun [arity:2]x -> fun y -> 3) +let uFun2 = Function$ (fun [arity:2]x -> fun y -> 3) type nonrec cTyp = (string -> int, [ `Has_arity1 ]) function$ type nonrec uTyp = (string -> int, [ `Has_arity1 ]) function$ type nonrec mixTyp = @@ -77,19 +75,19 @@ let _ = Function$ ((fun [arity:1]x -> 34)[@res.async ][@att ]) let _ = preserveAttr (Function$ ((fun [arity:1]x -> 34)[@att ])) let _ = preserveAttr (Function$ ((fun [arity:1]x -> 34)[@res.async ][@att ])) let t0 (type a) (type b) = - Function$ (fun [arity:2](l : a list) -> fun [arity:1](x : a) -> x :: l) + Function$ (fun [arity:2](l : a list) -> fun (x : a) -> x :: l) let t1 (type a) (type b) = - Function$ (fun [arity:2](l : a list) -> fun [arity:1](x : a) -> x :: l) + Function$ (fun [arity:2](l : a list) -> fun (x : a) -> x :: l) let t2 (type a) (type b) = - Function$ (fun [arity:2](l : a list) -> fun [arity:1](x : a) -> x :: l) + Function$ (fun [arity:2](l : a list) -> fun (x : a) -> x :: l) let t3 (type a) (type b) = - Function$ (fun [arity:2](l : a list) -> fun [arity:1](x : a) -> x :: l) + Function$ (fun [arity:2](l : a list) -> fun (x : a) -> x :: l) let t4 (type a) (type b) = - Function$ (fun [arity:2](l : a list) -> fun [arity:1](x : a) -> x :: l) + Function$ (fun [arity:2](l : a list) -> fun (x : a) -> x :: l) let t5 (type a) (type b) = - Function$ (fun [arity:2](l : a list) -> fun [arity:1](x : a) -> x :: l) + Function$ (fun [arity:2](l : a list) -> fun (x : a) -> x :: l) let t6 (type a) (type b) = - Function$ (fun [arity:2](l : a list) -> fun [arity:1](x : a) -> x :: l) + Function$ (fun [arity:2](l : a list) -> fun (x : a) -> x :: l) type nonrec arrowPath1 = (int -> string, [ `Has_arity1 ]) function$ type nonrec arrowPath2 = (I.t -> string, [ `Has_arity1 ]) function$ type nonrec arrowPath3 = (int -> string, [ `Has_arity1 ]) function$ @@ -109,18 +107,18 @@ let mixFun = (fun [arity:1]a -> Function$ (fun [arity:2]b -> - fun [arity:1]c -> + fun c -> Function$ (fun [arity:3]d -> - fun [arity:2]e -> - fun [arity:1]f -> + fun e -> + fun f -> Function$ (fun [arity:1]g -> Function$ (fun [arity:1]h -> 4))))) let bracesFun = Function$ (fun [arity:1]x -> Function$ (fun [arity:1]y -> x + y)) -let cFun2 = Function$ (fun [arity:2]x -> fun [arity:1]y -> 3) -let uFun2 = Function$ (fun [arity:2]x -> fun [arity:1]y -> 3) -let cFun2Dots = Function$ (fun [arity:2]x -> fun [arity:1]y -> 3) +let cFun2 = Function$ (fun [arity:2]x -> fun y -> 3) +let uFun2 = Function$ (fun [arity:2]x -> fun y -> 3) +let cFun2Dots = Function$ (fun [arity:2]x -> fun y -> 3) type nonrec cTyp = (string -> int, [ `Has_arity1 ]) function$ type nonrec uTyp = (string -> int, [ `Has_arity1 ]) function$ type nonrec mixTyp = @@ -184,13 +182,13 @@ let _ = Function$ ((fun [arity:1]x -> 34)[@res.async ][@att ]) let _ = preserveAttr (Function$ ((fun [arity:1]x -> 34)[@att ])) let _ = preserveAttr (Function$ ((fun [arity:1]x -> 34)[@res.async ][@att ])) let t0 (type a) (type b) = - Function$ (fun [arity:2](l : a list) -> fun [arity:1](x : a) -> x :: l) + Function$ (fun [arity:2](l : a list) -> fun (x : a) -> x :: l) let t1 (type a) (type b) = - Function$ (fun [arity:2](l : a list) -> fun [arity:1](x : a) -> x :: l) + Function$ (fun [arity:2](l : a list) -> fun (x : a) -> x :: l) let t2 (type a) (type b) = - Function$ (fun [arity:2](l : a list) -> fun [arity:1](x : a) -> x :: l) + Function$ (fun [arity:2](l : a list) -> fun (x : a) -> x :: l) let t3 (type a) (type b) = - Function$ (fun [arity:2](l : a list) -> fun [arity:1](x : a) -> x :: l) + Function$ (fun [arity:2](l : a list) -> fun (x : a) -> x :: l) type nonrec arrowPath1 = (int -> string, [ `Has_arity1 ]) function$ type nonrec arrowPath2 = (I.t -> string, [ `Has_arity1 ]) function$ type nonrec arrowPath3 = (int -> string, [ `Has_arity1 ]) function$ diff --git a/tests/syntax_tests/data/parsing/grammar/expressions/expected/apply.res.txt b/tests/syntax_tests/data/parsing/grammar/expressions/expected/apply.res.txt index a08df40ebd..1a0f7fdc0e 100644 --- a/tests/syntax_tests/data/parsing/grammar/expressions/expected/apply.res.txt +++ b/tests/syntax_tests/data/parsing/grammar/expressions/expected/apply.res.txt @@ -4,8 +4,7 @@ ;;foo (Function$ (fun [arity:1]_ -> bla)) (Function$ (fun [arity:1]_ -> blaz)) ;;List.map (Function$ (fun [arity:1]x -> x + 1)) myList -;;List.reduce - (Function$ (fun [arity:2]acc -> fun [arity:1]curr -> acc + curr)) 0 +;;List.reduce (Function$ (fun [arity:2]acc -> fun curr -> acc + curr)) 0 myList let unitUncurried = apply () ;;call ~a:(((((a)[@res.namedArgLoc ]) : int))[@res.namedArgLoc ]) \ No newline at end of file diff --git a/tests/syntax_tests/data/parsing/grammar/expressions/expected/arrow.res.txt b/tests/syntax_tests/data/parsing/grammar/expressions/expected/arrow.res.txt index 9060aa6494..36cc7d1c18 100644 --- a/tests/syntax_tests/data/parsing/grammar/expressions/expected/arrow.res.txt +++ b/tests/syntax_tests/data/parsing/grammar/expressions/expected/arrow.res.txt @@ -3,99 +3,85 @@ let f = Function$ (fun [arity:1]_ -> Js.log {js|test|js}) let f = Function$ (fun [arity:1]() -> Js.log {js|unit|js}) let f = Function$ (fun [arity:1](Reducer (inst, comp)) -> inst.render comp) let f = Function$ (fun [arity:1](Instance) -> ()) -let f = Function$ (fun [arity:2]a -> fun [arity:1]b -> a + b) -let f = Function$ (fun [arity:2]1 -> fun [arity:1]2 -> ()) +let f = Function$ (fun [arity:2]a -> fun b -> a + b) +let f = Function$ (fun [arity:2]1 -> fun 2 -> ()) let f = Function$ (fun [arity:1]{js|stringPattern|js} -> ()) let f = Function$ - (fun [arity:2]{js|stringPattern|js} -> - fun [arity:1]{js|stringPattern|js} -> ()) + (fun [arity:2]{js|stringPattern|js} -> fun {js|stringPattern|js} -> ()) let f = Function$ (fun [arity:1]() -> ()) -let f = Function$ (fun [arity:2](a : int) -> fun [arity:1](b : int) -> a + b) -let f = Function$ (fun [arity:2]_ -> fun [arity:1]_ -> ()) -let f = - Function$ - (fun [arity:2][|a;b|] -> fun [arity:1][|c;d|] -> ((a + b) + c) + d) +let f = Function$ (fun [arity:2](a : int) -> fun (b : int) -> a + b) +let f = Function$ (fun [arity:2]_ -> fun _ -> ()) +let f = Function$ (fun [arity:2][|a;b|] -> fun [|c;d|] -> ((a + b) + c) + d) let f = Function$ (fun [arity:1]{ a } -> a + 1) let f = - Function$ - (fun [arity:2]{ a; b } -> fun [arity:1]{ c; d } -> ((a + b) + c) + d) + Function$ (fun [arity:2]{ a; b } -> fun { c; d } -> ((a + b) + c) + d) let f = Function$ (fun [arity:1](a, b) -> a + b) -let f = - Function$ (fun [arity:2](a, b) -> fun [arity:1](c, d) -> ((a + b) + c) + d) +let f = Function$ (fun [arity:2](a, b) -> fun (c, d) -> ((a + b) + c) + d) let f = Function$ (fun [arity:1]exception Terminate -> ()) let f = - Function$ - (fun [arity:2]exception Terminate -> fun [arity:1]exception Exit -> ()) + Function$ (fun [arity:2]exception Terminate -> fun exception Exit -> ()) let f = Function$ (fun [arity:1][] -> ()) let f = Function$ (fun [arity:1](x::xs) -> x + (xs |.u Belt.List.length)) -let f = Function$ (fun [arity:2](x : int) -> fun [arity:1](y : int) -> x + y) +let f = Function$ (fun [arity:2](x : int) -> fun (y : int) -> x + y) let f = Function$ (fun [arity:2]~a:((a)[@res.namedArgLoc ]) -> - fun [arity:1]~b:((b)[@res.namedArgLoc ]) -> a + b) + fun ~b:((b)[@res.namedArgLoc ]) -> a + b) let f = Function$ (fun [arity:2]~a:((x)[@res.namedArgLoc ]) -> - fun [arity:1]~b:((y)[@res.namedArgLoc ]) -> x + y) + fun ~b:((y)[@res.namedArgLoc ]) -> x + y) let f = Function$ (fun [arity:2]~a:(((x : int))[@res.namedArgLoc ]) -> - fun [arity:1]~b:(((y : int))[@res.namedArgLoc ]) -> x + y) + fun ~b:(((y : int))[@res.namedArgLoc ]) -> x + y) let f = Function$ (fun [arity:3]?a:(((a)[@res.namedArgLoc ])= 1) -> - fun [arity:2]?b:(((b)[@res.namedArgLoc ])= 2) -> - fun [arity:1]c -> (a + b) + c) + fun ?b:(((b)[@res.namedArgLoc ])= 2) -> fun c -> (a + b) + c) let f = Function$ (fun [arity:3]?a:(((x)[@res.namedArgLoc ])= 1) -> - fun [arity:2]?b:(((y)[@res.namedArgLoc ])= 2) -> - fun [arity:1]c -> (x + y) + c) + fun ?b:(((y)[@res.namedArgLoc ])= 2) -> fun c -> (x + y) + c) let f = Function$ (fun [arity:3]?a:((((x : int))[@res.namedArgLoc ])= 1) -> - fun [arity:2]?b:((((y : int))[@res.namedArgLoc ])= 2) -> - fun [arity:1]c -> (x + y) + c) + fun ?b:((((y : int))[@res.namedArgLoc ])= 2) -> fun c -> (x + y) + c) let f = Function$ (fun [arity:3]?a:((a)[@res.namedArgLoc ]) -> - fun [arity:2]?b:((b)[@res.namedArgLoc ]) -> - fun [arity:1]c -> + fun ?b:((b)[@res.namedArgLoc ]) -> + fun c -> match (a, b) with | (Some a, Some b) -> (a + b) + c | _ -> 3) let f = Function$ (fun [arity:3]?a:((x)[@res.namedArgLoc ]) -> - fun [arity:2]?b:((y)[@res.namedArgLoc ]) -> - fun [arity:1]c -> + fun ?b:((y)[@res.namedArgLoc ]) -> + fun c -> match (x, y) with | (Some a, Some b) -> (a + b) + c | _ -> 3) let f = Function$ (fun [arity:3]?a:(((x : int option))[@res.namedArgLoc ]) -> - fun [arity:2]?b:(((y : int option))[@res.namedArgLoc ]) -> - fun [arity:1]c -> + fun ?b:(((y : int option))[@res.namedArgLoc ]) -> + fun c -> match (x, y) with | (Some a, Some b) -> (a + b) + c | _ -> 3) -let f = Function$ (fun [arity:2]a -> fun [arity:1]b -> a + b) +let f = Function$ (fun [arity:2]a -> fun b -> a + b) let f = Function$ (fun [arity:1]() -> ()) let f = Function$ (fun [arity:1]() -> ()) -let f = Function$ (fun [arity:3]a -> fun [arity:2]b -> fun [arity:1]c -> ()) -let f = - Function$ - (fun [arity:4]a -> - fun [arity:3]b -> fun [arity:2]c -> fun [arity:1]d -> ()) -let f = Function$ (fun [arity:3]a -> fun [arity:2]b -> fun [arity:1]c -> ()) +let f = Function$ (fun [arity:3]a -> fun b -> fun c -> ()) +let f = Function$ (fun [arity:4]a -> fun b -> fun c -> fun d -> ()) +let f = Function$ (fun [arity:3]a -> fun b -> fun c -> ()) let f = Function$ (fun [arity:4]~a:((a)[@res.namedArgLoc ][@attr ]) -> - fun [arity:3]b -> - fun [arity:2]~c:((c)[@res.namedArgLoc ][@attr ]) -> - fun [arity:1]d -> ()) + fun b -> fun ~c:((c)[@res.namedArgLoc ][@attr ]) -> fun d -> ()) let f = Function$ (fun [arity:4]~a:((a)[@res.namedArgLoc ][@attr ]) -> - fun [arity:3]((b)[@attrOnB ]) -> - fun [arity:2]~c:((c)[@res.namedArgLoc ][@attr ]) -> - fun [arity:1]((d)[@attrOnD ]) -> ()) + fun ((b)[@attrOnB ]) -> + fun ~c:((c)[@res.namedArgLoc ][@attr ]) -> + fun ((d)[@attrOnD ]) -> ()) let f = Function$ (fun [arity:1]list -> list ()) ;;match colour with | Red when diff --git a/tests/syntax_tests/data/parsing/grammar/expressions/expected/async.res.txt b/tests/syntax_tests/data/parsing/grammar/expressions/expected/async.res.txt index d76ad3ec36..245e144a22 100644 --- a/tests/syntax_tests/data/parsing/grammar/expressions/expected/async.res.txt +++ b/tests/syntax_tests/data/parsing/grammar/expressions/expected/async.res.txt @@ -24,12 +24,9 @@ let async = [@res.braces ]) let f = ((if isPositive - then - Function$ ((fun [arity:2]a -> fun [arity:1]b -> (a + b : int)) - [@res.async ]) + then Function$ ((fun [arity:2]a -> fun b -> (a + b : int))[@res.async ]) else - Function$ (((fun [arity:2]c -> fun [arity:1]d -> (c - d : int))) - [@res.async ])) + Function$ (((fun [arity:2]c -> fun d -> (c - d : int)))[@res.async ])) [@res.ternary ]) let foo = async ~a:((34)[@res.namedArgLoc ]) let bar = diff --git a/tests/syntax_tests/data/parsing/grammar/expressions/expected/block.res.txt b/tests/syntax_tests/data/parsing/grammar/expressions/expected/block.res.txt index 556b20feda..2e9038568e 100644 --- a/tests/syntax_tests/data/parsing/grammar/expressions/expected/block.res.txt +++ b/tests/syntax_tests/data/parsing/grammar/expressions/expected/block.res.txt @@ -84,5 +84,5 @@ let reifyStyle (type a) = let calc_fps = Function$ (fun [arity:2]t0 -> - fun [arity:1]t1 -> ((let delta = (t1 -. t0) /. 1000. in 1. /. delta) + fun t1 -> ((let delta = (t1 -. t0) /. 1000. in 1. /. delta) [@res.braces ])) \ No newline at end of file diff --git a/tests/syntax_tests/data/parsing/grammar/expressions/expected/firstClassModule.res.txt b/tests/syntax_tests/data/parsing/grammar/expressions/expected/firstClassModule.res.txt index f9f3af0c9c..7769f2dbe1 100644 --- a/tests/syntax_tests/data/parsing/grammar/expressions/expected/firstClassModule.res.txt +++ b/tests/syntax_tests/data/parsing/grammar/expressions/expected/firstClassModule.res.txt @@ -16,13 +16,13 @@ let numbers = [three; (module struct let x = 4 end)] let plus = Function$ (fun [arity:2]m1 -> - fun [arity:1]m2 -> ((((module + fun m2 -> ((((module struct let x = (to_int m1) + (to_int m2) end) : (module X_int))) [@res.braces ])) let plus = Function$ (fun [arity:2]m1 -> - fun [arity:1]m2 -> ((module + fun m2 -> ((module struct let x = (to_int m1) + (to_int m2) end) : (module X_int))) let unique_instance = ((module struct module Query_handler = Unique @@ -31,7 +31,7 @@ let build_instance (type a) = Function$ (fun [arity:2]((module Q) : (module Query_handler with type config = a)) -> - fun [arity:1]config -> ((module + fun config -> ((module struct module Query_handler = Q let this = Q.create config end) : (module Query_handler_instance))) @@ -39,7 +39,7 @@ let build_instance (type a) = Function$ (fun [arity:2]((module Q) : (module Query_handler with type config = a)) -> - fun [arity:1]config -> ((((module + fun config -> ((((module struct module Query_handler = Q let this = Q.create config end) : (module Query_handler_instance))) diff --git a/tests/syntax_tests/data/parsing/grammar/expressions/expected/jsx.res.txt b/tests/syntax_tests/data/parsing/grammar/expressions/expected/jsx.res.txt index cd3f51ae10..ebbbcb723f 100644 --- a/tests/syntax_tests/data/parsing/grammar/expressions/expected/jsx.res.txt +++ b/tests/syntax_tests/data/parsing/grammar/expressions/expected/jsx.res.txt @@ -151,12 +151,12 @@ let y = [@res.namedArgLoc ]) ~isHistorical:((true)[@res.namedArgLoc ]) ~onHashChange:((Function$ (fun [arity:3]_oldPath -> - fun [arity:2]_oldUrl -> - fun [arity:1]newUrl -> + fun _oldUrl -> + fun newUrl -> updater (Function$ (fun [arity:2]latestComponentBag -> - fun [arity:1]_ -> + fun _ -> ((let currentActualPath = Routes.hashOfUri newUrl in let pathFromState = @@ -345,10 +345,10 @@ let _ = ((StaticDiv.createElement ~onClick:((Function$ (fun [arity:5]foo -> - fun [arity:4]bar -> - fun [arity:3]baz -> - fun [arity:2]lineBreak -> - fun [arity:1]identifier -> + fun bar -> + fun baz -> + fun lineBreak -> + fun identifier -> ((doStuff foo bar baz; bar lineBreak identifier) [@res.braces ]))) [@res.namedArgLoc ][@res.braces ]) ~children:[] ()) @@ -369,16 +369,11 @@ let _ = ((StaticDivNamed.createElement ~onClick:((Function$ (fun [arity:6]~foo:((foo)[@res.namedArgLoc ]) -> - fun [arity:5]~bar:((bar)[@res.namedArgLoc ]) -> - fun [arity:4]~baz:((baz)[@res.namedArgLoc ]) -> - fun - [arity:3]~lineBreak:((lineBreak)[@res.namedArgLoc - ]) - -> - fun - [arity:2]~identifier:((identifier)[@res.namedArgLoc - ]) - -> fun [arity:1]() -> bar lineBreak identifier)) + fun ~bar:((bar)[@res.namedArgLoc ]) -> + fun ~baz:((baz)[@res.namedArgLoc ]) -> + fun ~lineBreak:((lineBreak)[@res.namedArgLoc ]) -> + fun ~identifier:((identifier)[@res.namedArgLoc ]) + -> fun () -> bar lineBreak identifier)) [@res.namedArgLoc ][@res.braces ]) ~children:[] ()) [@JSX ]) let _ = @@ -392,7 +387,7 @@ let _ = ((div ~onClick:((Function$ (fun [arity:2]e -> - fun [arity:1]e2 -> (((doStuff (); bar foo) + fun e2 -> (((doStuff (); bar foo) [@res.braces ]) : event))) [@res.namedArgLoc ][@res.braces ]) ~children:[] ()) [@JSX ]) @@ -400,10 +395,10 @@ let _ = ((div ~onClick:((Function$ (fun [arity:5]foo -> - fun [arity:4]bar -> - fun [arity:3]baz -> - fun [arity:2]superLongIdent -> - fun [arity:1]breakLine -> (((doStuff (); bar foo) + fun bar -> + fun baz -> + fun superLongIdent -> + fun breakLine -> (((doStuff (); bar foo) [@res.braces ]) : (event * event2 * event3 * event4 * event5)))) [@res.namedArgLoc ][@res.braces ]) ~children:[] ()) @@ -412,10 +407,10 @@ let _ = ((div ~onClick:((Function$ (fun [arity:5]foo -> - fun [arity:4]bar -> - fun [arity:3]baz -> - fun [arity:2]superLongIdent -> - fun [arity:1]breakLine -> + fun bar -> + fun baz -> + fun superLongIdent -> + fun breakLine -> (doStuff () : (event * event2 * event3 * event4 * event5)))) [@res.namedArgLoc ][@res.braces ]) ~children:[] ()) diff --git a/tests/syntax_tests/data/parsing/grammar/expressions/expected/locallyAbstractTypes.res.txt b/tests/syntax_tests/data/parsing/grammar/expressions/expected/locallyAbstractTypes.res.txt index 2e3d1e4b3b..7e6f17ed76 100644 --- a/tests/syntax_tests/data/parsing/grammar/expressions/expected/locallyAbstractTypes.res.txt +++ b/tests/syntax_tests/data/parsing/grammar/expressions/expected/locallyAbstractTypes.res.txt @@ -1,25 +1,22 @@ let f (type t) = Function$ (fun [arity:1](xs : t list) -> ()) let f (type t) = Function$ - (fun [arity:2](xs : t list) -> fun (type s) -> - fun [arity:1](ys : s list) -> ()) + (fun [arity:2](xs : t list) -> fun (type s) -> fun (ys : s list) -> ()) let f (type t) (type u) (type v) = Function$ (fun [arity:1](xs : (t * u * v) list) -> ()) let f (type t) (type u) (type v) = Function$ (fun [arity:2](xs : (t * u * v) list) -> fun (type s) -> fun (type w) -> - fun (type z) -> fun [arity:1](ys : (s * w * z) list) -> ()) + fun (type z) -> fun (ys : (s * w * z) list) -> ()) let f = ((fun (type t) -> fun (type u) -> fun (type v) -> Function$ (fun [arity:2](xs : (t * u * v) list) -> ((fun (type s) -> fun (type w) - -> fun (type z) -> fun [arity:1](ys : (s * w * z) list) -> ()) - [@attr2 ]))) + -> fun (type z) -> fun (ys : (s * w * z) list) -> ())[@attr2 ]))) [@attr ]) let f = ((fun (type t) -> ((fun (type s) -> Function$ (fun [arity:2](xs : (t * s) list) -> ((fun (type u) -> ((fun (type v) -> - fun (type w) -> fun [arity:1](ys : (u * v * w) list) -> ())[@attr ])) - [@attr ]))) + fun (type w) -> fun (ys : (u * v * w) list) -> ())[@attr ]))[@attr ]))) [@attr ]))[@attr ]) let cancel_and_collect_callbacks : 'a 'u 'c . @@ -27,5 +24,4 @@ let cancel_and_collect_callbacks : [ `Has_arity2 ]) function$ = fun (type x) -> Function$ - (fun [arity:2]callbacks_accumulator -> - fun [arity:1](p : (_, _, c) promise) -> ()) \ No newline at end of file + (fun [arity:2]callbacks_accumulator -> fun (p : (_, _, c) promise) -> ()) \ No newline at end of file diff --git a/tests/syntax_tests/data/parsing/grammar/expressions/expected/uncurried.res.txt b/tests/syntax_tests/data/parsing/grammar/expressions/expected/uncurried.res.txt index 1b6cb630d1..46c2414859 100644 --- a/tests/syntax_tests/data/parsing/grammar/expressions/expected/uncurried.res.txt +++ b/tests/syntax_tests/data/parsing/grammar/expressions/expected/uncurried.res.txt @@ -1,10 +1,7 @@ -let f = Function$ (fun [arity:2]a -> fun [arity:1]b -> a + b) -let f = Function$ (fun [arity:2]a -> fun [arity:1]b -> a + b) +let f = Function$ (fun [arity:2]a -> fun b -> a + b) +let f = Function$ (fun [arity:2]a -> fun b -> a + b) let f = - Function$ - (fun [arity:4]a -> - fun [arity:3]b -> - fun [arity:2]c -> fun [arity:1]d -> ((a + b) + c) + d) + Function$ (fun [arity:4]a -> fun b -> fun c -> fun d -> ((a + b) + c) + d) let f = Function$ ((fun [arity:1]a -> @@ -19,12 +16,10 @@ let f = let f = Function$ (fun [arity:4]((a)[@attr ]) -> - fun [arity:3]((b)[@attr2 ]) -> - fun [arity:2]((c)[@attr3 ]) -> fun [arity:1]((d)[@attr4 ]) -> ()) + fun ((b)[@attr2 ]) -> fun ((c)[@attr3 ]) -> fun ((d)[@attr4 ]) -> ()) let f = Function$ (fun [arity:4]((a)[@attr ]) -> - fun [arity:3]((b)[@attr2 ]) -> - fun [arity:2]((c)[@attr3 ]) -> fun [arity:1]((d)[@attr4 ]) -> ()) + fun ((b)[@attr2 ]) -> fun ((c)[@attr3 ]) -> fun ((d)[@attr4 ]) -> ()) ;;add 1 2 ;;add 2 3 4 5 6 7 8 9 10 \ No newline at end of file diff --git a/tests/syntax_tests/data/parsing/grammar/expressions/expected/underscoreApply.res.txt b/tests/syntax_tests/data/parsing/grammar/expressions/expected/underscoreApply.res.txt index 86a8b0da28..ebfa3f12d5 100644 --- a/tests/syntax_tests/data/parsing/grammar/expressions/expected/underscoreApply.res.txt +++ b/tests/syntax_tests/data/parsing/grammar/expressions/expected/underscoreApply.res.txt @@ -24,7 +24,7 @@ let l2 = let optParam = Function$ (fun [arity:2]?v:((v)[@res.namedArgLoc ]) -> - fun [arity:1]() -> ((if v = None then 0 else 1)[@res.ternary ])) + fun () -> ((if v = None then 0 else 1)[@res.ternary ])) let l1 = List.length (List.map (Function$ (fun [arity:1]__x -> optParam ?v:__x ())) diff --git a/tests/syntax_tests/data/parsing/grammar/modexpr/expected/firstClassModules.res.txt b/tests/syntax_tests/data/parsing/grammar/modexpr/expected/firstClassModules.res.txt index 1c09739d12..55f32eeffe 100644 --- a/tests/syntax_tests/data/parsing/grammar/modexpr/expected/firstClassModules.res.txt +++ b/tests/syntax_tests/data/parsing/grammar/modexpr/expected/firstClassModules.res.txt @@ -5,7 +5,7 @@ module Device = (val let draw_using_device = Function$ (fun [arity:2]device_name -> - fun [arity:1]picture -> + fun picture -> ((let module Device = (val (Hashtbl.find devices device_name : (module DEVICE))) in Device.draw picture) diff --git a/tests/syntax_tests/data/parsing/grammar/modexpr/expected/functor.res.txt b/tests/syntax_tests/data/parsing/grammar/modexpr/expected/functor.res.txt index 7f898aba98..415ac22303 100644 --- a/tests/syntax_tests/data/parsing/grammar/modexpr/expected/functor.res.txt +++ b/tests/syntax_tests/data/parsing/grammar/modexpr/expected/functor.res.txt @@ -32,7 +32,7 @@ module Make(Cmp:sig let add = Function$ (fun [arity:2](y : coll) -> - fun [arity:1](e : key) -> + fun (e : key) -> if List.exists (Function$ (fun [arity:1]x -> eq x e)) y then y else e :: y) diff --git a/tests/syntax_tests/data/parsing/grammar/pattern/expected/any.res.txt b/tests/syntax_tests/data/parsing/grammar/pattern/expected/any.res.txt index 3123064d47..80c80c49d3 100644 --- a/tests/syntax_tests/data/parsing/grammar/pattern/expected/any.res.txt +++ b/tests/syntax_tests/data/parsing/grammar/pattern/expected/any.res.txt @@ -22,8 +22,8 @@ let f = Function$ (fun [arity:1](_ as _x) -> ()) let f = Function$ (fun [arity:1](_ : unit) -> ()) let f = Function$ (fun [arity:1](_ : unit) -> ()) let f = Function$ (fun [arity:1]((_ : unit) as _x) -> ()) -let g = Function$ (fun [arity:2]a -> fun [arity:1]_ -> ()) -let g = Function$ (fun [arity:2]_ -> fun [arity:1]a -> ()) +let g = Function$ (fun [arity:2]a -> fun _ -> ()) +let g = Function$ (fun [arity:2]_ -> fun a -> ()) ;;for _ = 0 to 10 do () done ;;for _ as _x = 0 to 10 do () done ;;for _ = 0 to 10 do () done diff --git a/tests/syntax_tests/data/parsing/grammar/pattern/expected/constant.res.txt b/tests/syntax_tests/data/parsing/grammar/pattern/expected/constant.res.txt index 713dc033fc..70ade709ab 100644 --- a/tests/syntax_tests/data/parsing/grammar/pattern/expected/constant.res.txt +++ b/tests/syntax_tests/data/parsing/grammar/pattern/expected/constant.res.txt @@ -52,7 +52,7 @@ let _0 = 0x9A let print = Function$ (fun [arity:2]ppf -> - fun [arity:1]i -> + fun i -> match i.stamp with | 0 -> fprintf ppf {js|%s!|js} i.name | (-1) -> fprintf ppf {js|%s#|js} i.name diff --git a/tests/syntax_tests/data/parsing/grammar/pattern/expected/extension.res.txt b/tests/syntax_tests/data/parsing/grammar/pattern/expected/extension.res.txt index 9c5b5db261..e669ad16e2 100644 --- a/tests/syntax_tests/data/parsing/grammar/pattern/expected/extension.res.txt +++ b/tests/syntax_tests/data/parsing/grammar/pattern/expected/extension.res.txt @@ -15,8 +15,7 @@ let f = Function$ (fun [arity:1][%patternExtension ] -> ()) let f = Function$ (fun [arity:1][%pattern.extension ] -> ()) let f = Function$ (fun [arity:1][%raw {js|x|js}] -> ()) let f = - Function$ - (fun [arity:2][%raw {js|x|js}] -> fun [arity:1][%raw {js|y|js}] -> ()) + Function$ (fun [arity:2][%raw {js|x|js}] -> fun [%raw {js|y|js}] -> ()) let f = Function$ (fun [arity:1]([%raw {js|x|js}] as _y) -> ()) let f = Function$ (fun [arity:1]([%raw {js|x|js}] : unit) -> ()) let f = Function$ (fun [arity:1]([%patExt1 ]|[%patExt2 ]) -> ()) diff --git a/tests/syntax_tests/data/parsing/grammar/pattern/expected/firstClassModules.res.txt b/tests/syntax_tests/data/parsing/grammar/pattern/expected/firstClassModules.res.txt index 875aa2d5a5..c971522621 100644 --- a/tests/syntax_tests/data/parsing/grammar/pattern/expected/firstClassModules.res.txt +++ b/tests/syntax_tests/data/parsing/grammar/pattern/expected/firstClassModules.res.txt @@ -1,22 +1,19 @@ -let sort (type s) = - Function$ (fun [arity:2](module Set) -> fun [arity:1]l -> ()) +let sort (type s) = Function$ (fun [arity:2](module Set) -> fun l -> ()) let sort (type s) = Function$ (fun [arity:2]((module Set) : (module Set.S with type elt = s)) -> - fun [arity:1]l -> ()) + fun l -> ()) let sort (type s) = Function$ (fun [arity:2]((module Set) : (module Set.S with type elt = s and type elt2 = t)) - -> fun [arity:1]l -> ()) -let foo = - Function$ (fun [arity:2](module Foo) -> fun [arity:1]baz -> Foo.bar baz) + -> fun l -> ()) +let foo = Function$ (fun [arity:2](module Foo) -> fun baz -> Foo.bar baz) let bump_list (type a) = Function$ (fun [arity:2]((module B) : (module Bumpable with type t = a)) -> - fun [arity:1](l : a list) -> - List.map ~f:((B.bump l)[@res.namedArgLoc ])) + fun (l : a list) -> List.map ~f:((B.bump l)[@res.namedArgLoc ])) ;;match x with | (module Set) -> () | ((module Set) : (module Set.S with type elt = s)) -> () diff --git a/tests/syntax_tests/data/parsing/grammar/pattern/expected/polyvariants.res.txt b/tests/syntax_tests/data/parsing/grammar/pattern/expected/polyvariants.res.txt index 8b18583c4b..f9342b085d 100644 --- a/tests/syntax_tests/data/parsing/grammar/pattern/expected/polyvariants.res.txt +++ b/tests/syntax_tests/data/parsing/grammar/pattern/expected/polyvariants.res.txt @@ -70,7 +70,7 @@ let f = let cmp = Function$ (fun [arity:2]selectedChoice -> - fun [arity:1]value -> + fun value -> match (selectedChoice, value) with | (#a, #a) -> true | [|#b;#b|] -> true diff --git a/tests/syntax_tests/data/parsing/grammar/pattern/expected/unit.res.txt b/tests/syntax_tests/data/parsing/grammar/pattern/expected/unit.res.txt index f1d3f48961..600c1ab974 100644 --- a/tests/syntax_tests/data/parsing/grammar/pattern/expected/unit.res.txt +++ b/tests/syntax_tests/data/parsing/grammar/pattern/expected/unit.res.txt @@ -29,8 +29,8 @@ let (() : unit) as x = () let f = Function$ (fun [arity:1]() -> ()) let f = Function$ (fun [arity:1]() -> ()) let f = Function$ (fun [arity:1](() as _u) -> ()) -let f = Function$ (fun [arity:2]() -> fun [arity:1]() -> ()) -let f = Function$ (fun [arity:2](() as _u) -> fun [arity:1](() as _u) -> ()) +let f = Function$ (fun [arity:2]() -> fun () -> ()) +let f = Function$ (fun [arity:2](() as _u) -> fun (() as _u) -> ()) let f = Function$ (fun [arity:1](() : unit) -> ()) let f = Function$ (fun [arity:1]((() as _u) : unit) -> ()) let f = Function$ (fun [arity:1]((() : unit) as _u) -> ()) diff --git a/tests/syntax_tests/data/parsing/infiniteLoops/expected/equalAfterBinaryExpr.res.txt b/tests/syntax_tests/data/parsing/infiniteLoops/expected/equalAfterBinaryExpr.res.txt index 6e2dbf6a62..2a06ff2c95 100644 --- a/tests/syntax_tests/data/parsing/infiniteLoops/expected/equalAfterBinaryExpr.res.txt +++ b/tests/syntax_tests/data/parsing/infiniteLoops/expected/equalAfterBinaryExpr.res.txt @@ -13,7 +13,7 @@ let rec _addLoop = Function$ (fun [arity:2]rbt -> - fun [arity:1]currentNode -> + fun currentNode -> ((if (Some currentNode) == (rbt |.u root) then currentNode.color <- Black else @@ -64,7 +64,7 @@ let rec _addLoop = let removeNode = Function$ (fun [arity:2]rbt -> - fun [arity:1]node -> + fun node -> ((if nodeToRemove.color == Black then (if successor.color == Red diff --git a/tests/syntax_tests/data/parsing/infiniteLoops/expected/nonRecTypes.res.txt b/tests/syntax_tests/data/parsing/infiniteLoops/expected/nonRecTypes.res.txt index b45c9d086d..f690cecfef 100644 --- a/tests/syntax_tests/data/parsing/infiniteLoops/expected/nonRecTypes.res.txt +++ b/tests/syntax_tests/data/parsing/infiniteLoops/expected/nonRecTypes.res.txt @@ -128,13 +128,13 @@ include let has = Function$ (fun [arity:2]rbt -> - fun [arity:1]value -> (_findNode rbt (rootGet rbt) value) != None) + fun value -> (_findNode rbt (rootGet rbt) value) != None) let rec minNode = Function$ (fun [arity:1]node -> [%rescript.exprhole ]) let findMin = Function$ (fun [arity:1]rbt -> [%rescript.exprhole ]) let removeNode = Function$ (fun [arity:2]rbt -> - fun [arity:1]node -> + fun node -> ((let nodeToRemove = match ((leftGet node), (rightGet node)) with | (Some _, Some _) -> @@ -315,7 +315,7 @@ include let remove = Function$ (fun [arity:2]rbt -> - fun [arity:1]value -> + fun value -> match _findNode rbt (rootGet rbt) value with | Some node -> (removeNode rbt node; @@ -325,12 +325,12 @@ include let findThroughCallback = Function$ (fun [arity:2]rbt -> - fun [arity:1]cb -> + fun cb -> ((let rec findThroughCallback = Function$ (fun [arity:3]rbt -> - fun [arity:2]node -> - fun [arity:1]cb -> + fun node -> + fun cb -> match node with | None -> None | Some node -> @@ -356,9 +356,9 @@ include let rec heightOfInterval = Function$ (fun [arity:4]rbt -> - fun [arity:3]node -> - fun [arity:2]lhs -> - fun [arity:1]rhs -> + fun node -> + fun lhs -> + fun rhs -> match node with | None -> 0. | Some n -> @@ -385,12 +385,11 @@ include let heightOfInterval = Function$ (fun [arity:3]rbt -> - fun [arity:2]lhs -> - fun [arity:1]rhs -> heightOfInterval rbt (rootGet rbt) lhs rhs) + fun lhs -> fun rhs -> heightOfInterval rbt (rootGet rbt) lhs rhs) let rec firstVisibleNode = Function$ (fun [arity:2]node -> - fun [arity:1]offset -> + fun offset -> match node with | None -> None | Some node -> @@ -413,14 +412,14 @@ include let lastVisibleNode = Function$ (fun [arity:2]node -> - fun [arity:1]offset -> + fun offset -> match firstVisibleNode node offset with | None -> maxNode node | first -> first) let firstVisible = Function$ (fun [arity:2]rbt -> - fun [arity:1]~offset:((offset)[@res.namedArgLoc ]) -> + fun ~offset:((offset)[@res.namedArgLoc ]) -> match firstVisibleNode (rootGet rbt) offset with | None -> None | Some node -> Some (valueGet node)) @@ -446,8 +445,7 @@ include let rec sumLeftSpine = Function$ (fun [arity:2]node -> - fun [arity:1]~fromRightChild:((fromRightChild)[@res.namedArgLoc ]) - -> + fun ~fromRightChild:((fromRightChild)[@res.namedArgLoc ]) -> ((let leftSpine = match leftGet node with | None -> heightGet node @@ -471,11 +469,11 @@ include let linearSearch = Function$ (fun [arity:2]rbt -> - fun [arity:1]callback -> + fun callback -> ((let rec find = Function$ (fun [arity:2]node -> - fun [arity:1]callback -> + fun callback -> if Js.Internal.fn_run1 callback (valueGet node) then Some (valueGet node) else @@ -489,9 +487,9 @@ include let rec iterate = Function$ (fun [arity:4]~inclusive:((inclusive)[@res.namedArgLoc ]) -> - fun [arity:3]firstNode -> - fun [arity:2]lastNode -> - fun [arity:1]~callback:((callback)[@res.namedArgLoc ]) -> + fun firstNode -> + fun lastNode -> + fun ~callback:((callback)[@res.namedArgLoc ]) -> match firstNode with | None -> () | Some node -> @@ -506,10 +504,10 @@ include let rec iterateWithY = Function$ (fun [arity:5]?y:((y)[@res.namedArgLoc ]) -> - fun [arity:4]~inclusive:((inclusive)[@res.namedArgLoc ]) -> - fun [arity:3]firstNode -> - fun [arity:2]lastNode -> - fun [arity:1]~callback:((callback)[@res.namedArgLoc ]) -> + fun ~inclusive:((inclusive)[@res.namedArgLoc ]) -> + fun firstNode -> + fun lastNode -> + fun ~callback:((callback)[@res.namedArgLoc ]) -> match firstNode with | None -> () | Some node -> @@ -526,7 +524,7 @@ include let rec updateSum = Function$ (fun [arity:2]node -> - fun [arity:1]~delta:((delta)[@res.namedArgLoc ]) -> + fun ~delta:((delta)[@res.namedArgLoc ]) -> match node with | None -> () | Some node -> @@ -536,8 +534,8 @@ include let setHeight = Function$ (fun [arity:3]rbt -> - fun [arity:2]value -> - fun [arity:1]~height:((height)[@res.namedArgLoc ]) -> + fun value -> + fun ~height:((height)[@res.namedArgLoc ]) -> match _findNode rbt (rootGet rbt) value with | None -> () | Some node -> diff --git a/tests/syntax_tests/data/parsing/recovery/expression/expected/emptyBlock.res.txt b/tests/syntax_tests/data/parsing/recovery/expression/expected/emptyBlock.res.txt index b08fdd7412..fca8935cc9 100644 --- a/tests/syntax_tests/data/parsing/recovery/expression/expected/emptyBlock.res.txt +++ b/tests/syntax_tests/data/parsing/recovery/expression/expected/emptyBlock.res.txt @@ -1,2 +1,2 @@ let x = { } -let f = Function$ (fun [arity:2]a -> fun [arity:1]b -> { }) \ No newline at end of file +let f = Function$ (fun [arity:2]a -> fun b -> { }) \ No newline at end of file