diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f900fc5e8..22b4991961 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -67,6 +67,7 @@ - Remove `@@uncurried.swap`, which was used for internal tests. https://github.com/rescript-lang/rescript-compiler/pull/6875 - Build the compiler libraries/tests in uncurried mode. https://github.com/rescript-lang/rescript-compiler/pull/6864 - Ignore `-uncurried` command-line flag. https://github.com/rescript-lang/rescript-compiler/pull/6885 +- Cleanup: remove tracking of uncurried state in parser/printer. https://github.com/rescript-lang/rescript-compiler/pull/6888 #### :nail_care: Polish diff --git a/jscomp/ext/config.ml b/jscomp/ext/config.ml index 5cf917e78c..3526004ad1 100644 --- a/jscomp/ext/config.ml +++ b/jscomp/ext/config.ml @@ -11,8 +11,6 @@ let bs_only = ref true let unsafe_empty_array = ref false -type uncurried = Legacy | Uncurried - let cmi_magic_number = "Caml1999I022" and ast_impl_magic_number = "Caml1999M022" diff --git a/jscomp/ext/config.mli b/jscomp/ext/config.mli index e74846c06f..ddfef8eba6 100644 --- a/jscomp/ext/config.mli +++ b/jscomp/ext/config.mli @@ -41,5 +41,3 @@ val cmt_magic_number : string (* Magic number for compiled interface files *) val print_config : out_channel -> unit - -type uncurried = Legacy | Uncurried diff --git a/jscomp/frontend/ast_attributes.ml b/jscomp/frontend/ast_attributes.ml index 37ed475b3d..46c1eee697 100644 --- a/jscomp/frontend/ast_attributes.ml +++ b/jscomp/frontend/ast_attributes.ml @@ -74,28 +74,15 @@ let process_method_attributes_rev (attrs : t) = ({st with set = Some result}, acc) | _ -> (st, attr :: acc)) -type attr_kind = - | Nothing - | Meth_callback of attr - | Uncurry of attr - | Method of attr +type attr_kind = Nothing | Meth_callback of attr | Method of attr let process_attributes_rev (attrs : t) : attr_kind * t = Ext_list.fold_left attrs (Nothing, []) (fun (st, acc) (({txt; loc}, _) as attr) -> match (txt, st) with - | "bs", (Nothing | Uncurry _) -> - (Uncurry attr, acc) (* TODO: warn unused/duplicated attribute *) | "this", (Nothing | Meth_callback _) -> (Meth_callback attr, acc) | "meth", (Nothing | Method _) -> (Method attr, acc) - | ("bs" | "this"), _ -> Bs_syntaxerr.err loc Conflict_bs_bs_this_bs_meth - | _, _ -> (st, attr :: acc)) - -let process_bs (attrs : t) = - Ext_list.fold_left attrs (false, []) - (fun (st, acc) (({txt; loc = _}, _) as attr) -> - match (txt, st) with - | "bs", _ -> (true, acc) + | "this", _ -> Bs_syntaxerr.err loc Conflict_bs_bs_this_bs_meth | _, _ -> (st, attr :: acc)) let external_attrs = @@ -287,10 +274,6 @@ let iter_process_bs_string_or_int_as (attrs : Parsetree.attributes) = !st let locg = Location.none -(* let bs : attr - = {txt = "bs" ; loc = locg}, Ast_payload.empty *) - -let res_uapp : attr = ({txt = "res.uapp"; loc = locg}, Ast_payload.empty) let get : attr = ({txt = "get"; loc = locg}, Ast_payload.empty) diff --git a/jscomp/frontend/ast_attributes.mli b/jscomp/frontend/ast_attributes.mli index acfd71f4d9..b38ccc205f 100644 --- a/jscomp/frontend/ast_attributes.mli +++ b/jscomp/frontend/ast_attributes.mli @@ -29,16 +29,10 @@ type ('a, 'b) st = {get: 'a option; set: 'b option} val process_method_attributes_rev : t -> (bool * bool, [`Get | `No_get]) st * t -type attr_kind = - | Nothing - | Meth_callback of attr - | Uncurry of attr - | Method of attr +type attr_kind = Nothing | Meth_callback of attr | Method of attr val process_attributes_rev : t -> attr_kind * t -val process_bs : t -> bool * t - val has_inline_payload : t -> attr option val has_await_payload : t -> attr option @@ -47,7 +41,7 @@ val has_async_payload : t -> attr option type derive_attr = {bs_deriving: Ast_payload.action list option} [@@unboxed] val iter_process_bs_string_int_unwrap_uncurry : - t -> [`Nothing | `String | `Int | `Ignore | `Unwrap | `Uncurry of int option] + t -> [`Nothing | `String | `Int | `Ignore | `Unwrap] val iter_process_bs_string_as : t -> string option @@ -60,9 +54,6 @@ val iter_process_bs_string_or_int_as : t -> as_const_payload option val process_derive_type : t -> derive_attr * t -(* Attribute for uncurried application coming from the ReScript parser *) -val res_uapp : attr - val get : attr val get_index : attr diff --git a/jscomp/frontend/ast_core_type_class_type.ml b/jscomp/frontend/ast_core_type_class_type.ml index 40e87845a7..43df6db179 100644 --- a/jscomp/frontend/ast_core_type_class_type.ml +++ b/jscomp/frontend/ast_core_type_class_type.ml @@ -80,7 +80,6 @@ let typ_mapper (self : Bs_ast_mapper.mapper) (ty : Parsetree.core_type) = ptyp_loc = loc; } -> ( match fst (Ast_attributes.process_attributes_rev ptyp_attributes) with - | Uncurry _ -> Ast_typ_uncurry.to_uncurry_type loc self label args body | Meth_callback _ -> Ast_typ_uncurry.to_method_callback_type loc self label args body | Method _ -> @@ -100,7 +99,6 @@ let typ_mapper (self : Bs_ast_mapper.mapper) (ty : Parsetree.core_type) = let attrs, core_type = match Ast_attributes.process_attributes_rev attrs with | Nothing, attrs -> (attrs, ty) (* #1678 *) - | Uncurry attr, attrs -> (attrs, attr +> ty) | Method _, _ -> Location.raise_errorf ~loc "%@get/set conflicts with %@meth" | Meth_callback attr, attrs -> (attrs, attr +> ty) @@ -111,7 +109,6 @@ let typ_mapper (self : Bs_ast_mapper.mapper) (ty : Parsetree.core_type) = let attrs, core_type = match Ast_attributes.process_attributes_rev attrs with | Nothing, attrs -> (attrs, ty) - | Uncurry attr, attrs -> (attrs, attr +> ty) | Method _, _ -> Location.raise_errorf ~loc "%@get/set conflicts with %@meth" | Meth_callback attr, attrs -> (attrs, attr +> ty) @@ -124,7 +121,6 @@ let typ_mapper (self : Bs_ast_mapper.mapper) (ty : Parsetree.core_type) = let attrs, core_type = match Ast_attributes.process_attributes_rev ptyp_attrs with | Nothing, attrs -> (attrs, ty) - | Uncurry attr, attrs -> (attrs, attr +> ty) | Method attr, attrs -> (attrs, attr +> ty) | Meth_callback attr, attrs -> (attrs, attr +> ty) in diff --git a/jscomp/frontend/ast_exp_apply.ml b/jscomp/frontend/ast_exp_apply.ml index 1368922d78..e8107bbc9b 100644 --- a/jscomp/frontend/ast_exp_apply.ml +++ b/jscomp/frontend/ast_exp_apply.ml @@ -73,7 +73,7 @@ let infix_ops = ["|."; "|.u"; "#="; "##"] let app_exp_mapper (e : exp) (self : Bs_ast_mapper.mapper) : exp = match view_as_app e infix_ops with - | Some {op = ("|." | "|.u") as op; args = [a_; f_]; loc} -> ( + | Some {op = "|." | "|.u"; args = [a_; f_]; loc} -> ( (* a |. f a |. f b c [@bs] --> f a b c [@bs] @@ -81,11 +81,6 @@ let app_exp_mapper (e : exp) (self : Bs_ast_mapper.mapper) : exp = a |. `Variant a |. (b |. f c [@bs]) *) - let add_uncurried_attr attrs = - if op = "|.u" && not (List.mem Ast_attributes.res_uapp attrs) then - Ast_attributes.res_uapp :: attrs - else attrs - in let a = self.expr self a_ in let f = self.expr self f_ in match f.pexp_desc with @@ -98,8 +93,7 @@ let app_exp_mapper (e : exp) (self : Bs_ast_mapper.mapper) : exp = { pexp_desc = Pexp_apply (fn1, (Nolabel, a) :: args); pexp_loc = e.pexp_loc; - pexp_attributes = - add_uncurried_attr (e.pexp_attributes @ f.pexp_attributes); + pexp_attributes = e.pexp_attributes @ f.pexp_attributes; } | Pexp_tuple xs -> bound a (fun bounded_obj_arg -> @@ -119,18 +113,15 @@ let app_exp_mapper (e : exp) (self : Bs_ast_mapper.mapper) : exp = { Parsetree.pexp_desc = Pexp_apply (fn, (Nolabel, bounded_obj_arg) :: args); - pexp_attributes = add_uncurried_attr []; + pexp_attributes = []; pexp_loc = fn.pexp_loc; } | _ -> - Ast_compatible.app1 ~loc:fn.pexp_loc - ~attrs:(add_uncurried_attr []) fn bounded_obj_arg)); + Ast_compatible.app1 ~loc:fn.pexp_loc fn bounded_obj_arg)); pexp_attributes = f.pexp_attributes; pexp_loc = f.pexp_loc; }) - | _ -> - Ast_compatible.app1 ~loc ~attrs:(add_uncurried_attr e.pexp_attributes) f a - ) + | _ -> Ast_compatible.app1 ~loc ~attrs:e.pexp_attributes f a) | Some {op = "##"; loc; args = [obj; rest]} -> ( (* - obj##property - obj#(method a b ) @@ -173,7 +164,7 @@ let app_exp_mapper (e : exp) (self : Bs_ast_mapper.mapper) : exp = let arg = self.expr self arg in let fn = Exp.send ~loc obj {txt = name ^ Literals.setter_suffix; loc} in Exp.constraint_ ~loc - (Exp.apply ~loc ~attrs:[Ast_attributes.res_uapp] fn [(Nolabel, arg)]) + (Exp.apply ~loc fn [(Nolabel, arg)]) (Ast_literal.type_unit ~loc ()) in match obj.pexp_desc with diff --git a/jscomp/frontend/ast_external_process.ml b/jscomp/frontend/ast_external_process.ml index de2919b609..712cf0461b 100644 --- a/jscomp/frontend/ast_external_process.ml +++ b/jscomp/frontend/ast_external_process.ml @@ -66,21 +66,6 @@ let spec_of_ptyp (nolabel : bool) (ptyp : Parsetree.core_type) : Unwrap (* Unwrap attribute can only be attached to things like `[a of a0 | b of b0]` *) | _ -> Bs_syntaxerr.err ptyp.ptyp_loc Invalid_bs_unwrap_type) - | `Uncurry opt_arity -> ( - let real_arity = - if Ast_uncurried.core_type_is_uncurried_fun ptyp then - let arity, _ = Ast_uncurried.core_type_extract_uncurried_fun ptyp in - Some arity - else Ast_core_type.get_uncurry_arity ptyp - in - match (opt_arity, real_arity) with - | Some arity, None -> Fn_uncurry_arity arity - | None, None -> Bs_syntaxerr.err ptyp.ptyp_loc Canot_infer_arity_by_syntax - | None, Some arity -> Fn_uncurry_arity arity - | Some arity, Some n -> - if n <> arity then - Bs_syntaxerr.err ptyp.ptyp_loc (Inconsistent_arity (arity, n)) - else Fn_uncurry_arity arity) | `Nothing -> ( match ptyp_desc with | Ptyp_constr ({txt = Lident "unit"; _}, []) -> diff --git a/jscomp/frontend/bs_ast_invariant.ml b/jscomp/frontend/bs_ast_invariant.ml index 1b562e33d8..c05ca47ba7 100644 --- a/jscomp/frontend/bs_ast_invariant.ml +++ b/jscomp/frontend/bs_ast_invariant.ml @@ -28,8 +28,8 @@ *) let is_bs_attribute txt = match txt with - | "as" | "bs" | "config" | "ignore" | "int" | "optional" | "string" - | "uncurry" | "unwrap" -> + | "as" | "config" | "ignore" | "int" | "optional" | "string" | "uncurry" + | "unwrap" -> true | _ -> false diff --git a/jscomp/frontend/bs_builtin_ppx.ml b/jscomp/frontend/bs_builtin_ppx.ml index eb862230aa..bf9bdb53ad 100644 --- a/jscomp/frontend/bs_builtin_ppx.ml +++ b/jscomp/frontend/bs_builtin_ppx.ml @@ -138,10 +138,6 @@ let expr_mapper ~async_context ~in_function_def (self : mapper) async_context := (old_in_function_def && !async_context) || async; in_function_def := true; Ast_async.make_function_async ~async (default_expr_mapper self e) - | Uncurry _, pexp_attributes -> - async_context := async; - Ast_uncurry_gen.to_uncurry_fn {e with pexp_attributes} self label pat body - async | Method _, _ -> Location.raise_errorf ~loc:e.pexp_loc "%@meth is not supported in function expression" diff --git a/jscomp/ml/typecore.ml b/jscomp/ml/typecore.ml index 16e57a3905..f6fb38c6f5 100644 --- a/jscomp/ml/typecore.ml +++ b/jscomp/ml/typecore.ml @@ -2146,8 +2146,7 @@ and type_expect_ ?type_clash_context ?in_function ?(recarg=Rejected) env sexp ty wrap_trace_gadt_instances env (lower_args env []) ty; begin_def (); let uncurried = - Ext_list.exists sexp.pexp_attributes (fun ({txt },_) -> txt = "res.uapp") - && not @@ Ext_list.exists sexp.pexp_attributes (fun ({txt },_) -> txt = "res.partial") + not @@ Ext_list.exists sexp.pexp_attributes (fun ({txt },_) -> txt = "res.partial") && not @@ is_automatic_curried_application env funct in let type_clash_context = type_clash_context_from_function sexp sfunct in let (args, ty_res, fully_applied) = type_application ?type_clash_context uncurried env funct sargs in diff --git a/jscomp/syntax/src/res_core.ml b/jscomp/syntax/src/res_core.ml index e1d7720717..c2c6702498 100644 --- a/jscomp/syntax/src/res_core.ml +++ b/jscomp/syntax/src/res_core.ml @@ -153,7 +153,6 @@ module InExternal = struct end let jsx_attr = (Location.mknoloc "JSX", Parsetree.PStr []) -let uncurried_app_attr = (Location.mknoloc "res.uapp", Parsetree.PStr []) let ternary_attr = (Location.mknoloc "res.ternary", Parsetree.PStr []) let if_let_attr = (Location.mknoloc "res.iflet", Parsetree.PStr []) let optional_attr = (Location.mknoloc "res.optional", Parsetree.PStr []) @@ -182,14 +181,9 @@ let tagged_template_literal_attr = let spread_attr = (Location.mknoloc "res.spread", Parsetree.PStr []) -type argument = { - dotted: bool; - label: Asttypes.arg_label; - expr: Parsetree.expression; -} +type argument = {label: Asttypes.arg_label; expr: Parsetree.expression} type type_parameter = { - dotted: bool; attrs: Ast_helper.attrs; label: Asttypes.arg_label; typ: Parsetree.core_type; @@ -205,7 +199,6 @@ type typ_def_or_ext = type labelled_parameter = | TermParameter of { - dotted: bool; attrs: Parsetree.attributes; label: Asttypes.arg_label; expr: Parsetree.expression option; @@ -213,7 +206,6 @@ type labelled_parameter = pos: Lexing.position; } | TypeParameter of { - dotted: bool; attrs: Parsetree.attributes; locs: string Location.loc list; pos: Lexing.position; @@ -386,8 +378,7 @@ let build_longident words = let make_infix_operator (p : Parser.t) token start_pos end_pos = let stringified_token = - if token = Token.MinusGreater then - if p.uncurried_config = Legacy then "|." else "|.u" + if token = Token.MinusGreater then "|.u" else if token = Token.PlusPlus then "^" else if token = Token.BangEqual then "<>" else if token = Token.BangEqualEqual then "!=" @@ -519,7 +510,7 @@ let wrap_type_annotation ~loc newtypes core_type body = * return a wrapping function that wraps ((__x) => ...) around an expression * e.g. foo(_, 3) becomes (__x) => foo(__x, 3) *) -let process_underscore_application (p : Parser.t) args = +let process_underscore_application args = let exp_question = ref None in let hidden_var = "__x" in let check_arg ((lab, exp) as arg) = @@ -541,8 +532,7 @@ let process_underscore_application (p : Parser.t) args = ~loc:Location.none in let fun_expr = Ast_helper.Exp.fun_ ~loc Nolabel None pattern exp_apply in - if p.uncurried_config = Legacy then fun_expr - else Ast_uncurried.uncurried_fun ~loc ~arity:1 fun_expr + Ast_uncurried.uncurried_fun ~loc ~arity:1 fun_expr | None -> exp_apply in (args, wrap) @@ -1534,14 +1524,11 @@ and parse_es6_arrow_expression ?(arrow_attrs = []) ?(arrow_start_pos = None) (* Propagate any dots from type parameters to the first term *) let rec loop ~dot_in_type params = match params with - | (TypeParameter {dotted} as p) :: _ -> + | (TypeParameter _ as p) :: _ -> let rest = LoopProgress.list_rest params in (* Tell termination checker about progress *) - p :: loop ~dot_in_type:(dot_in_type || dotted) rest - | TermParameter term_param :: rest -> - TermParameter - {term_param with dotted = dot_in_type || term_param.dotted} - :: rest + p :: loop ~dot_in_type rest + | (TermParameter _ as p) :: rest -> p :: rest | [] -> [] in loop ~dot_in_type:false parameters @@ -1571,58 +1558,22 @@ and parse_es6_arrow_expression ?(arrow_attrs = []) ?(arrow_start_pos = None) | TermParameter _ -> true | TypeParameter _ -> false) in - let body_needs_braces = - let is_fun = - match body.pexp_desc with - | Pexp_fun _ -> true - | _ -> false - in - match term_parameters with - | TermParameter {dotted} :: _ - when p.uncurried_config |> Res_uncurried.from_dotted ~dotted && is_fun -> - true - | TermParameter _ :: rest when p.uncurried_config = Legacy && is_fun -> - rest - |> List.exists (function - | TermParameter {dotted} -> dotted - | _ -> false) - | _ -> false - in - let body = - if body_needs_braces then - { - body with - pexp_attributes = make_braces_attr body.pexp_loc :: body.pexp_attributes; - } - else body - in let _paramNum, arrow_expr, _arity = List.fold_right (fun parameter (term_param_num, expr, arity) -> match parameter with | TermParameter - { - dotted; - attrs; - label = lbl; - expr = default_expr; - pat; - pos = start_pos; - } -> + {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 lbl default_expr pat expr in - let uncurried = - p.uncurried_config |> Res_uncurried.from_dotted ~dotted - in - if uncurried && (term_param_num = 1 || p.uncurried_config = Legacy) - then + if term_param_num = 1 then ( term_param_num - 1, Ast_uncurried.uncurried_fun ~loc ~arity fun_expr, 1 ) else (term_param_num - 1, fun_expr, arity + 1) - | TypeParameter {dotted = _; attrs; locs = newtypes; pos = start_pos} -> + | TypeParameter {attrs; locs = newtypes; pos = start_pos} -> ( term_param_num, make_newtypes ~attrs ~loc:(mk_loc start_pos end_pos) newtypes expr, arity )) @@ -1656,12 +1607,12 @@ and parse_parameter p = || Grammar.is_pattern_start p.token then let start_pos = p.Parser.start_pos in - let dotted = Parser.optional p Token.Dot in + let _ = Parser.optional p Token.Dot (* dot is ignored *) in let attrs = parse_attributes p in if p.Parser.token = Typ then ( Parser.next p; let lidents = parse_lident_list p in - Some (TypeParameter {dotted; attrs; locs = lidents; pos = start_pos})) + Some (TypeParameter {attrs; locs = lidents; pos = start_pos})) else let attrs, lbl, pat = match p.Parser.token with @@ -1735,23 +1686,15 @@ and parse_parameter p = Parser.next p; Some (TermParameter - {dotted; attrs; label = lbl; expr = None; pat; pos = start_pos}) + {attrs; label = lbl; expr = None; pat; pos = start_pos}) | _ -> let expr = parse_constrained_or_coerced_expr p in Some (TermParameter - { - dotted; - attrs; - label = lbl; - expr = Some expr; - pat; - pos = start_pos; - })) + {attrs; label = lbl; expr = Some expr; pat; pos = start_pos})) | _ -> Some - (TermParameter - {dotted; attrs; label = lbl; expr = None; pat; pos = start_pos}) + (TermParameter {attrs; label = lbl; expr = None; pat; pos = start_pos}) else None and parse_parameter_list p = @@ -1778,7 +1721,6 @@ and parse_parameters p = [ TermParameter { - dotted = false; attrs = []; label = Asttypes.Nolabel; expr = None; @@ -1792,7 +1734,6 @@ and parse_parameters p = [ TermParameter { - dotted = false; attrs = []; label = Asttypes.Nolabel; expr = None; @@ -1814,7 +1755,6 @@ and parse_parameters p = [ TermParameter { - dotted = false; attrs = []; label = Asttypes.Nolabel; expr = None; @@ -1836,7 +1776,6 @@ and parse_parameters p = [ TermParameter { - dotted = true; attrs = []; label = Asttypes.Nolabel; expr = None; @@ -1847,9 +1786,9 @@ and parse_parameters p = | _ -> ( match parse_parameter_list p with | TermParameter p :: rest -> - TermParameter {p with dotted = true; pos = start_pos} :: rest + TermParameter {p with pos = start_pos} :: rest | TypeParameter p :: rest -> - TypeParameter {p with dotted = true; pos = start_pos} :: rest + TypeParameter {p with pos = start_pos} :: rest | parameters -> parameters)) | _ -> parse_parameter_list p) | token -> @@ -2257,11 +2196,9 @@ and parse_binary_expr ?(context = OrdinaryExpr) ?a p prec = let loc = mk_loc a.Parsetree.pexp_loc.loc_start b.pexp_loc.loc_end in let expr = match (token, b.pexp_desc) with - | BarGreater, Pexp_apply (fun_expr, args) - when p.uncurried_config = Uncurried -> + | BarGreater, Pexp_apply (fun_expr, args) -> {b with pexp_desc = Pexp_apply (fun_expr, args @ [(Nolabel, a)])} - | BarGreater, _ when p.uncurried_config = Uncurried -> - Ast_helper.Exp.apply ~loc ~attrs:[uncurried_app_attr] b [(Nolabel, a)] + | BarGreater, _ -> Ast_helper.Exp.apply ~loc b [(Nolabel, a)] | _ -> Ast_helper.Exp.apply ~loc (make_infix_operator p token start_pos end_pos) @@ -3039,7 +2976,6 @@ and parse_braced_or_record_expr p = [ TermParameter { - dotted = false; attrs = []; label = Asttypes.Nolabel; expr = None; @@ -3614,7 +3550,6 @@ and parse_argument p : argument option = then match p.Parser.token with | Dot -> ( - let dotted = true in Parser.next p; match p.token with (* apply(.) *) @@ -3624,12 +3559,12 @@ and parse_argument p : argument option = (Location.mknoloc (Longident.Lident "()")) None in - Some {dotted; label = Asttypes.Nolabel; expr = unit_expr} - | _ -> parse_argument2 p ~dotted) - | _ -> parse_argument2 p ~dotted:false + Some {label = Asttypes.Nolabel; expr = unit_expr} + | _ -> parse_argument2 p) + | _ -> parse_argument2 p else None -and parse_argument2 p ~dotted : argument option = +and parse_argument2 p : argument option = match p.Parser.token with (* foo(_), do not confuse with foo(_ => x), TODO: performance *) | Underscore when not (is_es6_arrow_expression ~in_ternary:false p) -> @@ -3638,7 +3573,7 @@ and parse_argument2 p ~dotted : argument option = let expr = Ast_helper.Exp.ident ~loc (Location.mkloc (Longident.Lident "_") loc) in - Some {dotted; label = Nolabel; expr} + Some {label = Nolabel; expr} | Tilde -> ( Parser.next p; (* TODO: nesting of pattern matches not intuitive for error recovery *) @@ -3658,7 +3593,7 @@ and parse_argument2 p ~dotted : argument option = match p.Parser.token with | Question -> Parser.next p; - Some {dotted; label = Optional ident; expr = ident_expr} + Some {label = Optional ident; expr = ident_expr} | Equal -> Parser.next p; let label = @@ -3679,7 +3614,7 @@ and parse_argument2 p ~dotted : argument option = let expr = parse_constrained_or_coerced_expr p in {expr with pexp_attributes = prop_loc_attr :: expr.pexp_attributes} in - Some {dotted; label; expr} + Some {label; expr} | Colon -> Parser.next p; let typ = parse_typ_expr p in @@ -3687,13 +3622,12 @@ and parse_argument2 p ~dotted : argument option = let expr = Ast_helper.Exp.constraint_ ~attrs:[prop_loc_attr] ~loc ident_expr typ in - Some {dotted; label = Labelled ident; expr} - | _ -> Some {dotted; label = Labelled ident; expr = ident_expr}) + Some {label = Labelled ident; expr} + | _ -> Some {label = Labelled ident; expr = ident_expr}) | t -> Parser.err p (Diagnostics.lident t); - Some {dotted; label = Nolabel; expr = Recover.default_expr ()}) - | _ -> - Some {dotted; label = Nolabel; expr = parse_constrained_or_coerced_expr p} + Some {label = Nolabel; expr = Recover.default_expr ()}) + | _ -> Some {label = Nolabel; expr = parse_constrained_or_coerced_expr p} and parse_call_expr p fun_expr = Parser.expect Lparen p; @@ -3722,7 +3656,6 @@ and parse_call_expr p fun_expr = (* No args -> unit sugar: `foo()` *) [ { - dotted = false; label = Nolabel; expr = Ast_helper.Exp.construct ~loc @@ -3732,7 +3665,6 @@ and parse_call_expr p fun_expr = ] | [ { - dotted = true; label = Nolabel; expr = { @@ -3758,7 +3690,6 @@ and parse_call_expr p fun_expr = *) [ { - dotted = true; label = Nolabel; expr = Ast_helper.Exp.let_ Asttypes.Nonrecursive @@ -3776,26 +3707,17 @@ and parse_call_expr p fun_expr = let loc = {fun_expr.pexp_loc with loc_end = p.prev_end_pos} in let args = match args with - | {dotted = d; label = lbl; expr} :: args -> - let group (grp, acc) {dotted; label = lbl; expr} = - let _d, grp = grp in - if dotted == true then ((true, [(lbl, expr)]), (_d, List.rev grp) :: acc) - else ((_d, (lbl, expr) :: grp), acc) - in - let (_d, grp), acc = List.fold_left group ((d, [(lbl, expr)]), []) args in - List.rev ((_d, List.rev grp) :: acc) + | {label = lbl; expr} :: args -> + let group (grp, acc) {label = lbl; expr} = ((lbl, expr) :: grp, acc) in + let grp, acc = List.fold_left group ([(lbl, expr)], []) args in + List.rev (List.rev grp :: acc) | [] -> [] in let apply = - Ext_list.fold_left args fun_expr (fun call_body group -> - let dotted, args = group in - let args, wrap = process_underscore_application p args in + Ext_list.fold_left args fun_expr (fun call_body args -> + let args, wrap = process_underscore_application args in let exp = - let uncurried = - p.uncurried_config |> Res_uncurried.from_dotted ~dotted - in - let attrs = if uncurried then [uncurried_app_attr] else [] in - let attrs = if is_partial then res_partial_attr :: attrs else attrs in + let attrs = if is_partial then [res_partial_attr] else [] in Ast_helper.Exp.apply ~loc ~attrs call_body args in wrap exp) @@ -4064,8 +3986,7 @@ and parse_poly_type_expr p = let t_fun = Ast_helper.Typ.arrow ~loc Asttypes.Nolabel typ return_type in - if p.uncurried_config = Legacy then t_fun - else Ast_uncurried.uncurried_type ~loc ~arity:1 t_fun + Ast_uncurried.uncurried_type ~loc ~arity:1 t_fun | _ -> Ast_helper.Typ.var ~loc:var.loc var.txt) | _ -> assert false) | _ -> parse_typ_expr p @@ -4285,7 +4206,7 @@ and parse_type_parameter p = || Grammar.is_typ_expr_start p.token then let start_pos = p.Parser.start_pos in - let dotted = Parser.optional p Dot in + let _ = Parser.optional p Dot (* dot is ignored *) in let attrs = doc_attr @ parse_attributes p in match p.Parser.token with | Tilde -> ( @@ -4303,8 +4224,8 @@ and parse_type_parameter p = | Equal -> Parser.next p; Parser.expect Question p; - Some {dotted; attrs; label = Optional name; typ; start_pos} - | _ -> Some {dotted; attrs; label = Labelled name; typ; start_pos}) + Some {attrs; label = Optional name; typ; start_pos} + | _ -> Some {attrs; label = Labelled name; typ; start_pos}) | Lident _ -> ( let name, loc = parse_lident p in match p.token with @@ -4322,8 +4243,8 @@ and parse_type_parameter p = | Equal -> Parser.next p; Parser.expect Question p; - Some {dotted; attrs; label = Optional name; typ; start_pos} - | _ -> Some {dotted; attrs; label = Labelled name; typ; start_pos}) + Some {attrs; label = Optional name; typ; start_pos} + | _ -> Some {attrs; label = Labelled name; typ; start_pos}) | _ -> let constr = Location.mkloc (Longident.Lident name) loc in let args = parse_type_constructor_args ~constr_name:constr p in @@ -4335,20 +4256,13 @@ and parse_type_parameter p = let typ = parse_arrow_type_rest ~es6_arrow:true ~start_pos typ p in let typ = parse_type_alias p typ in - Some {dotted; attrs = []; label = Nolabel; typ; start_pos}) + Some {attrs = []; label = Nolabel; typ; start_pos}) | _ -> let typ = parse_typ_expr p in let typ_with_attributes = {typ with ptyp_attributes = List.concat [attrs; typ.ptyp_attributes]} in - Some - { - dotted; - attrs = []; - label = Nolabel; - typ = typ_with_attributes; - start_pos; - } + Some {attrs = []; label = Nolabel; typ = typ_with_attributes; start_pos} else None (* (int, ~x:string, float) *) @@ -4361,7 +4275,7 @@ and parse_type_parameters p = let loc = mk_loc start_pos p.prev_end_pos in let unit_constr = Location.mkloc (Longident.Lident "unit") loc in let typ = Ast_helper.Typ.constr unit_constr [] in - [{dotted = false; attrs = []; label = Nolabel; typ; start_pos}] + [{attrs = []; label = Nolabel; typ; start_pos}] | _ -> let params = parse_comma_delimited_region ~grammar:Grammar.TypeParameters @@ -4402,23 +4316,10 @@ and parse_es6_arrow_type ~attrs p = Parser.expect EqualGreater p; let return_type = parse_typ_expr ~alias:false p in let end_pos = p.prev_end_pos in - let return_type_arity = - match parameters with - | _ when p.uncurried_config <> Legacy -> 0 - | _ -> - if parameters |> List.exists (function {dotted; typ = _} -> dotted) - then 0 - else - let _, args, _ = Res_parsetree_viewer.arrow_type return_type in - List.length args - in + let return_type_arity = 0 in let _paramNum, typ, _arity = List.fold_right - (fun {dotted; attrs; label = arg_lbl; typ; start_pos} - (param_num, t, arity) -> - let uncurried = - p.uncurried_config |> Res_uncurried.from_dotted ~dotted - in + (fun {attrs; label = arg_lbl; typ; start_pos} (param_num, t, arity) -> let loc = mk_loc start_pos end_pos in let arity = (* Workaround for ~lbl: @as(json`false`) _, which changes the arity *) @@ -4437,7 +4338,7 @@ and parse_es6_arrow_type ~attrs p = | _ -> arity in let t_arg = Ast_helper.Typ.arrow ~loc ~attrs arg_lbl typ t in - if uncurried && (param_num = 1 || p.uncurried_config = Legacy) then + if param_num = 1 then (param_num - 1, Ast_uncurried.uncurried_type ~loc ~arity t_arg, 1) else (param_num - 1, t_arg, arity + 1)) parameters @@ -4498,8 +4399,7 @@ and parse_arrow_type_rest ~es6_arrow ~start_pos typ p = let arrow_typ = Ast_helper.Typ.arrow ~loc Asttypes.Nolabel typ return_type in - if p.uncurried_config = Legacy then arrow_typ - else Ast_uncurried.uncurried_type ~loc ~arity:1 arrow_typ + Ast_uncurried.uncurried_type ~loc ~arity:1 arrow_typ | _ -> typ and parse_typ_expr_region p = @@ -5112,12 +5012,10 @@ and parse_type_equation_or_constr_decl p = let arrow_type = Ast_helper.Typ.arrow ~loc Asttypes.Nolabel typ return_type in - let uncurried = p.uncurried_config <> Legacy in let arrow_type = - if uncurried then - Ast_uncurried.uncurried_type ~loc ~arity:1 arrow_type - else arrow_type + Ast_uncurried.uncurried_type ~loc ~arity:1 arrow_type in + let typ = parse_type_alias p arrow_type in (Some typ, Asttypes.Public, Parsetree.Ptype_abstract) | _ -> (Some typ, Asttypes.Public, Parsetree.Ptype_abstract)) @@ -6668,13 +6566,6 @@ and parse_standalone_attribute p = let start_pos = p.start_pos in Parser.expect AtAt p; let attr_id = parse_attribute_id ~start_pos p in - let attr_id = - match attr_id.txt with - | "uncurried" -> - p.uncurried_config <- Config.Uncurried; - attr_id - | _ -> attr_id - in let payload = parse_payload p in (attr_id, payload) diff --git a/jscomp/syntax/src/res_outcome_printer.ml b/jscomp/syntax/src/res_outcome_printer.ml index 1f2f7b5f7a..c7cb533942 100644 --- a/jscomp/syntax/src/res_outcome_printer.ml +++ b/jscomp/syntax/src/res_outcome_printer.ml @@ -155,11 +155,11 @@ let rec print_out_type_doc (out_type : Outcometree.out_type) = ( Oide_dot (Oide_dot (Oide_ident "Js", "Fn"), _), [(Otyp_arrow _ as arrow_type)] ) -> (* Compatibility with compiler up to v10.x *) - print_out_arrow_type ~uncurried:true arrow_type + print_out_arrow_type arrow_type | Otyp_constr (Oide_ident "function$", [(Otyp_arrow _ as arrow_type); _arity]) -> (* function$<(int, int) => int, [#2]> -> (. int, int) => int *) - print_out_arrow_type ~uncurried:true arrow_type + print_out_arrow_type arrow_type | Otyp_constr (Oide_ident "function$", [Otyp_var _; _arity]) -> (* function$<'a, arity> -> _ => _ *) print_out_type_doc (Otyp_stuff "_ => _") @@ -234,7 +234,7 @@ let rec print_out_type_doc (out_type : Outcometree.out_type) = Doc.space; print_out_type_doc out_type; ]) - | Otyp_arrow _ as typ -> print_out_arrow_type ~uncurried:false typ + | Otyp_arrow _ as typ -> print_out_arrow_type typ | Otyp_module (mod_name, string_list, out_types) -> let package_type_doc = match (string_list, out_types) with @@ -266,8 +266,7 @@ let rec print_out_type_doc (out_type : Outcometree.out_type) = Doc.rparen; ] -and print_out_arrow_type ~uncurried typ = - let uncurried = Res_uncurried.get_dotted ~uncurried Uncurried in +and print_out_arrow_type typ = let typ_args, typ = collect_arrow_args typ [] in let args = Doc.join @@ -297,7 +296,6 @@ and print_out_arrow_type ~uncurried typ = let args_doc = let needs_parens = match typ_args with - | _ when uncurried -> true | [ ( _, ( Otyp_tuple _ | Otyp_arrow _ @@ -312,7 +310,7 @@ and print_out_arrow_type ~uncurried typ = Doc.group (Doc.concat [ - (if uncurried then Doc.text "(. " else Doc.lparen); + Doc.lparen; Doc.indent (Doc.concat [Doc.soft_line; args]); Doc.trailing_comma; Doc.soft_line; diff --git a/jscomp/syntax/src/res_parser.ml b/jscomp/syntax/src/res_parser.ml index 9ec5c38463..4354286a7a 100644 --- a/jscomp/syntax/src/res_parser.ml +++ b/jscomp/syntax/src/res_parser.ml @@ -22,7 +22,6 @@ type t = { mutable diagnostics: Diagnostics.t list; mutable comments: Comment.t list; mutable regions: region_status ref list; - mutable uncurried_config: Config.uncurried; } let err ?start_pos ?end_pos p error = @@ -131,7 +130,6 @@ let make ?(mode = ParseForTypeChecker) src filename = diagnostics = []; comments = []; regions = [ref Report]; - uncurried_config = Uncurried; } in parser_state.scanner.err <- @@ -180,7 +178,6 @@ let lookahead p callback = let errors = p.errors in let diagnostics = p.diagnostics in let comments = p.comments in - let uncurried_config = p.uncurried_config in let res = callback p in @@ -199,6 +196,5 @@ let lookahead p callback = p.errors <- errors; p.diagnostics <- diagnostics; p.comments <- comments; - p.uncurried_config <- uncurried_config; res diff --git a/jscomp/syntax/src/res_parser.mli b/jscomp/syntax/src/res_parser.mli index a38f55537f..978cc18bdc 100644 --- a/jscomp/syntax/src/res_parser.mli +++ b/jscomp/syntax/src/res_parser.mli @@ -21,7 +21,6 @@ type t = { mutable diagnostics: Diagnostics.t list; mutable comments: Comment.t list; mutable regions: region_status ref list; - mutable uncurried_config: Config.uncurried; } val make : ?mode:mode -> string -> string -> t diff --git a/jscomp/syntax/src/res_parsetree_viewer.ml b/jscomp/syntax/src/res_parsetree_viewer.ml index 35e02d8725..4b26dc55ec 100644 --- a/jscomp/syntax/src/res_parsetree_viewer.ml +++ b/jscomp/syntax/src/res_parsetree_viewer.ml @@ -48,30 +48,6 @@ let functor_type modtype = in process [] modtype -let process_bs_attribute attrs = - let rec process bs_spotted acc attrs = - match attrs with - | [] -> (bs_spotted, List.rev acc) - | ({Location.txt = "bs"}, _) :: rest -> process true acc rest - | attr :: rest -> process bs_spotted (attr :: acc) rest - in - process false [] attrs - -let process_uncurried_app_attribute attrs = - let rec process uncurried_app acc attrs = - match attrs with - | [] -> (uncurried_app, List.rev acc) - | ( { - Location.txt = - "bs" (* still support @bs to convert .ml files *) | "res.uapp"; - }, - _ ) - :: rest -> - process true acc rest - | attr :: rest -> process uncurried_app (attr :: acc) rest - in - process false [] attrs - let process_partial_app_attribute attrs = let rec process partial_app acc attrs = match attrs with @@ -81,17 +57,12 @@ let process_partial_app_attribute attrs = in process false [] attrs -type function_attributes_info = { - async: bool; - bs: bool; - attributes: Parsetree.attributes; -} +type function_attributes_info = {async: bool; attributes: Parsetree.attributes} let process_function_attributes attrs = let rec process async bs acc attrs = match attrs with - | [] -> {async; bs; attributes = List.rev acc} - | ({Location.txt = "bs"}, _) :: rest -> process async true acc rest + | [] -> {async; attributes = List.rev acc} | ({Location.txt = "res.async"}, _) :: rest -> process true bs acc rest | attr :: rest -> process async bs (attr :: acc) rest in @@ -224,10 +195,9 @@ let filter_parsing_attrs attrs = match attr with | ( { Location.txt = - ( "bs" | "res.uapp" | "res.arity" | "res.braces" | "ns.braces" - | "res.iflet" | "res.namedArgLoc" | "res.optional" | "res.ternary" - | "res.async" | "res.await" | "res.template" - | "res.taggedTemplate" ); + ( "res.arity" | "res.braces" | "ns.braces" | "res.iflet" + | "res.namedArgLoc" | "res.optional" | "res.ternary" | "res.async" + | "res.await" | "res.template" | "res.taggedTemplate" ); }, _ ) -> false @@ -381,9 +351,8 @@ let has_attributes attrs = match attr with | ( { Location.txt = - ( "bs" | "res.uapp" | "res.arity" | "res.braces" | "ns.braces" - | "res.iflet" | "res.ternary" | "res.async" | "res.await" - | "res.template" ); + ( "res.arity" | "res.braces" | "ns.braces" | "res.iflet" + | "res.ternary" | "res.async" | "res.await" | "res.template" ); }, _ ) -> false @@ -566,9 +535,8 @@ let is_printable_attribute attr = match attr with | ( { Location.txt = - ( "bs" | "res.uapp" | "res.arity" | "res.iflet" | "res.braces" - | "ns.braces" | "JSX" | "res.async" | "res.await" | "res.template" - | "res.ternary" ); + ( "res.arity" | "res.iflet" | "res.braces" | "ns.braces" | "JSX" + | "res.async" | "res.await" | "res.template" | "res.ternary" ); }, _ ) -> false diff --git a/jscomp/syntax/src/res_parsetree_viewer.mli b/jscomp/syntax/src/res_parsetree_viewer.mli index d270e05e0e..6661dfc923 100644 --- a/jscomp/syntax/src/res_parsetree_viewer.mli +++ b/jscomp/syntax/src/res_parsetree_viewer.mli @@ -14,20 +14,10 @@ val functor_type : list * Parsetree.module_type -(* filters @bs out of the provided attributes *) -val process_bs_attribute : Parsetree.attributes -> bool * Parsetree.attributes - -val process_uncurried_app_attribute : - Parsetree.attributes -> bool * Parsetree.attributes - val process_partial_app_attribute : Parsetree.attributes -> bool * Parsetree.attributes -type function_attributes_info = { - async: bool; - bs: bool; - attributes: Parsetree.attributes; -} +type function_attributes_info = {async: bool; attributes: Parsetree.attributes} (* determines whether a function is async and/or uncurried based on the given attributes *) val process_function_attributes : diff --git a/jscomp/syntax/src/res_printer.ml b/jscomp/syntax/src/res_printer.ml index eda418fe2d..fbb397f83e 100644 --- a/jscomp/syntax/src/res_printer.ml +++ b/jscomp/syntax/src/res_printer.ml @@ -545,11 +545,11 @@ let print_optional_label attrs = module State = struct let custom_layout_threshold = 2 - type t = {custom_layout: int; mutable uncurried_config: Config.uncurried} + type t = {custom_layout: int} - let init () = {custom_layout = 0; uncurried_config = Uncurried} + let init () = {custom_layout = 0} - let next_custom_layout t = {t with custom_layout = t.custom_layout + 1} + let next_custom_layout t = {custom_layout = t.custom_layout + 1} let should_break_callback t = t.custom_layout > custom_layout_threshold end @@ -1543,18 +1543,10 @@ and print_label_declaration ~state (ld : Parsetree.label_declaration) cmt_tbl = ]) and print_typ_expr ~(state : State.t) (typ_expr : Parsetree.core_type) cmt_tbl = - let print_arrow ~uncurried ?(arity = max_int) typ_expr = + let print_arrow ?(arity = max_int) typ_expr = let attrs_before, args, return_type = ParsetreeViewer.arrow_type ~arity typ_expr in - let dotted, attrs_before = - let dotted = - state.uncurried_config |> Res_uncurried.get_dotted ~uncurried - in - (* Converting .ml code to .res requires processing uncurried attributes *) - let has_bs, attrs = ParsetreeViewer.process_bs_attribute attrs_before in - (dotted || has_bs, attrs) - in let return_type_needs_parens = match return_type.ptyp_desc with | Ptyp_alias _ -> true @@ -1567,7 +1559,7 @@ and print_typ_expr ~(state : State.t) (typ_expr : Parsetree.core_type) cmt_tbl = in match args with | [] -> Doc.nil - | [([], Nolabel, n)] when not dotted -> + | [([], Nolabel, n)] -> let has_attrs_before = not (attrs_before = []) in let attrs = if has_attrs_before then @@ -1609,7 +1601,6 @@ and print_typ_expr ~(state : State.t) (typ_expr : Parsetree.core_type) cmt_tbl = (Doc.concat [ Doc.soft_line; - (if dotted then Doc.concat [Doc.dot; Doc.space] else Doc.nil); Doc.join ~sep:(Doc.concat [Doc.comma; Doc.line]) (List.map @@ -1652,12 +1643,12 @@ and print_typ_expr ~(state : State.t) (typ_expr : Parsetree.core_type) cmt_tbl = (* object printings *) | Ptyp_object (fields, open_flag) -> print_object ~state ~inline:false fields open_flag cmt_tbl - | Ptyp_arrow _ -> print_arrow ~uncurried:false typ_expr + | Ptyp_arrow _ -> print_arrow typ_expr | Ptyp_constr _ when Ast_uncurried.core_type_is_uncurried_fun typ_expr -> let arity, t_arg = Ast_uncurried.core_type_extract_uncurried_fun typ_expr in - print_arrow ~uncurried:true ~arity t_arg + print_arrow ~arity t_arg | Ptyp_constr (longident_loc, [{ptyp_desc = Ptyp_object (fields, open_flag)}]) -> (* for foo<{"a": b}>, when the object is long and needs a line break, we @@ -1903,8 +1894,6 @@ and print_object_field ~state (field : Parsetree.object_field) cmt_tbl = * i.e. ~foo: string, ~bar: float *) and print_type_parameter ~state (attrs, lbl, typ) cmt_tbl = (* Converting .ml code to .res requires processing uncurried attributes *) - let has_bs, attrs = ParsetreeViewer.process_bs_attribute attrs in - let dotted = if has_bs then Doc.concat [Doc.dot; Doc.space] else Doc.nil in let attrs = print_attributes ~state attrs cmt_tbl in let label = match lbl with @@ -1929,13 +1918,7 @@ and print_type_parameter ~state (attrs, lbl, typ) cmt_tbl = let doc = Doc.group (Doc.concat - [ - dotted; - attrs; - label; - print_typ_expr ~state typ cmt_tbl; - optional_indicator; - ]) + [attrs; label; print_typ_expr ~state typ cmt_tbl; optional_indicator]) in print_comments doc cmt_tbl loc @@ -2618,13 +2601,12 @@ and print_if_chain ~state pexp_attributes ifs else_expr cmt_tbl = and print_expression ~state (e : Parsetree.expression) cmt_tbl = let print_arrow e = - let uncurried, attrs_on_arrow, parameters, return_expr = + let _, attrs_on_arrow, parameters, return_expr = ParsetreeViewer.fun_expr e in - let ParsetreeViewer.{async; bs; attributes = attrs} = + let ParsetreeViewer.{async; attributes = attrs} = ParsetreeViewer.process_function_attributes attrs_on_arrow in - let uncurried = uncurried || bs in let return_expr, typ_constraint = match return_expr.pexp_desc with | Pexp_constraint (expr, typ) -> @@ -2642,7 +2624,7 @@ and print_expression ~state (e : Parsetree.expression) cmt_tbl = | None -> false in let parameters_doc = - print_expr_fun_parameters ~state ~in_callback:NoCallback ~uncurried ~async + print_expr_fun_parameters ~state ~in_callback:NoCallback ~async ~has_constraint parameters cmt_tbl in let return_expr_doc = @@ -3376,13 +3358,10 @@ and print_expression ~state (e : Parsetree.expression) cmt_tbl = | _ -> expr_with_await and print_pexp_fun ~state ~in_callback e cmt_tbl = - let uncurried, attrs_on_arrow, parameters, return_expr = - ParsetreeViewer.fun_expr e - in - let ParsetreeViewer.{async; bs; attributes = attrs} = + let _, attrs_on_arrow, parameters, return_expr = ParsetreeViewer.fun_expr e in + let ParsetreeViewer.{async; attributes = attrs} = ParsetreeViewer.process_function_attributes attrs_on_arrow in - let uncurried = bs || uncurried in let return_expr, typ_constraint = match return_expr.pexp_desc with | Pexp_constraint (expr, typ) -> @@ -3395,7 +3374,7 @@ and print_pexp_fun ~state ~in_callback e cmt_tbl = | _ -> (return_expr, None) in let parameters_doc = - print_expr_fun_parameters ~state ~in_callback ~async ~uncurried + print_expr_fun_parameters ~state ~in_callback ~async ~has_constraint: (match typ_constraint with | Some _ -> true @@ -4163,9 +4142,7 @@ and print_pexp_apply ~state expr cmt_tbl = (fun (lbl, arg) -> (lbl, ParsetreeViewer.rewrite_underscore_apply arg)) args in - let uncurried, attrs = - ParsetreeViewer.process_uncurried_app_attribute expr.pexp_attributes - in + let attrs = expr.pexp_attributes in let partial, attrs = ParsetreeViewer.process_partial_app_attribute attrs in let args = if partial then @@ -4173,9 +4150,6 @@ and print_pexp_apply ~state expr cmt_tbl = args @ [(Asttypes.Labelled "...", dummy)] else args in - let dotted = - state.uncurried_config |> Res_uncurried.get_dotted ~uncurried - in let call_expr_doc = let doc = print_expression_with_comments ~state call_expr cmt_tbl in match Parens.call_expr call_expr with @@ -4185,16 +4159,14 @@ and print_pexp_apply ~state expr cmt_tbl = in if ParsetreeViewer.requires_special_callback_printing_first_arg args then let args_doc = - print_arguments_with_callback_in_first_position ~dotted ~state args - cmt_tbl + print_arguments_with_callback_in_first_position ~state args cmt_tbl in Doc.concat [print_attributes ~state attrs cmt_tbl; call_expr_doc; args_doc] else if ParsetreeViewer.requires_special_callback_printing_last_arg args then let args_doc = - print_arguments_with_callback_in_last_position ~state ~dotted args - cmt_tbl + print_arguments_with_callback_in_last_position ~state args cmt_tbl in (* * Fixes the following layout (the `[` and `]` should break): @@ -4221,7 +4193,7 @@ and print_pexp_apply ~state expr cmt_tbl = args_doc; ] else - let args_doc = print_arguments ~state ~dotted ~partial args cmt_tbl in + let args_doc = print_arguments ~state ~partial args cmt_tbl in Doc.concat [print_attributes ~state attrs cmt_tbl; call_expr_doc; args_doc] | _ -> assert false @@ -4557,8 +4529,7 @@ and print_jsx_name {txt = lident} = let segments = flatten [] lident in Doc.join ~sep:Doc.dot segments -and print_arguments_with_callback_in_first_position ~dotted ~state args cmt_tbl - = +and print_arguments_with_callback_in_first_position ~state args cmt_tbl = (* Because the same subtree gets printed twice, we need to copy the cmtTbl. * consumed comments need to be marked not-consumed and reprinted… * Cheng's different comment algorithm will solve this. *) @@ -4602,7 +4573,7 @@ and print_arguments_with_callback_in_first_position ~dotted ~state args cmt_tbl lazy (Doc.concat [ - (if dotted then Doc.text "(. " else Doc.lparen); + Doc.lparen; Lazy.force callback; Doc.comma; Doc.line; @@ -4618,9 +4589,7 @@ and print_arguments_with_callback_in_first_position ~dotted ~state args cmt_tbl * arg3, * ) *) - let break_all_args = - lazy (print_arguments ~state ~dotted args cmt_tbl_copy) - in + let break_all_args = lazy (print_arguments ~state args cmt_tbl_copy) in (* Sometimes one of the non-callback arguments will break. * There might be a single line comment in there, or a multiline string etc. @@ -4643,7 +4612,7 @@ and print_arguments_with_callback_in_first_position ~dotted ~state args cmt_tbl else Doc.custom_layout [Lazy.force fits_on_one_line; Lazy.force break_all_args] -and print_arguments_with_callback_in_last_position ~state ~dotted args cmt_tbl = +and print_arguments_with_callback_in_last_position ~state args cmt_tbl = (* Because the same subtree gets printed twice, we need to copy the cmtTbl. * consumed comments need to be marked not-consumed and reprinted… * Cheng's different comment algorithm will solve this. *) @@ -4692,12 +4661,7 @@ and print_arguments_with_callback_in_last_position ~state ~dotted args cmt_tbl = let fits_on_one_line = lazy (Doc.concat - [ - (if dotted then Doc.text "(." else Doc.lparen); - Lazy.force printed_args; - Lazy.force callback; - Doc.rparen; - ]) + [Doc.lparen; Lazy.force printed_args; Lazy.force callback; Doc.rparen]) in (* Thing.map(longArgumet, veryLooooongArgument, (arg1, arg2) => @@ -4708,7 +4672,7 @@ and print_arguments_with_callback_in_last_position ~state ~dotted args cmt_tbl = lazy (Doc.concat [ - (if dotted then Doc.text "(." else Doc.lparen); + Doc.lparen; Lazy.force printed_args; Doc.breakable_group ~force_break:true (Lazy.force callback2); Doc.rparen; @@ -4722,9 +4686,7 @@ and print_arguments_with_callback_in_last_position ~state ~dotted args cmt_tbl = * (param1, parm2) => doStuff(param1, parm2) * ) *) - let break_all_args = - lazy (print_arguments ~state ~dotted args cmt_tbl_copy2) - in + let break_all_args = lazy (print_arguments ~state args cmt_tbl_copy2) in (* Sometimes one of the non-callback arguments will break. * There might be a single line comment in there, or a multiline string etc. @@ -4752,23 +4714,12 @@ and print_arguments_with_callback_in_last_position ~state ~dotted args cmt_tbl = Lazy.force break_all_args; ] -and print_arguments ~state ~dotted ?(partial = false) +and print_arguments ~state ?(partial = false) (args : (Asttypes.arg_label * Parsetree.expression) list) cmt_tbl = match args with - | [ - ( Nolabel, - { - pexp_desc = Pexp_construct ({txt = Longident.Lident "()"}, _); - pexp_loc = loc; - } ); - ] -> ( - (* See "parseCallExpr", ghost unit expression is used the implement - * arity zero vs arity one syntax. - * Related: https://github.com/rescript-lang/syntax/issues/138 *) - match (dotted, loc.loc_ghost) with - | true, true -> Doc.text "(.)" (* arity zero *) - | true, false -> Doc.text "(. ())" (* arity one *) - | _ -> Doc.text "()") + | [(Nolabel, {pexp_desc = Pexp_construct ({txt = Longident.Lident "()"}, _)})] + -> + Doc.text "()" | [(Nolabel, arg)] when ParsetreeViewer.is_huggable_expression arg -> let arg_doc = let doc = print_expression_with_comments ~state arg cmt_tbl in @@ -4777,17 +4728,16 @@ and print_arguments ~state ~dotted ?(partial = false) | Braced braces -> print_braces doc arg braces | Nothing -> doc in - Doc.concat - [(if dotted then Doc.text "(. " else Doc.lparen); arg_doc; Doc.rparen] + Doc.concat [Doc.lparen; arg_doc; Doc.rparen] | args -> Doc.group (Doc.concat [ - (if dotted then Doc.text "(." else Doc.lparen); + Doc.lparen; Doc.indent (Doc.concat [ - (if dotted then Doc.line else Doc.soft_line); + Doc.soft_line; Doc.join ~sep:(Doc.concat [Doc.comma; Doc.line]) (List.map @@ -4988,9 +4938,8 @@ and print_case ~state (case : Parsetree.case) cmt_tbl = in Doc.group (Doc.concat [Doc.text "| "; content]) -and print_expr_fun_parameters ~state ~in_callback ~async ~uncurried - ~has_constraint parameters cmt_tbl = - let dotted = state.uncurried_config |> Res_uncurried.get_dotted ~uncurried in +and print_expr_fun_parameters ~state ~in_callback ~async ~has_constraint + parameters cmt_tbl = match parameters with (* let f = _ => () *) | [ @@ -5001,8 +4950,7 @@ and print_expr_fun_parameters ~state ~in_callback ~async ~uncurried default_expr = None; pat = {Parsetree.ppat_desc = Ppat_any; ppat_loc}; }; - ] - when not dotted -> + ] -> let any = let doc = if has_constraint then Doc.text "(_)" else Doc.text "_" in print_comments doc cmt_tbl ppat_loc @@ -5021,8 +4969,7 @@ and print_expr_fun_parameters ~state ~in_callback ~async ~uncurried Parsetree.ppat_attributes = attrs; }; }; - ] - when not dotted -> + ] -> let txt_doc = let var = print_ident_like string_loc.txt in let var = @@ -5045,8 +4992,7 @@ and print_expr_fun_parameters ~state ~in_callback ~async ~uncurried pat = {ppat_desc = Ppat_construct ({txt = Longident.Lident "()"; loc}, None)}; }; - ] - when not dotted -> + ] -> let doc = let lparen_rparen = Doc.text "()" in if async then add_async lparen_rparen else lparen_rparen @@ -5060,7 +5006,7 @@ and print_expr_fun_parameters ~state ~in_callback ~async ~uncurried | _ -> false in let maybe_async_lparen = - let lparen = if dotted then Doc.text "(. " else Doc.lparen in + let lparen = Doc.lparen in if async then add_async lparen else lparen in let should_hug = ParsetreeViewer.parameters_should_hug parameters in @@ -5108,8 +5054,6 @@ and print_exp_fun_parameter ~state parameter cmt_tbl = lbls); ]) | Parameter {attrs; lbl; default_expr; pat = pattern} -> - let has_bs, attrs = ParsetreeViewer.process_bs_attribute attrs in - let dotted = if has_bs then Doc.concat [Doc.dot; Doc.space] else Doc.nil in let attrs = print_attributes ~state attrs cmt_tbl in (* =defaultValue *) let default_expr_doc = @@ -5167,13 +5111,7 @@ and print_exp_fun_parameter ~state parameter cmt_tbl = let doc = Doc.group (Doc.concat - [ - dotted; - attrs; - label_with_pattern; - default_expr_doc; - optional_label_suffix; - ]) + [attrs; label_with_pattern; default_expr_doc; optional_label_suffix]) in let cmt_loc = match default_expr with @@ -5557,13 +5495,6 @@ and print_attribute ?(standalone = false) ~state ], Doc.hard_line ) | _ -> - let id = - match id.txt with - | "uncurried" -> - state.uncurried_config <- Config.Uncurried; - id - | _ -> id - in ( Doc.group (Doc.concat [ diff --git a/jscomp/syntax/src/res_uncurried.ml b/jscomp/syntax/src/res_uncurried.ml deleted file mode 100644 index ee52288b11..0000000000 --- a/jscomp/syntax/src/res_uncurried.ml +++ /dev/null @@ -1,9 +0,0 @@ -(* For parsing *) -let from_dotted ~dotted = function - | Config.Legacy -> dotted - | Uncurried -> true - -(* For printing *) -let get_dotted ~uncurried = function - | Config.Legacy -> uncurried - | Uncurried -> false diff --git a/jscomp/syntax/tests/parsing/errors/expressions/expected/array.res.txt b/jscomp/syntax/tests/parsing/errors/expressions/expected/array.res.txt index a58823980b..994def86cf 100644 --- a/jscomp/syntax/tests/parsing/errors/expressions/expected/array.res.txt +++ b/jscomp/syntax/tests/parsing/errors/expressions/expected/array.res.txt @@ -9,5 +9,4 @@ Did you forget a `]` here? let xs = - ((x.map ((Function$ (fun key -> [|key;(predicates.(key))|]))[@res.arity 1])) - [@res.uapp ]) \ No newline at end of file + x.map ((Function$ (fun key -> [|key;(predicates.(key))|]))[@res.arity 1]) \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/errors/expressions/expected/arrow.res.txt b/jscomp/syntax/tests/parsing/errors/expressions/expected/arrow.res.txt index ae1ab77b2d..c365225a62 100644 --- a/jscomp/syntax/tests/parsing/errors/expressions/expected/arrow.res.txt +++ b/jscomp/syntax/tests/parsing/errors/expressions/expected/arrow.res.txt @@ -8,8 +8,8 @@ Did you forget a `,` here? -;;((((Object.keys providers)[@res.uapp ]).reduce - ((Function$ - (fun elements -> - fun providerId -> ((let x = 1 in let b = 2 in x + b) - [@res.braces ])))[@res.arity 2]))[@res.uapp ]) \ No newline at end of file +;;(Object.keys providers).reduce + ((Function$ + (fun elements -> + fun providerId -> ((let x = 1 in let b = 2 in x + b) + [@res.braces ])))[@res.arity 2]) \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/errors/expressions/expected/block.res.txt b/jscomp/syntax/tests/parsing/errors/expressions/expected/block.res.txt index 2c59b4f8f5..61b9256b04 100644 --- a/jscomp/syntax/tests/parsing/errors/expressions/expected/block.res.txt +++ b/jscomp/syntax/tests/parsing/errors/expressions/expected/block.res.txt @@ -82,16 +82,13 @@ let findThreadByIdLinearScan = FBID.ofStringUnsafe in thisId == id) [@res.braces ])))[@res.arity 2])) - [@res.braces ][@res.uapp ]))) + [@res.braces ]))) [@res.arity 2]) -let x = ((loop 0 (Nil |.u ((push doc)[@res.uapp ]))) - [@res.braces ][@res.uapp ]) +let x = ((loop 0 (Nil |.u (push doc)))[@res.braces ]) ;;match stack with | Empty -> [%rescript.exprhole ] | Cons (doc, rest) -> () | Join (doc1, doc2) -> - (buffer |.u ((Buffer.add_string indentation)[@res.uapp ]); - ((loop ()) - [@res.uapp ])) + (buffer |.u (Buffer.add_string indentation); loop ()) let pipeline = match scheduler with | Some -> [%rescript.exprhole ] | None -> () \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/errors/expressions/expected/consecutive.res.txt b/jscomp/syntax/tests/parsing/errors/expressions/expected/consecutive.res.txt index 7e1dc9883e..3dc42f7b39 100644 --- a/jscomp/syntax/tests/parsing/errors/expressions/expected/consecutive.res.txt +++ b/jscomp/syntax/tests/parsing/errors/expressions/expected/consecutive.res.txt @@ -48,7 +48,5 @@ let f = ((Function$ (fun a -> fun b -> a + 3))[@res.arity 2]) ;;b let f = ((Function$ (fun g -> fun h -> ((a + 3; b)[@res.braces ]))) [@res.arity 2]) -let () = ((((sideEffect1 ())[@res.uapp ]); ((sideEffect2 ())[@res.uapp ])) - [@res.braces ]) -let () = ((let open Foo in let exception End in ((x ())[@res.uapp ])) - [@res.braces ]) \ No newline at end of file +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/jscomp/syntax/tests/parsing/errors/expressions/expected/ifLet.res.txt b/jscomp/syntax/tests/parsing/errors/expressions/expected/ifLet.res.txt index f181c2a63f..c76f8aa9e2 100644 --- a/jscomp/syntax/tests/parsing/errors/expressions/expected/ifLet.res.txt +++ b/jscomp/syntax/tests/parsing/errors/expressions/expected/ifLet.res.txt @@ -35,13 +35,12 @@ switch result { | _ => () } +;;((match result with | Some x -> Js.log {js|The sky is blue|js} | _ -> ()) + [@res.iflet ][@warning "-4"]) ;;((match result with - | Some x -> ((Js.log {js|The sky is blue|js})[@res.uapp ]) - | _ -> ())[@res.iflet ][@warning "-4"]) -;;((match result with - | Error x -> ((Js.log {js|The sky is red|js})[@res.uapp ]) + | Error x -> Js.log {js|The sky is red|js} | _ -> (((match result with - | Ok y -> ((Js.log {js|The sky is blue|js})[@res.uapp ]) + | Ok y -> Js.log {js|The sky is blue|js} | _ -> ())) [@res.iflet ][@warning "-4"]))[@res.iflet ][@warning "-4"]) \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/errors/expressions/expected/letBinding.res.txt b/jscomp/syntax/tests/parsing/errors/expressions/expected/letBinding.res.txt index 3299eccd55..941de470ad 100644 --- a/jscomp/syntax/tests/parsing/errors/expressions/expected/letBinding.res.txt +++ b/jscomp/syntax/tests/parsing/errors/expressions/expected/letBinding.res.txt @@ -82,7 +82,7 @@ let foo = 2. let foo = true let foo = 2 -let foo = ((f ())[@res.uapp ]) +let foo = f () let foo = ((2)[@res.braces ]) let foo = (({js|foo|js})[@res.braces ]) let foo as x = () \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/errors/expressions/expected/record.res.txt b/jscomp/syntax/tests/parsing/errors/expressions/expected/record.res.txt index 5ed6f40760..6939140b09 100644 --- a/jscomp/syntax/tests/parsing/errors/expressions/expected/record.res.txt +++ b/jscomp/syntax/tests/parsing/errors/expressions/expected/record.res.txt @@ -48,8 +48,7 @@ Missing expression -let newWrapper = { updateF; value = ((f xWrapper.currentValue)[@res.uapp ]) } -let newWrapper = - { updateF; updateF2; value = ((f xWrapper.currentValue)[@res.uapp ]) } +let newWrapper = { updateF; value = (f xWrapper.currentValue) } +let newWrapper = { updateF; updateF2; value = (f xWrapper.currentValue) } let record = { field = ([%rescript.exprhole ]) } let record = { field = 2 } \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/errors/expressions/expected/setField.res.txt b/jscomp/syntax/tests/parsing/errors/expressions/expected/setField.res.txt index 8f961889a4..12f3225d1a 100644 --- a/jscomp/syntax/tests/parsing/errors/expressions/expected/setField.res.txt +++ b/jscomp/syntax/tests/parsing/errors/expressions/expected/setField.res.txt @@ -13,4 +13,4 @@ ;;if match then let a = 1 in (m.left).compatibleTypeArgs <- ([%rescript.exprhole ]) - else ((sideEffect ())[@res.uapp ]) \ No newline at end of file + else sideEffect () \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/errors/expressions/expected/try.res.txt b/jscomp/syntax/tests/parsing/errors/expressions/expected/try.res.txt index 7f72c70373..1e024f9432 100644 --- a/jscomp/syntax/tests/parsing/errors/expressions/expected/try.res.txt +++ b/jscomp/syntax/tests/parsing/errors/expressions/expected/try.res.txt @@ -9,5 +9,4 @@ Did you forget a `catch` here? -let parsedPayload = - try ((Js.Json.parseExn response)[@res.uapp ]) with | _ -> Js.Json.null \ No newline at end of file +let parsedPayload = try Js.Json.parseExn response with | _ -> Js.Json.null \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/errors/other/expected/breadcrumbs170.res.txt b/jscomp/syntax/tests/parsing/errors/other/expected/breadcrumbs170.res.txt index b10a36d330..a70bbe5f19 100644 --- a/jscomp/syntax/tests/parsing/errors/other/expected/breadcrumbs170.res.txt +++ b/jscomp/syntax/tests/parsing/errors/other/expected/breadcrumbs170.res.txt @@ -10,7 +10,7 @@ I'm not sure what to parse here when looking at "}". -let l = ((Obj.magic (Some [1; 2; 3]))[@res.uapp ]) +let l = Obj.magic (Some [1; 2; 3]) module M = struct ;;match l with | None -> [] | Some l -> l#prop end ;;from ;;now diff --git a/jscomp/syntax/tests/parsing/errors/pattern/expected/missing.res.txt b/jscomp/syntax/tests/parsing/errors/pattern/expected/missing.res.txt index d04809deb3..a6a10a2c50 100644 --- a/jscomp/syntax/tests/parsing/errors/pattern/expected/missing.res.txt +++ b/jscomp/syntax/tests/parsing/errors/pattern/expected/missing.res.txt @@ -44,9 +44,5 @@ I was expecting a pattern to match on before the `=>` let 2 = [%rescript.exprhole ] -let 4 = - for [%rescript.patternhole ] = 0 to 10 do - ((Js.log {js|for|js}) - [@res.uapp ]) - done +let 4 = for [%rescript.patternhole ] = 0 to 10 do Js.log {js|for|js} done ;;match x with | () -> [%rescript.exprhole ] \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/errors/structure/expected/gh16A.res.txt b/jscomp/syntax/tests/parsing/errors/structure/expected/gh16A.res.txt index d64de4d685..4e8d983a56 100644 --- a/jscomp/syntax/tests/parsing/errors/structure/expected/gh16A.res.txt +++ b/jscomp/syntax/tests/parsing/errors/structure/expected/gh16A.res.txt @@ -10,8 +10,5 @@ I'm not sure what to parse here when looking at ")". -module C = - struct - module T = (Fun)(struct ;;((foo (a + c) (b + d))[@res.uapp ]) end) - end -;;((Js.log {js|test|js})[@res.uapp ]) \ No newline at end of file +module C = struct module T = (Fun)(struct ;;foo (a + c) (b + d) end) end +;;Js.log {js|test|js} \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/errors/structure/expected/gh16B.res.txt b/jscomp/syntax/tests/parsing/errors/structure/expected/gh16B.res.txt index 6c3b404fe0..89f23fed1a 100644 --- a/jscomp/syntax/tests/parsing/errors/structure/expected/gh16B.res.txt +++ b/jscomp/syntax/tests/parsing/errors/structure/expected/gh16B.res.txt @@ -12,25 +12,22 @@ I'm not sure what to parse here when looking at ")". open Ws -let wss = ((Server.make { port = 82 })[@res.uapp ]) +let wss = Server.make { port = 82 } let address = wss |.u Server.address let log = ((Function$ (fun msg -> - ((Js.log - (((((({js|> Server: |js})[@res.template ]) ^ msg) - [@res.template ]) ^ (({js||js})[@res.template ])) - [@res.template ])) - [@res.uapp ]))) + Js.log + (((((({js|> Server: |js})[@res.template ]) ^ msg)[@res.template ]) + ^ (({js||js})[@res.template ]))[@res.template ]))) [@res.arity 1]) -;;((log - (((((((((((((({js|Running on: |js})[@res.template ]) ^ address.address) - [@res.template ]) ^ (({js|:|js})[@res.template ])) - [@res.template ]) ^ (address.port |.u string_of_int)) - [@res.template ]) ^ (({js| (|js})[@res.template ])) - [@res.template ]) ^ address.family) - [@res.template ]) ^ (({js|)|js})[@res.template ]))[@res.template ])) - [@res.uapp ]) +;;log + (((((((((((((({js|Running on: |js})[@res.template ]) ^ address.address) + [@res.template ]) ^ (({js|:|js})[@res.template ])) + [@res.template ]) ^ (address.port |.u string_of_int)) + [@res.template ]) ^ (({js| (|js})[@res.template ])) + [@res.template ]) ^ address.family) + [@res.template ]) ^ (({js|)|js})[@res.template ]))[@res.template ]) module ClientSet = struct module T = @@ -43,10 +40,9 @@ module ClientSet = ((compare (a |.u Client.getUniqueId) (b |.u Client.getUniqueId)) - [@res.braces ][@res.uapp ]))) + [@res.braces ]))) [@res.arity 2]) end) - let empty = ((Belt.Set.make ~id:(((module T))[@res.namedArgLoc ])) - [@res.uapp ]) + let empty = Belt.Set.make ~id:(((module T))[@res.namedArgLoc ]) end -;;((Js.log {js|test|js})[@res.uapp ]) \ No newline at end of file +;;Js.log {js|test|js} \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/errors/structure/expected/letBinding.res.txt b/jscomp/syntax/tests/parsing/errors/structure/expected/letBinding.res.txt index e54db10b9f..8cb325956f 100644 --- a/jscomp/syntax/tests/parsing/errors/structure/expected/letBinding.res.txt +++ b/jscomp/syntax/tests/parsing/errors/structure/expected/letBinding.res.txt @@ -98,10 +98,9 @@ Did you forget a `=` here? let rightResource = - (((ur.resources).find - ((Function$ (fun r -> r.account_id == ((connection.left).account).id)) - [@res.arity 1])) - [@res.uapp ]) + (ur.resources).find + ((Function$ (fun r -> r.account_id == ((connection.left).account).id)) + [@res.arity 1]) let x = ((let field = p |.u parseFieldDeclaration in field)[@res.braces ]) let t = ((let (_, _, token) = scanner |.u scan in token)[@res.braces ]) let (keyTable : int Belt.Map.String.t) = [%rescript.exprhole ] diff --git a/jscomp/syntax/tests/parsing/errors/typeDef/expected/inlineRecord.res.txt b/jscomp/syntax/tests/parsing/errors/typeDef/expected/inlineRecord.res.txt index dd01bd803d..4af79d85ff 100644 --- a/jscomp/syntax/tests/parsing/errors/typeDef/expected/inlineRecord.res.txt +++ b/jscomp/syntax/tests/parsing/errors/typeDef/expected/inlineRecord.res.txt @@ -50,5 +50,5 @@ let make = < handleClick: (Click.t -> unit, [ `Has_arity1 ]) function$ ; value: string > ) - -> ((render props)[@res.uapp ]))) + -> render props)) [@res.arity 1]) \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/expected/UncurriedAlways.res.txt b/jscomp/syntax/tests/parsing/grammar/expressions/expected/UncurriedAlways.res.txt index da666964db..ffd40ac996 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/expected/UncurriedAlways.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/expressions/expected/UncurriedAlways.res.txt @@ -1,7 +1,7 @@ [@@@uncurried ] let foo = ((Function$ (fun x -> fun y -> x + y))[@res.arity 2]) -let z = ((foo 3 4)[@res.uapp ]) +let z = foo 3 4 let bar = ((Function$ (fun x -> fun y -> x + y))[@res.arity 2]) -let b = ((bar 3 4)[@res.uapp ]) -let w = 3 |.u ((foo 4)[@res.uapp ]) -let a = 3 |.u ((foo 4)[@res.uapp ]) \ No newline at end of file +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/jscomp/syntax/tests/parsing/grammar/expressions/expected/UncurriedByDefault.res.txt b/jscomp/syntax/tests/parsing/grammar/expressions/expected/UncurriedByDefault.res.txt index de6bcce8eb..ee062011ea 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/expected/UncurriedByDefault.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/expressions/expected/UncurriedByDefault.res.txt @@ -1,5 +1,5 @@ -let cApp = ((foo 3)[@res.uapp ]) -let uApp = ((foo 3)[@res.uapp ]) +let cApp = foo 3 +let uApp = foo 3 let cFun = ((Function$ (fun x -> 3))[@res.arity 1]) let uFun = ((Function$ (fun x -> 3))[@res.arity 1]) let mixFun = @@ -77,12 +77,10 @@ let (uannpoly : ('a -> string, [ `Has_arity1 ]) function$) = xx let (uannint : (int -> string, [ `Has_arity1 ]) function$) = xx let _ = ((Function$ ((fun x -> 34)[@att ]))[@res.arity 1]) let _ = ((Function$ ((fun x -> 34)[@res.async ][@att ]))[@res.arity 1]) -let _ = ((preserveAttr ((Function$ ((fun x -> 34)[@att ]))[@res.arity 1])) - [@res.uapp ]) +let _ = preserveAttr ((Function$ ((fun x -> 34)[@att ]))[@res.arity 1]) let _ = - ((preserveAttr ((Function$ ((fun x -> 34)[@res.async ][@att ])) - [@res.arity 1])) - [@res.uapp ]) + preserveAttr ((Function$ ((fun x -> 34)[@res.async ][@att ])) + [@res.arity 1]) let t0 (type a) (type b) = ((Function$ (fun (l : a list) -> fun (x : a) -> x :: l))[@res.arity 2]) let t1 (type a) (type b) = @@ -107,8 +105,8 @@ type nonrec callback2 = (ReactEvent.Mouse.t -> unit as 'u, [ `Has_arity1 ]) function$ type nonrec callback3 = (ReactEvent.Mouse.t -> unit, [ `Has_arity1 ]) function$ as 'callback -let cApp = ((foo 3)[@res.uapp ]) -let uApp = ((foo 3)[@res.uapp ]) +let cApp = foo 3 +let uApp = foo 3 let cFun = ((Function$ (fun x -> 3))[@res.arity 1]) let uFun = ((Function$ (fun x -> 3))[@res.arity 1]) let mixFun = @@ -194,12 +192,10 @@ let (uannpoly : ('a -> string, [ `Has_arity1 ]) function$) = xx let (uannint : (int -> string, [ `Has_arity1 ]) function$) = xx let _ = ((Function$ ((fun x -> 34)[@att ]))[@res.arity 1]) let _ = ((Function$ ((fun x -> 34)[@res.async ][@att ]))[@res.arity 1]) -let _ = ((preserveAttr ((Function$ ((fun x -> 34)[@att ]))[@res.arity 1])) - [@res.uapp ]) +let _ = preserveAttr ((Function$ ((fun x -> 34)[@att ]))[@res.arity 1]) let _ = - ((preserveAttr ((Function$ ((fun x -> 34)[@res.async ][@att ])) - [@res.arity 1])) - [@res.uapp ]) + preserveAttr ((Function$ ((fun x -> 34)[@res.async ][@att ])) + [@res.arity 1]) let t0 (type a) (type b) = ((Function$ (fun (l : a list) -> fun (x : a) -> x :: l))[@res.arity 2]) let t1 (type a) (type b) = diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/expected/apply.res.txt b/jscomp/syntax/tests/parsing/grammar/expressions/expected/apply.res.txt index 1d9662ef6f..7170c39226 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/expected/apply.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/expressions/expected/apply.res.txt @@ -1,12 +1,10 @@ -;;((foo ((Function$ (fun _ -> bla))[@res.arity 1]) blaz)[@res.uapp ]) -;;((foo ((Function$ (fun _ -> bla))[@res.arity 1]) blaz)[@res.uapp ]) -;;((foo ((Function$ (fun _ -> bla))[@res.arity 1]) blaz)[@res.uapp ]) -;;((foo ((Function$ (fun _ -> bla))[@res.arity 1]) - ((Function$ (fun _ -> blaz))[@res.arity 1]))[@res.uapp ]) -;;((List.map ((Function$ (fun x -> x + 1))[@res.arity 1]) myList) - [@res.uapp ]) -;;((List.reduce ((Function$ (fun acc -> fun curr -> acc + curr)) - [@res.arity 2]) 0 myList)[@res.uapp ]) -let unitUncurried = ((apply ())[@res.uapp ]) -;;((call ~a:(((((a)[@res.namedArgLoc ]) : int))[@res.namedArgLoc ])) - [@res.uapp ]) \ No newline at end of file +;;foo ((Function$ (fun _ -> bla))[@res.arity 1]) blaz +;;foo ((Function$ (fun _ -> bla))[@res.arity 1]) blaz +;;foo ((Function$ (fun _ -> bla))[@res.arity 1]) blaz +;;foo ((Function$ (fun _ -> bla))[@res.arity 1]) ((Function$ (fun _ -> blaz)) + [@res.arity 1]) +;;List.map ((Function$ (fun x -> x + 1))[@res.arity 1]) myList +;;List.reduce ((Function$ (fun acc -> fun curr -> acc + curr))[@res.arity 2]) + 0 myList +let unitUncurried = apply () +;;call ~a:(((((a)[@res.namedArgLoc ]) : int))[@res.namedArgLoc ]) \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/expected/argument.res.txt b/jscomp/syntax/tests/parsing/grammar/expressions/expected/argument.res.txt index 854cde12a1..a8e3f5e200 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/expected/argument.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/expressions/expected/argument.res.txt @@ -1,18 +1,15 @@ let foo = ((Function$ (fun ~a:((a)[@res.namedArgLoc ]) -> - ((a (let __res_unit = () in __res_unit))[@res.uapp ]) +. 1.)) + (a (let __res_unit = () in __res_unit)) +. 1.)) [@res.arity 1]) let a = ((Function$ (fun () -> 2))[@res.arity 1]) -let bar = ((foo ~a:((a)[@res.namedArgLoc ]))[@res.uapp ]) +let bar = foo ~a:((a)[@res.namedArgLoc ]) let comparisonResult = - ((compare currentNode.value ~targetValue:((targetValue)[@res.namedArgLoc ])) - [@res.uapp ]) -;;((callback firstNode ~y:((y)[@res.namedArgLoc ]))[@res.uapp ]) -;;((document.createElementWithOptions {js|div|js} - ((elementProps - ~onClick:((Function$ - (fun _ -> ((Js.log {js|hello world|js})[@res.uapp ]))) - [@res.namedArgLoc ][@res.arity 1]))[@res.uapp ]))[@res.uapp ]) -;;((resolve ())[@res.uapp ]) -;;((resolve (let __res_unit = () in __res_unit))[@res.uapp ]) \ No newline at end of file + compare currentNode.value ~targetValue:((targetValue)[@res.namedArgLoc ]) +;;callback firstNode ~y:((y)[@res.namedArgLoc ]) +;;document.createElementWithOptions {js|div|js} + (elementProps ~onClick:((Function$ (fun _ -> Js.log {js|hello world|js})) + [@res.namedArgLoc ][@res.arity 1])) +;;resolve () +;;resolve (let __res_unit = () in __res_unit) \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/expected/arrow.res.txt b/jscomp/syntax/tests/parsing/grammar/expressions/expected/arrow.res.txt index 8c09e9dcd7..9dfddce397 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/expected/arrow.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/expressions/expected/arrow.res.txt @@ -1,11 +1,7 @@ let f = ((Function$ (fun x -> x + 1))[@res.arity 1]) -let f = ((Function$ (fun _ -> ((Js.log {js|test|js})[@res.uapp ]))) - [@res.arity 1]) -let f = ((Function$ (fun () -> ((Js.log {js|unit|js})[@res.uapp ]))) - [@res.arity 1]) -let f = - ((Function$ - (fun (Reducer (inst, comp)) -> ((inst.render comp)[@res.uapp ]))) +let f = ((Function$ (fun _ -> Js.log {js|test|js}))[@res.arity 1]) +let f = ((Function$ (fun () -> Js.log {js|unit|js}))[@res.arity 1]) +let f = ((Function$ (fun (Reducer (inst, comp)) -> inst.render comp)) [@res.arity 1]) let f = ((Function$ (fun (Instance) -> ()))[@res.arity 1]) let f = ((Function$ (fun a -> fun b -> a + b))[@res.arity 2]) @@ -101,43 +97,38 @@ let f = fun ~c:((c)[@res.namedArgLoc ][@attr ]) -> fun ((d)[@attrOnD ]) -> ())) [@res.arity 4]) -let f = ((Function$ (fun list -> ((list ())[@res.uapp ])))[@res.arity 1]) +let f = ((Function$ (fun list -> list ()))[@res.arity 1]) ;;match colour with | Red when (l = l') || (Clflags.classic.contents && - ((l = Nolabel) && (not ((is_optional l')[@res.uapp ])))) + ((l = Nolabel) && (not (is_optional l')))) -> (t1, t2) | _ -> () let arr = - [|((Function$ ((fun _ -> ((doThings ())[@res.uapp ])))) - [@res.arity 1]);((Function$ ((fun _ -> ((doThings ())[@res.uapp ])))) - [@res.arity 1]);((Function$ ((fun _ -> ((doThings ())[@res.uapp ])))) - [@res.arity 1])|] + [|((Function$ ((fun _ -> doThings ()))) + [@res.arity 1]);((Function$ ((fun _ -> doThings ()))) + [@res.arity 1]);((Function$ ((fun _ -> doThings ())))[@res.arity 1])|] let list = - [((Function$ ((fun _ -> ((doThings ())[@res.uapp ])))) + [((Function$ ((fun _ -> doThings ()))) [@res.arity 1]); - ((Function$ ((fun _ -> ((doThings ())[@res.uapp ])))) + ((Function$ ((fun _ -> doThings ()))) [@res.arity 1]); - ((Function$ ((fun _ -> ((doThings ())[@res.uapp ])))) + ((Function$ ((fun _ -> doThings ()))) [@res.arity 1])] let tuple = - (((Function$ (fun _ -> ((doThings ())[@res.uapp ])))[@res.arity 1]), - ((Function$ (fun _ -> ((doThings ())[@res.uapp ])))[@res.arity 1]), - ((Function$ (fun _ -> ((doThings ())[@res.uapp ])))[@res.arity 1])) -;;((Function$ (fun _ -> ((doThings ())[@res.uapp ])))[@res.arity 1]) + (((Function$ (fun _ -> doThings ()))[@res.arity 1]), + ((Function$ (fun _ -> doThings ()))[@res.arity 1]), + ((Function$ (fun _ -> doThings ()))[@res.arity 1])) +;;((Function$ (fun _ -> doThings ()))[@res.arity 1]) let x = Constructore - (((Function$ (fun _ -> ((copyChecklistItemCB ())[@res.uapp ]))) - [@res.arity 1]), - ((Function$ (fun _ -> ((copyChecklistItemCB ())[@res.uapp ]))) - [@res.arity 1])) + (((Function$ (fun _ -> copyChecklistItemCB ()))[@res.arity 1]), + ((Function$ (fun _ -> copyChecklistItemCB ()))[@res.arity 1])) let y = `Constructore - (((Function$ (fun _ -> ((copyChecklistItemCB ())[@res.uapp ]))) - [@res.arity 1]), - ((Function$ (fun _ -> ((copyChecklistItemCB ())[@res.uapp ]))) - [@res.arity 1])) + (((Function$ (fun _ -> copyChecklistItemCB ()))[@res.arity 1]), + ((Function$ (fun _ -> copyChecklistItemCB ()))[@res.arity 1])) let f = ((Function$ (fun list -> list + 1))[@res.arity 1]) let foo = (() : unit) type nonrec u = unit @@ -146,4 +137,4 @@ type nonrec ('a, 'b) d = ('a * 'b) let c = ((Function$ (fun () -> ((1, 2) : ('a, 'b) d)))[@res.arity 1]) let fn = ((Function$ (fun f -> f))[@res.arity 1]) type nonrec f = (int -> unit, [ `Has_arity1 ]) function$ -let a = ((fn (((Function$ (fun _ -> ()))[@res.arity 1]) : f))[@res.uapp ]) \ No newline at end of file +let a = fn (((Function$ (fun _ -> ()))[@res.arity 1]) : f) \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/expected/async.res.txt b/jscomp/syntax/tests/parsing/grammar/expressions/expected/async.res.txt index cbdc5ae9ff..5bc1666203 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/expected/async.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/expressions/expected/async.res.txt @@ -1,34 +1,28 @@ let greetUser = ((Function$ ((fun userId -> - ((let name = ((getUserName userId)[@res.await ][@res.uapp ]) in + ((let name = ((getUserName userId)[@res.await ]) in ({js|Hello |js} ^ name) ^ {js|!|js}) [@res.braces ])) [@res.async ])) [@res.arity 1]) ;;((Function$ ((fun () -> 123)[@res.async ]))[@res.arity 1]) -let fetch = - ((Function$ ((fun url -> ((browserFetch url)[@res.uapp ]))[@res.async ])) +let fetch = ((Function$ ((fun url -> browserFetch url)[@res.async ])) [@res.braces ][@res.arity 1]) let fetch2 = - ((((Function$ (((fun url -> ((browserFetch url)[@res.uapp ]))) - [@res.async ])) + ((((Function$ (((fun url -> browserFetch url))[@res.async ])) [@res.arity 1]); - ((Function$ (((fun url -> ((browserFetch2 url)[@res.uapp ]))) - [@res.async ])) + ((Function$ (((fun url -> browserFetch2 url))[@res.async ])) [@res.arity 1])) [@res.braces ]) let async = - ((let f = ((async ())[@res.uapp ]) in + ((let f = async () in () |.u async; - ((async ()) - [@res.uapp ]); + async (); async.async; { async = (async.(async)) }; (result |.u async) |.u - ((mapAsync ((Function$ (fun a -> ((doStuff a)[@res.uapp ]))) - [@res.arity 1])) - [@res.uapp ])) + (mapAsync ((Function$ (fun a -> doStuff a))[@res.arity 1]))) [@res.braces ]) let f = ((if isPositive @@ -37,12 +31,11 @@ let f = else ((Function$ (((fun c -> fun d -> (c - d : int)))[@res.async ])) [@res.arity 2])) [@res.ternary ]) -let foo = ((async ~a:((34)[@res.namedArgLoc ]))[@res.uapp ]) +let foo = async ~a:((34)[@res.namedArgLoc ]) let bar = ((Function$ ((fun ~a:((a)[@res.namedArgLoc ]) -> a + 1)[@res.async ])) [@res.arity 1]) let ex1 = ((3)[@res.await ]) + ((4)[@res.await ]) let ex2 = ((3)[@res.await ]) ** ((4)[@res.await ]) -let ex3 = ((foo |.u ((bar ~arg:((arg)[@res.namedArgLoc ]))[@res.uapp ])) - [@res.await ]) +let ex3 = ((foo |.u (bar ~arg:((arg)[@res.namedArgLoc ])))[@res.await ]) let ex4 = (((foo.bar).baz)[@res.await ]) \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/expected/await.res.txt b/jscomp/syntax/tests/parsing/grammar/expressions/expected/await.res.txt index dd69f8243d..3ccb4c9d5e 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/expected/await.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/expressions/expected/await.res.txt @@ -1,25 +1,20 @@ -;;((wait 2)[@res.await ][@res.uapp ]) +;;((wait 2)[@res.await ]) let maybeSomeValue = - match ((fetchData url)[@res.await ][@res.uapp ]) with + match ((fetchData url)[@res.await ]) with | data -> Some data | exception JsError _ -> None let x = ((1)[@res.await ]) + 2 -let x = - ((wait 1)[@res.await ][@res.uapp ]) + ((wait 2)[@res.await ][@res.uapp ]) +let x = ((wait 1)[@res.await ]) + ((wait 2)[@res.await ]) let () = - ((let response = ((fetch {js|/users.json|js})[@res.await ][@res.uapp ]) in - let users = ((response.json ())[@res.await ][@res.uapp ]) in + ((let response = ((fetch {js|/users.json|js})[@res.await ]) in + let users = ((response.json ())[@res.await ]) in let comments = - ((((fetch {js|comment.json|js})[@res.await ][@res.uapp ]).json ()) - [@res.await ][@res.uapp ]).(0) in - ((Js.log2 users comments)[@res.uapp ])) + ((((fetch {js|comment.json|js})[@res.await ]).json ()) + [@res.await ]).(0) in + Js.log2 users comments) [@res.braces ]) -let () = ((delay 10)[@res.braces ][@res.await ][@res.uapp ]) -let () = - ((((delay 10) - [@res.await ][@res.uapp ]); - ((delay 20) - [@res.await ][@res.uapp ])) +let () = ((delay 10)[@res.braces ][@res.await ]) +let () = ((((delay 10)[@res.await ]); ((delay 20)[@res.await ])) [@res.braces ]) let forEach = ((Js.Import Belt.List.forEach)[@res.await ][@a ][@b ]) module M = ((Belt.List)[@res.await ][@a ][@b ]) diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/expected/binary.res.txt b/jscomp/syntax/tests/parsing/grammar/expressions/expected/binary.res.txt index d3c92c8505..9f2306aa06 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/expected/binary.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/expressions/expected/binary.res.txt @@ -1,27 +1,16 @@ -;;node := - (if newBalance == 2 - then avl |.u ((rotateRight node)[@res.uapp ]) - else node) -;;node := - ((if newBalance == 2 - then avl |.u ((rotateRight node)[@res.uapp ]) - else node) +;;node := (if newBalance == 2 then avl |.u (rotateRight node) else node) +;;node := ((if newBalance == 2 then avl |.u (rotateRight node) else node) [@attr ]) -let x = (((match z with | _ -> false) z)[@res.uapp ]) -let x = ((((match z with | _ -> false)[@attr ]) z)[@res.uapp ]) -let x = (((assert z) z)[@res.uapp ]) -let x = ((((assert z)[@attr ]) z)[@res.uapp ]) -let x = - (((try ((sideEffect ())[@res.uapp ]) with | _ -> ((f ())[@res.uapp ])) z) - [@res.uapp ]) -let x = - ((((try ((sideEffect ())[@res.uapp ]) with | _ -> ((f ())[@res.uapp ])) - [@attr ]) z) - [@res.uapp ]) -let x = ((for i = 0 to 10 do () done z)[@res.uapp ]) -let x = ((((for i = 0 to 10 do () done)[@attr ]) z)[@res.uapp ]) -let x = ((while condition do () done z)[@res.uapp ]) -let x = ((((while condition do () done)[@attr ]) z)[@res.uapp ]) +let x = (match z with | _ -> false) z +let x = ((match z with | _ -> false)[@attr ]) z +let x = (assert z) z +let x = ((assert z)[@attr ]) z +let x = (try sideEffect () with | _ -> f ()) z +let x = ((try sideEffect () with | _ -> f ())[@attr ]) z +let x = for i = 0 to 10 do () done z +let x = ((for i = 0 to 10 do () done)[@attr ]) z +let x = while condition do () done z +let x = ((while condition do () done)[@attr ]) z let x = (a + (-1)) + (-2) let x = (a + (((-1))[@attr ])) + (((-2))[@attr ]) let x = a - b @@ -29,9 +18,7 @@ let x = a -. b ;;Constructor (a, b) ;;`Constructor (a, b) let _ = ((Constructor (a, b); `Constructor (a, b))[@res.braces ]) -;;((library.getBalance account)[@res.uapp ]) |.u - ((Promise.Js.catch - ((Function$ - (fun _ -> ((Promise.resolved None)[@res.braces ][@res.uapp ]))) - [@res.arity 1])) - [@res.uapp ]) \ No newline at end of file +;;(library.getBalance account) |.u + (Promise.Js.catch + ((Function$ (fun _ -> ((Promise.resolved None)[@res.braces ]))) + [@res.arity 1])) \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/expected/binaryNoEs6Arrow.res.txt b/jscomp/syntax/tests/parsing/grammar/expressions/expected/binaryNoEs6Arrow.res.txt index 65a2c884b2..77cf1dcb5f 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/expected/binaryNoEs6Arrow.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/expressions/expected/binaryNoEs6Arrow.res.txt @@ -34,5 +34,4 @@ [@res.braces ]))) [@res.namedArgLoc ][@res.braces ][@res.arity 1]) ~children:[] ()) [@JSX ]) -;;if inclusions.(index) <- (uid, url) - then ((onChange inclusions)[@res.uapp ]) \ No newline at end of file +;;if inclusions.(index) <- (uid, url) then onChange inclusions \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/expected/block.res.txt b/jscomp/syntax/tests/parsing/grammar/expressions/expected/block.res.txt index ab8b06bc7f..30daf26a58 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/expected/block.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/expressions/expected/block.res.txt @@ -1,29 +1,19 @@ let b = ((let module Array = Belt.Array in - ([|1;2|] |.u ((Array.map ((Function$ (fun x -> x + 1))[@res.arity 1])) - [@res.uapp ])) + ([|1;2|] |.u (Array.map ((Function$ (fun x -> x + 1))[@res.arity 1]))) |.u Js.log) [@res.braces ]) let b = ((let open Belt.Array in - ([|1;2|] |.u ((map ((Function$ (fun x -> x + 1))[@res.arity 1])) - [@res.uapp ])) - |.u Js.log) - [@res.braces ]) -let b = ((let exception QuitEarly in ((raise QuitEarly)[@res.uapp ])) + ([|1;2|] |.u (map ((Function$ (fun x -> x + 1))[@res.arity 1]))) |.u + Js.log) [@res.braces ]) +let b = ((let exception QuitEarly in raise QuitEarly)[@res.braces ]) let b = ((let a = 1 in let b = 2 in a + b)[@res.braces ]) -let b = ((let _ = ((sideEffect ())[@res.uapp ]) in ())[@res.braces ]) -let b = ((let _ = ((sideEffect ())[@res.uapp ]) in ())[@res.braces ]) -let b = ((((a ())[@res.uapp ]); ((b ())[@res.uapp ]); ((c ())[@res.uapp ])) - [@res.braces ]) -let b = - ((((a ()) - [@res.uapp ]); - ((b ()) - [@res.uapp ]); - (let a = 1 in ((f a)[@res.uapp ]))) - [@res.braces ]) +let b = ((let _ = sideEffect () in ())[@res.braces ]) +let b = ((let _ = sideEffect () in ())[@res.braces ]) +let b = ((a (); b (); c ())[@res.braces ]) +let b = ((a (); b (); (let a = 1 in f a))[@res.braces ]) let b = ((let a = 1 in let b = 2 in ())[@res.braces ]) let b = ((let module Array = Belt.Array in @@ -31,56 +21,33 @@ let b = let exception Terminate of int in let a = 1 in let b = 2 in - ((sideEffect ()) - [@res.uapp ]); + sideEffect (); (let x = (1 + 2) |.u ((Function$ (fun x -> x + 1))[@res.arity 1]) in - ((raise (Terminate x))[@res.uapp ]))) - [@res.braces ]) -let b = - ((((f ()) - [@res.uapp ]); - ((g ()) - [@res.uapp ]); - ((h ()) - [@res.uapp ]); - (let arr = [|1;2;3|] in ())) + raise (Terminate x))) [@res.braces ]) +let b = ((f (); g (); h (); (let arr = [|1;2;3|] in ()))[@res.braces ]) let res = ((let a = {js|a starts out as|js} in - (((((print_string a) - [@res.uapp ]); - (let a = 20 in ((print_int a)[@res.uapp ])))) + (((print_string a; (let a = 20 in print_int a))) [@res.braces ]); - ((print_string a) - [@res.uapp ])) + print_string a) [@res.braces ]) let res = ((let a = {js|first its a string|js} in - let a = 20 in - ((print_int a) - [@res.uapp ]); - ((print_int a) - [@res.uapp ]); - ((print_int a) - [@res.uapp ])) + let a = 20 in print_int a; print_int a; print_int a) [@res.braces ]) let res = ((let a = {js|a is always a string|js} in - ((print_string a) - [@res.uapp ]); - (let b = 30 in ((print_int b)[@res.uapp ]))) + print_string a; (let b = 30 in print_int b)) [@res.braces ]) let nestedLet = ((let _ = 1 in ())[@res.braces ]) let nestedLet = ((let _ = 1 in 2)[@res.braces ]) let init = - ((Function$ - (fun () -> ((((foo (1 == 1))[@res.uapp ]); [%assert 1 == 2]) - [@res.braces ]))) + ((Function$ (fun () -> ((foo (1 == 1); [%assert 1 == 2])[@res.braces ]))) [@res.arity 1]) let init = ((Function$ - (fun () -> - (([%assert 1 == 2]; ((foo (1 == 1))[@res.uapp ]); [%assert 1 == 2]) + (fun () -> (([%assert 1 == 2]; foo (1 == 1); [%assert 1 == 2]) [@res.braces ]))) [@res.arity 1]) let f = @@ -104,21 +71,19 @@ let reifyStyle (type a) = [@res.template ])] : ('a -> constructor -> bool, [ `Has_arity2 ]) function$) end in - ((if ((Js.typeof x)[@res.uapp ]) = {js|string|js} - then ((Obj.magic String)[@res.uapp ]) + ((if (Js.typeof x) = {js|string|js} + then Obj.magic String else - if ((Internal.instanceOf x Internal.canvasGradient) - [@res.uapp ]) - then ((Obj.magic Gradient)[@res.uapp ]) + if Internal.instanceOf x Internal.canvasGradient + then Obj.magic Gradient else - if ((Internal.instanceOf x Internal.canvasPattern) - [@res.uapp ]) - then ((Obj.magic Pattern)[@res.uapp ]) + if Internal.instanceOf x Internal.canvasPattern + then Obj.magic Pattern else - ((raise - (Invalid_argument - {js|Unknown canvas style kind. Known values are: String, CanvasGradient, CanvasPattern|js})) - [@res.uapp ])), ((Obj.magic x)[@res.uapp ]))) + raise + (Invalid_argument + {js|Unknown canvas style kind. Known values are: String, CanvasGradient, CanvasPattern|js})), + (Obj.magic x))) [@res.braces ]) : (a style * a)))) [@res.arity 1]) let calc_fps = diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/expected/bracedOrRecord.res.txt b/jscomp/syntax/tests/parsing/grammar/expressions/expected/bracedOrRecord.res.txt index 61a53bf4ed..1503dc741c 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/expected/bracedOrRecord.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/expressions/expected/bracedOrRecord.res.txt @@ -6,28 +6,26 @@ let r = { a = expr; b = expr2 } let r = { f = ((Function$ (fun x -> x + b))[@res.arity 1]) } let e = ((a)[@res.braces ]) let e = ((a)[@res.braces ]) -let e = ((a; ((b ())[@res.uapp ]))[@res.braces ]) +let e = ((a; b ())[@res.braces ]) let e = ((- a)[@res.braces ]) let e = ((a + b)[@res.braces ]) let e = ((if a then true else false)[@res.braces ][@res.ternary ]) -let e = ((if ((computation a)[@res.uapp ]) then true else false) +let e = ((if computation a then true else false) [@res.braces ][@res.ternary ]) let e = ((a.(0))[@res.braces ]) -let e = ((f b)[@res.braces ][@res.uapp ]) +let e = ((f b)[@res.braces ]) let e = (((a.b).c)[@res.braces ]) let e = ((arr.(x) <- 20)[@res.braces ]) -let e = ((Function$ (fun x -> ((doStuff config (x + 1))[@res.uapp ]))) +let e = ((Function$ (fun x -> doStuff config (x + 1))) [@res.braces ][@res.arity 1]) let e = ((doStuff config ((Function$ (fun x -> x + 1))[@res.arity 1])) - [@res.braces ][@res.uapp ]) + [@res.braces ]) let e = ((if ((Function$ (fun x -> x + 1))[@res.arity 1]) then true else false) [@res.braces ][@res.ternary ]) let e = - ((((sideEffect ((Function$ (fun x -> x + 1))[@res.arity 1])) - [@res.uapp ]); - ((logToAnalytics Shady.ml) - [@res.uapp ])) + ((sideEffect ((Function$ (fun x -> x + 1))[@res.arity 1]); + logToAnalytics Shady.ml) [@res.braces ]) let f = ((Function$ (fun event -> (event.target).value)) [@res.braces ][@res.arity 1]) diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/expected/constants.res.txt b/jscomp/syntax/tests/parsing/grammar/expressions/expected/constants.res.txt index f380adfdbd..dac7ad468e 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/expected/constants.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/expressions/expected/constants.res.txt @@ -47,7 +47,7 @@ let x = '\b' let x = '\r' let x = ' ' let x = '\170' -let () = ((((getResult ())[@res.uapp ]); (-10))[@res.braces ]) +let () = ((getResult (); (-10))[@res.braces ]) let x = {js|foo\0bar|js} let x = {js|foo\x0Abar|js} let x = {js|\\abc|js} diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/expected/extension.res.txt b/jscomp/syntax/tests/parsing/grammar/expressions/expected/extension.res.txt index 47bfa3d0f5..5b19a89e43 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/expected/extension.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/expressions/expected/extension.res.txt @@ -1,6 +1,5 @@ ;;[%expr ] ;;[%expr.extension ] ;;[%expr.extension.with.args {js|argument|js}] -;;[%expr.extension.with.args - ((Function$ (fun x -> ((f x)[@res.uapp ])))[@res.arity 1])] +;;[%expr.extension.with.args ((Function$ (fun x -> f x))[@res.arity 1])] let x = ([%raw {js|1|js}]) + ([%raw {js|2|js}]) \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/expected/firstClassModule.res.txt b/jscomp/syntax/tests/parsing/grammar/expressions/expected/firstClassModule.res.txt index 4f1fcd8934..e1f798dc53 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/expected/firstClassModule.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/expressions/expected/firstClassModule.res.txt @@ -18,58 +18,50 @@ let plus = ((Function$ (fun m1 -> fun m2 -> ((((module - struct - let x = ((to_int m1)[@res.uapp ]) + ((to_int m2)[@res.uapp ]) - end) : (module X_int)))[@res.braces ]))) + struct let x = (to_int m1) + (to_int m2) end) : (module X_int))) + [@res.braces ]))) [@res.arity 2]) let plus = ((Function$ (fun m1 -> fun m2 -> ((module - struct - let x = ((to_int m1)[@res.uapp ]) + ((to_int m2)[@res.uapp ]) - end) : (module X_int)))) + struct let x = (to_int m1) + (to_int m2) end) : (module X_int)))) [@res.arity 2]) let unique_instance = ((module - struct - module Query_handler = Unique - let this = ((Unique.create 0)[@res.uapp ]) - end) : (module Query_handler_instance)) + struct module Query_handler = Unique + let this = Unique.create 0 end) : (module Query_handler_instance)) let build_instance (type a) = ((Function$ (fun ((module Q) : (module Query_handler with type config = a)) -> fun config -> ((module - struct - module Query_handler = Q - let this = ((Q.create config)[@res.uapp ]) - end) : (module Query_handler_instance)))) + struct module Query_handler = Q + let this = Q.create config end) : (module + Query_handler_instance)))) [@res.arity 2]) let build_instance (type a) = ((Function$ (fun ((module Q) : (module Query_handler with type config = a)) -> fun config -> ((((module - struct - module Query_handler = Q - let this = ((Q.create config)[@res.uapp ]) - end) : (module Query_handler_instance)))[@res.braces ]))) + struct module Query_handler = Q + let this = Q.create config end) : (module + Query_handler_instance))) + [@res.braces ]))) [@res.arity 2]) -let unique_instance = ((build_instance (module Unique) 0)[@res.uapp ]) +let unique_instance = build_instance (module Unique) 0 let build_dispatch_table = ((Function$ (fun handlers -> - ((let table = ((Hashtbl.create (module String))[@res.uapp ]) in - ((List.iter handlers - ~f:((Function$ - (fun - (((module I) : (module Query_handler_instance)) as - instance) - -> - ((Hashtbl.set table ~key:((I.Query_handler.name) - [@res.namedArgLoc ]) ~data:((instance) - [@res.namedArgLoc ])) - [@res.uapp ])))[@res.namedArgLoc ][@res.arity 1]) - table) - [@res.uapp ])) + ((let table = Hashtbl.create (module String) in + List.iter handlers + ~f:((Function$ + (fun + (((module I) : (module Query_handler_instance)) as + instance) + -> + Hashtbl.set table ~key:((I.Query_handler.name) + [@res.namedArgLoc ]) ~data:((instance) + [@res.namedArgLoc ]))) + [@res.namedArgLoc ][@res.arity 1]) table) [@res.braces ]))) [@res.arity 1]) ;;(module Three) @@ -78,23 +70,22 @@ let build_dispatch_table = ;;((module Teenager) |.u age) |.u Js.log ;;((module Teenager).(0)) |.u Js.log ;;((if ((module Teenager) |.u age) |.u isAdult - then ((Js.log {js|has responsibilities|js})[@res.uapp ]) - else ((Js.log {js|can play in the playground|js})[@res.uapp ])) - [@res.ternary ]) + then Js.log {js|has responsibilities|js} + else Js.log {js|can play in the playground|js})[@res.ternary ]) ;;((if ((module Streets).(0)) |.u isExpensive - then ((Js.log {js|big money|js})[@res.uapp ]) - else ((Js.log {js|affordable|js})[@res.uapp ]))[@res.ternary ]) + then Js.log {js|big money|js} + else Js.log {js|affordable|js})[@res.ternary ]) let () = ((((module Teenager) |.u age) |.u Js.log)[@res.braces ]) let () = (((module Teenager).(0))[@res.braces ]) let () = ((if ((module Teenager) |.u age) |.u isAdult - then ((Js.log {js|has responsibilities|js})[@res.uapp ]) - else ((Js.log {js|can play in the playground|js})[@res.uapp ])) + then Js.log {js|has responsibilities|js} + else Js.log {js|can play in the playground|js}) [@res.braces ][@res.ternary ]) let () = ((if ((module Streets).(0)) |.u isExpensive - then ((Js.log {js|big money|js})[@res.uapp ]) - else ((Js.log {js|affordable|js})[@res.uapp ])) + then Js.log {js|big money|js} + else Js.log {js|affordable|js}) [@res.braces ][@res.ternary ]) let () = ((let a = 1 in @@ -106,7 +97,7 @@ let () = let b = 2 in ((module Teenager) |.u age) |.u Js.log; ((if (((module Teenager).(0)) |.u age) |.u isAdult - then ((Js.log {js|has responsibilities|js})[@res.uapp ]) - else ((Js.log {js|can play in the playground|js})[@res.uapp ])) + then Js.log {js|has responsibilities|js} + else Js.log {js|can play in the playground|js}) [@res.ternary ])) [@res.braces ]) \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/expected/if.res.txt b/jscomp/syntax/tests/parsing/grammar/expressions/expected/if.res.txt index 90bbc64541..da4cf19819 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/expected/if.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/expressions/expected/if.res.txt @@ -1,11 +1,8 @@ ;;if foo then true else false ;;if foo = 2 then let bar = 1 in let foo = 2 in bar + foo -let ifThenElse = if foo then lala else ((doStuff x y z)[@res.uapp ]) +let ifThenElse = if foo then lala else doStuff x y z let ifElseIfThen = if foo = bar - then ((f ())[@res.uapp ]) - else - if foo = bar2 - then ((f1 ())[@res.uapp ]) - else if foo = bar3 then ((f2 ())[@res.uapp ]) else ((f3 ())[@res.uapp ]) + then f () + else if foo = bar2 then f1 () else if foo = bar3 then f2 () else f3 () let x = (if true then 1 else 2) + (if false then 2 else 3) \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/expected/infix.res.txt b/jscomp/syntax/tests/parsing/grammar/expressions/expected/infix.res.txt index a3d446ca1b..9daea2caba 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/expected/infix.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/expressions/expected/infix.res.txt @@ -1,4 +1,4 @@ -;;a |.u ((f b)[@res.uapp ]) +;;a |.u (f b) ;;{js|string1|js} ^ {js|string2|js} ;;a <> b ;;a != b diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/expected/jsx.res.txt b/jscomp/syntax/tests/parsing/grammar/expressions/expected/jsx.res.txt index 6057b97045..b929c94c55 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/expected/jsx.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/expressions/expected/jsx.res.txt @@ -10,12 +10,12 @@ let _ = ((div ~className:(({js|menu|js})[@res.namedArgLoc ]) ~children:[] ()) [@JSX ]) let _ = ((div ~className:(({js|menu|js})[@res.namedArgLoc ]) - ~onClick:((Function$ (fun _ -> ((Js.log {js|click|js})[@res.uapp ]))) + ~onClick:((Function$ (fun _ -> Js.log {js|click|js})) [@res.namedArgLoc ][@res.braces ][@res.arity 1]) ~children:[] ()) [@JSX ]) let _ = ((div ~className:(({js|menu|js})[@res.namedArgLoc ]) - ~onClick:((Function$ (fun _ -> ((Js.log {js|click|js})[@res.uapp ]))) + ~onClick:((Function$ (fun _ -> Js.log {js|click|js})) [@res.namedArgLoc ][@res.braces ][@res.arity 1]) ~children:[] ()) [@JSX ]) let _ = ((Navbar.createElement ~children:[] ())[@JSX ]) @@ -93,12 +93,7 @@ let _ = ((Foo.createElement ~children:[|a|] ())[@JSX ]) let _ = ((Foo.createElement ~children:(1, 2) ())[@JSX ]) let _ = ((Foo.createElement ~children:(1, 2) ())[@JSX ]) let _ = - ((div - ~children:[ident; - [|1;2;3|]; - ((call a b) - [@res.braces ][@res.uapp ]); - (x.y).z] ()) + ((div ~children:[ident; [|1;2;3|]; ((call a b)[@res.braces ]); (x.y).z] ()) [@JSX ]) let _ = ((Outer.createElement ~inner:((Inner.createElement ~children:[] ()) @@ -154,37 +149,31 @@ let _ = ((a ~children:[] ())[@JSX ]) < ((b ~children:[] ())[@JSX ]) let _ = ((a ~children:[] ())[@JSX ]) > ((b ~children:[] ())[@JSX ]) let y = ((Routes.createElement ~path:((Routes.stateToPath state) - [@res.namedArgLoc ][@res.uapp ]) ~isHistorical:((true) - [@res.namedArgLoc ]) + [@res.namedArgLoc ]) ~isHistorical:((true)[@res.namedArgLoc ]) ~onHashChange:((Function$ (fun _oldPath -> fun _oldUrl -> fun newUrl -> - ((updater - ((Function$ - (fun latestComponentBag -> - fun _ -> - ((let currentActualPath = - ((Routes.hashOfUri newUrl) - [@res.uapp ]) in - let pathFromState = - ((Routes.stateToPath - latestComponentBag.state) - [@res.uapp ]) in - ((if - currentActualPath = - pathFromState - then None - else - ((dispatchEventless - (State.UriNavigated - currentActualPath) - latestComponentBag ()) - [@res.uapp ])) - [@res.ternary ])) - [@res.braces ])))[@res.arity 2]) - ()) - [@res.uapp ]))) + updater + ((Function$ + (fun latestComponentBag -> + fun _ -> + ((let currentActualPath = + Routes.hashOfUri newUrl in + let pathFromState = + Routes.stateToPath + latestComponentBag.state in + ((if + currentActualPath = + pathFromState + then None + else + dispatchEventless + (State.UriNavigated + currentActualPath) + latestComponentBag ()) + [@res.ternary ])) + [@res.braces ])))[@res.arity 2]) ())) [@res.namedArgLoc ][@res.braces ][@res.arity 3]) ~children:[] ()) [@JSX ]) let z = @@ -197,8 +186,8 @@ let z = [@res.namedArgLoc ]) ~borderColor:((borderColor) [@res.namedArgLoc ]) ~someOtherAttribute:((someOtherAttribute) - [@res.namedArgLoc ]) ())[@res.namedArgLoc ][@res.uapp ]) - ~key:((string_of_int 1)[@res.namedArgLoc ][@res.uapp ]) ~children:[] ()) + [@res.namedArgLoc ]) ())[@res.namedArgLoc ]) + ~key:((string_of_int 1)[@res.namedArgLoc ]) ~children:[] ()) [@JSX ]) let omega = ((div @@ -211,20 +200,20 @@ let omega = border; borderColor; someOtherAttribute])[@res.namedArgLoc ]) - ~key:((string_of_int 1)[@res.namedArgLoc ][@res.uapp ]) ~children:[] ()) + ~key:((string_of_int 1)[@res.namedArgLoc ]) ~children:[] ()) [@JSX ]) let someArray = ((div ~anArray:(([|width;height;color;backgroundColor;margin;padding;border;borderColor;someOtherAttribute|]) - [@res.namedArgLoc ]) ~key:((string_of_int 1) - [@res.namedArgLoc ][@res.uapp ]) ~children:[] ()) + [@res.namedArgLoc ]) ~key:((string_of_int 1)[@res.namedArgLoc ]) + ~children:[] ()) [@JSX ]) let tuples = ((div ~aTuple:(((width, height, color, backgroundColor, margin, padding, border, borderColor, someOtherAttribute, definitelyBreakere))[@res.namedArgLoc ]) - ~key:((string_of_int 1)[@res.namedArgLoc ][@res.uapp ]) ~children:[] ()) + ~key:((string_of_int 1)[@res.namedArgLoc ]) ~children:[] ()) [@JSX ]) let icon = ((Icon.createElement @@ -238,7 +227,7 @@ let icon = let _ = ((MessengerSharedPhotosAlbumViewPhotoReact.createElement ?ref:((if foo#bar == baz - then Some ((foooooooooooooooooooooooo setRefChild)[@res.uapp ]) + then Some (foooooooooooooooooooooooo setRefChild) else None)[@res.namedArgLoc ][@res.ternary ]) ~key:((node#legacy_attachment_id)[@res.namedArgLoc ]) ~children:[] ()) [@JSX ]) @@ -278,13 +267,12 @@ let _ = ((Description.createElement ~term:((Text.createElement ~text:(({js|Age|js})[@res.namedArgLoc ]) ~children:(([||])[@res.namedArgLoc ]) ()) - [@res.namedArgLoc ][@res.braces ][@res.uapp ]) ~children:[child] ()) + [@res.namedArgLoc ][@res.braces ]) ~children:[child] ()) [@JSX ]) let _ = ((Description.createElement ~term:((Text.createElement ~text:(({js|Age|js})[@res.namedArgLoc ]) ()) - [@res.namedArgLoc ][@res.braces ][@JSX ][@res.uapp ]) ~children: - [child] ()) + [@res.namedArgLoc ][@res.braces ][@JSX ]) ~children:[child] ()) [@JSX ]) let _ = ((Description.createElement @@ -304,9 +292,7 @@ let _ = [@res.namedArgLoc ][@res.braces ][@JSX ]) ~children:[] ()) [@JSX ]) let _ = - ((div - ~children:[((span ~children:[((str {js|hello|js})[@res.uapp ])] ()) - [@JSX ])] ()) + ((div ~children:[((span ~children:[str {js|hello|js}] ())[@JSX ])] ()) [@JSX ]) let _ = ((description @@ -317,19 +303,17 @@ let _ = ((description ~term:((text ~text:(({js|Age|js})[@res.namedArgLoc ]) ~children:(( [||])[@res.namedArgLoc ]) ()) - [@res.namedArgLoc ][@res.braces ][@res.uapp ]) ~children:[child] ()) + [@res.namedArgLoc ][@res.braces ]) ~children:[child] ()) [@JSX ]) let _ = ((description ~term:((text ~text:(({js|Age|js})[@res.namedArgLoc ]) ~children:(( [||])[@res.namedArgLoc ])) - [@res.namedArgLoc ][@res.braces ][@JSX ][@res.uapp ]) ~children: - [child] ()) + [@res.namedArgLoc ][@res.braces ][@JSX ]) ~children:[child] ()) [@JSX ]) let _ = ((description ~term:((text ~text:(({js|Age|js})[@res.namedArgLoc ]) ()) - [@res.namedArgLoc ][@res.braces ][@JSX ][@res.uapp ]) ~children: - [child] ()) + [@res.namedArgLoc ][@res.braces ][@JSX ]) ~children:[child] ()) [@JSX ]) let _ = ((description @@ -341,25 +325,19 @@ let _ = ~children:[child] ()) [@JSX ]) let _ = - ((div - ~onClick:((Function$ (fun event -> ((handleChange event)[@res.uapp ]))) + ((div ~onClick:((Function$ (fun event -> handleChange event)) [@res.namedArgLoc ][@res.braces ][@res.arity 1]) ~children:[] ()) [@JSX ]) let _ = ((div ~onClick:((Function$ - (fun eventWithLongIdent -> - ((handleChange eventWithLongIdent)[@res.uapp ]))) + (fun eventWithLongIdent -> handleChange eventWithLongIdent)) [@res.namedArgLoc ][@res.braces ][@res.arity 1]) ~children:[] ()) [@JSX ]) let _ = ((div ~onClick:((Function$ - (fun event -> - ((((Js.log event) - [@res.uapp ]); - ((handleChange event) - [@res.uapp ])) + (fun event -> ((Js.log event; handleChange event) [@res.braces ]))) [@res.namedArgLoc ][@res.braces ][@res.arity 1]) ~children:[] ()) [@JSX ]) @@ -371,23 +349,20 @@ let _ = fun baz -> fun lineBreak -> fun identifier -> - ((((doStuff foo bar baz) - [@res.uapp ]); - ((bar lineBreak identifier) - [@res.uapp ])) + ((doStuff foo bar baz; bar lineBreak identifier) [@res.braces ]))) [@res.namedArgLoc ][@res.braces ][@res.arity 5]) ~children:[] ()) [@JSX ]) let _ = ((AttrDiv.createElement - ~onClick:((Function$ (fun event -> ((handleChange event)[@res.uapp ]))) + ~onClick:((Function$ (fun event -> handleChange event)) [@res.namedArgLoc ][@res.braces ][@bar ][@res.arity 1]) ~children:[] ()) [@JSX ]) let _ = ((AttrDiv.createElement ~onClick:((Function$ (fun eventLongIdentifier -> - ((handleChange eventLongIdentifier)[@res.uapp ]))) + handleChange eventLongIdentifier)) [@res.namedArgLoc ][@res.braces ][@bar ][@res.arity 1]) ~children:[] ()) [@JSX ]) let _ = @@ -398,28 +373,20 @@ let _ = fun ~baz:((baz)[@res.namedArgLoc ]) -> fun ~lineBreak:((lineBreak)[@res.namedArgLoc ]) -> fun ~identifier:((identifier)[@res.namedArgLoc ]) - -> - fun () -> ((bar lineBreak identifier) - [@res.uapp ]))) + -> fun () -> bar lineBreak identifier)) [@res.namedArgLoc ][@res.braces ][@res.arity 6]) ~children:[] ()) [@JSX ]) let _ = ((div ~onClick:((Function$ - (fun e -> - (((((doStuff ())[@res.uapp ]); ((bar foo)[@res.uapp ])) - [@res.braces ]) : event))) + (fun e -> (((doStuff (); bar foo)[@res.braces ]) : event))) [@res.namedArgLoc ][@res.braces ][@res.arity 1]) ~children:[] ()) [@JSX ]) let _ = ((div ~onClick:((Function$ (fun e -> - fun e2 -> - (((((doStuff ()) - [@res.uapp ]); - ((bar foo) - [@res.uapp ])) + fun e2 -> (((doStuff (); bar foo) [@res.braces ]) : event))) [@res.namedArgLoc ][@res.braces ][@res.arity 2]) ~children:[] ()) [@JSX ]) @@ -430,11 +397,7 @@ let _ = fun bar -> fun baz -> fun superLongIdent -> - fun breakLine -> - (((((doStuff ()) - [@res.uapp ]); - ((bar foo) - [@res.uapp ])) + fun breakLine -> (((doStuff (); bar foo) [@res.braces ]) : (event * event2 * event3 * event4 * event5)))) [@res.namedArgLoc ][@res.braces ][@res.arity 5]) ~children:[] ()) @@ -446,17 +409,16 @@ let _ = fun bar -> fun baz -> fun superLongIdent -> - fun breakLine -> (((doStuff ()) - [@res.uapp ]) : (event * event2 * event3 * - event4 * event5)))) + fun breakLine -> + (doStuff () : (event * event2 * event3 * event4 + * event5)))) [@res.namedArgLoc ][@res.braces ][@res.arity 5]) ~children:[] ()) [@JSX ]) let _ = ((div ~children:[(((match color with - | Black -> ((ReasonReact.string {js|black|js}) - [@res.uapp ]) - | Red -> ((ReasonReact.string {js|red|js})[@res.uapp ]))) + | Black -> ReasonReact.string {js|black|js} + | Red -> ReasonReact.string {js|red|js})) [@res.braces ])] ()) [@JSX ]) let _ = @@ -466,7 +428,7 @@ let _ = [@res.namedArgLoc ]) ~borderRadius:(({js|100%|js}) [@res.namedArgLoc ]) ~backgroundColor:(({js|red|js}) [@res.namedArgLoc ])) - [@res.namedArgLoc ][@res.braces ][@foo ][@res.uapp ]) ~children:[] ()) + [@res.namedArgLoc ][@res.braces ][@foo ]) ~children:[] ()) [@JSX ]) let _ = ((Animated.createElement ~initialValue:((0.0)[@res.namedArgLoc ]) @@ -475,7 +437,7 @@ let _ = [@res.namedArgLoc ]) ~height:(({js|20px|js}) [@res.namedArgLoc ]) ~borderRadius:(({js|100%|js}) [@res.namedArgLoc ]) ~backgroundColor:(({js|red|js}) - [@res.namedArgLoc ]))[@res.braces ][@res.uapp ]) ()) + [@res.namedArgLoc ]))[@res.braces ]) ()) [@JSX ]) let _ = ((Animated.createElement ~initialValue:((0.0)[@res.namedArgLoc ]) @@ -492,8 +454,7 @@ let _ = [@res.namedArgLoc ]) ~backgroundColor:(({js|red|js}) [@res.namedArgLoc ])) - [@res.namedArgLoc ][@res.braces ][@res.uapp ]) - ~children:[] ()) + [@res.namedArgLoc ][@res.braces ]) ~children:[] ()) [@JSX ])))[@res.braces ][@res.arity 1]) ()) [@JSX ]) let _ = @@ -511,8 +472,8 @@ let _ = [@res.namedArgLoc ]) ~backgroundColor:(({js|red|js}) [@res.namedArgLoc ])) - [@res.namedArgLoc ][@res.braces ][@res.uapp ]) - ~children:[] ()) + [@res.namedArgLoc ][@res.braces ]) ~children:[] + ()) [@JSX ]) : ReasonReact.element))) [@res.braces ][@res.arity 1]) ()) [@JSX ]) @@ -531,8 +492,7 @@ let _ = [@res.namedArgLoc ]) ~backgroundColor:(({js|red|js}) [@res.namedArgLoc ])) - [@res.namedArgLoc ][@res.braces ][@res.uapp ]) - ~children:[] ()) + [@res.namedArgLoc ][@res.braces ]) ~children:[] ()) [@res.braces ][@JSX ]))) [@res.braces ][@foo ][@res.arity 1]) ()) [@JSX ]) @@ -551,51 +511,49 @@ let _ = [@res.namedArgLoc ]) ~backgroundColor:(({js|red|js}) [@res.namedArgLoc ])) - [@res.namedArgLoc ][@res.braces ][@res.uapp ]) - ~children:[] ()) + [@res.namedArgLoc ][@res.braces ]) ~children:[] + ()) [@JSX ])) [@res.braces ])))[@res.braces ][@res.arity 1]) ()) [@JSX ]) let _ = ((div ~callback:((reduce ((Function$ (fun () -> not state))[@res.arity 1])) - [@res.namedArgLoc ][@res.braces ][@res.uapp ]) ~children:[] ()) + [@res.namedArgLoc ][@res.braces ]) ~children:[] ()) [@JSX ]) let _ = ((button ?id:((id)[@res.namedArgLoc ]) ~className:((Cn.make [|{js|button|js};{js|is-fullwidth|js}|]) - [@res.namedArgLoc ][@res.braces ][@res.uapp ]) ~onClick:((onClick) - [@res.namedArgLoc ]) - ~children:[((ste {js|Submit|js})[@res.braces ][@res.uapp ])] ()) + [@res.namedArgLoc ][@res.braces ]) ~onClick:((onClick) + [@res.namedArgLoc ]) ~children:[((ste {js|Submit|js})[@res.braces ])] + ()) [@JSX ]) let _ = ((button ?id:((id)[@res.namedArgLoc ]) ~className:((Cn.make [{js|button|js}; {js|is-fullwidth|js}]) - [@res.namedArgLoc ][@res.braces ][@res.uapp ]) ~onClick:((onClick) - [@res.namedArgLoc ]) - ~children:[((ste {js|Submit|js})[@res.braces ][@res.uapp ])] ()) + [@res.namedArgLoc ][@res.braces ]) ~onClick:((onClick) + [@res.namedArgLoc ]) ~children:[((ste {js|Submit|js})[@res.braces ])] + ()) [@JSX ]) let _ = ((button ?id:((id)[@res.namedArgLoc ]) ~className:((Cn.make ({js|button|js}, {js|is-fullwidth|js})) - [@res.namedArgLoc ][@res.braces ][@res.uapp ]) ~onClick:((onClick) - [@res.namedArgLoc ]) - ~children:[((ste {js|Submit|js})[@res.braces ][@res.uapp ])] ()) + [@res.namedArgLoc ][@res.braces ]) ~onClick:((onClick) + [@res.namedArgLoc ]) ~children:[((ste {js|Submit|js})[@res.braces ])] + ()) [@JSX ]) let _ = ((button ?id:((id)[@res.namedArgLoc ]) ~className:((Cn.make { a = b }) - [@res.namedArgLoc ][@res.braces ][@res.uapp ]) ~onClick:((onClick) - [@res.namedArgLoc ]) - ~children:[((ste {js|Submit|js})[@res.braces ][@res.uapp ])] ()) + [@res.namedArgLoc ][@res.braces ]) ~onClick:((onClick) + [@res.namedArgLoc ]) ~children:[((ste {js|Submit|js})[@res.braces ])] + ()) [@JSX ]) let _ = - ((X.createElement - ~y:((z |.u ((Belt.Option.getWithDefault {js||js})[@res.uapp ])) + ((X.createElement ~y:((z |.u (Belt.Option.getWithDefault {js||js})) [@res.namedArgLoc ][@res.braces ]) ~children:[] ()) [@JSX ]) let _ = - ((div ~style:((getStyle ())[@res.namedArgLoc ][@res.braces ][@res.uapp ]) - ~children:[((ReasonReact.string {js|BugTest|js}) - [@res.braces ][@res.uapp ])] ()) + ((div ~style:((getStyle ())[@res.namedArgLoc ][@res.braces ]) + ~children:[((ReasonReact.string {js|BugTest|js})[@res.braces ])] ()) [@JSX ]) let _ = ((div @@ -618,46 +576,35 @@ let _ = [@JSX ]) ;;((div ~children:[((ReasonReact.array - ((Array.of_list - ((List.map - ((Function$ - (fun possibleGradeValue -> - ((option - ~key:((string_of_int + (Array.of_list + (List.map + ((Function$ + (fun possibleGradeValue -> + ((option + ~key:((string_of_int possibleGradeValue) + [@res.namedArgLoc ][@res.braces ]) + ~value:((string_of_int possibleGradeValue) - [@res.namedArgLoc ][@res.braces ] - [@res.uapp ]) - ~value:((string_of_int - possibleGradeValue) - [@res.namedArgLoc ][@res.braces ] - [@res.uapp ]) - ~children:[((str - ((string_of_int - possibleGradeValue) - [@res.uapp ])) - [@res.braces ][@res.uapp ])] - ()) - [@JSX ])))[@res.arity 1]) - ((List.filter - ((Function$ (fun g -> g <= state.maxGrade)) - [@res.arity 1]) possibleGradeValues) - [@res.uapp ]))[@res.uapp ]))[@res.uapp ])) - [@res.braces ][@res.uapp ])] ())[@JSX ]) -;;((div ~children:[((Js.log (a <= 10))[@res.braces ][@res.uapp ])] ()) - [@JSX ]) + [@res.namedArgLoc ][@res.braces ]) + ~children:[((str + (string_of_int + possibleGradeValue)) + [@res.braces ])] ()) + [@JSX ])))[@res.arity 1]) + (List.filter + ((Function$ (fun g -> g <= state.maxGrade)) + [@res.arity 1]) possibleGradeValues)))) + [@res.braces ])] ())[@JSX ]) +;;((div ~children:[((Js.log (a <= 10))[@res.braces ])] ())[@JSX ]) ;;((div - ~children:[((div - ~children:[((Js.log (a <= 10)) - [@res.braces ][@res.uapp ])] ()) + ~children:[((div ~children:[((Js.log (a <= 10))[@res.braces ])] ()) [@JSX ])] ())[@JSX ]) ;;((div - ~children:[((div - ~onClick:((Function$ - (fun _ -> ((Js.log (a <= 10))[@res.uapp ]))) + ~children:[((div ~onClick:((Function$ (fun _ -> Js.log (a <= 10))) [@res.namedArgLoc ][@res.braces ][@res.arity 1]) ~children:[((div ~children:[((Js.log (a <= 10)) - [@res.braces ][@res.uapp ])] ()) + [@res.braces ])] ()) [@JSX ])] ()) [@JSX ])] ())[@JSX ]) ;;((div ~children:element ())[@JSX ]) diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/expected/parenthesized.res.txt b/jscomp/syntax/tests/parsing/grammar/expressions/expected/parenthesized.res.txt index 572279a4cb..9507c0cfe4 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/expected/parenthesized.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/expressions/expected/parenthesized.res.txt @@ -19,9 +19,8 @@ let assertSmthing = assert true let jsx = ((div ~className:(({js|cx|js})[@res.namedArgLoc ]) ~children:[foo] ()) [@JSX ]) -let ifExpr = - if true then ((Js.log true)[@res.uapp ]) else ((Js.log false)[@res.uapp ]) +let ifExpr = if true then Js.log true else Js.log false let forExpr = for p = 0 to 10 do () done -let whileExpr = while true do ((doSomeImperativeThing ())[@res.uapp ]) done +let whileExpr = while true do doSomeImperativeThing () done let switchExpr = match myVar with | Blue -> {js|blue|js} | Red -> {js|red|js} let constrainedExpr = (x : int) \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/expected/primary.res.txt b/jscomp/syntax/tests/parsing/grammar/expressions/expected/primary.res.txt index f4979d060d..f7aabdd001 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/expected/primary.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/expressions/expected/primary.res.txt @@ -10,24 +10,23 @@ let x = arr.((x : int)) let x = (arr.(0)).(1) let x = (arr.((x : int))).((y : int)) ;;arr.(0) <- (a + b) -;;((f ())[@res.uapp ]) -;;((((f ())[@res.uapp ]) ())[@res.uapp ]) -;;((f a)[@res.uapp ]) -;;((((f a)[@res.uapp ]) a)[@res.uapp ]) -;;((f a)[@res.uapp ]) -;;((f (x : int))[@res.uapp ]) -;;((f a b c)[@res.uapp ]) -;;((f a b c)[@res.uapp ]) +;;f () +;;(f ()) () +;;f a +;;(f a) a +;;f a +;;f (x : int) +;;f a b c +;;f a b c +;;f ~a:((a)[@res.namedArgLoc ]) ~b:((bArg)[@res.namedArgLoc ]) ?c:((c) + [@res.namedArgLoc ]) ?d:((expr)[@res.namedArgLoc ]) ;;((f ~a:((a)[@res.namedArgLoc ]) ~b:((bArg)[@res.namedArgLoc ]) ?c:((c) - [@res.namedArgLoc ]) ?d:((expr)[@res.namedArgLoc ]))[@res.uapp ]) -;;((((((f ~a:((a)[@res.namedArgLoc ]) ~b:((bArg)[@res.namedArgLoc ]) ?c:((c) - [@res.namedArgLoc ]) ?d:((expr)[@res.namedArgLoc ]))[@res.uapp ]) - ~a:((a)[@res.namedArgLoc ]) ~b:((bArg)[@res.namedArgLoc ]) ?c:((c) - [@res.namedArgLoc ]) ?d:((expr)[@res.namedArgLoc ]))[@res.uapp ]) - ~a:((a)[@res.namedArgLoc ]) ~b:((bArg)[@res.namedArgLoc ]) ?c:((c) - [@res.namedArgLoc ]) ?d:((expr)[@res.namedArgLoc ]))[@res.uapp ]) -;;((f ~a:(((x : int))[@res.namedArgLoc ]) ?b:(((y : int))[@res.namedArgLoc ])) - [@res.uapp ]) + [@res.namedArgLoc ]) ?d:((expr)[@res.namedArgLoc ])) ~a:((a) + [@res.namedArgLoc ]) ~b:((bArg)[@res.namedArgLoc ]) ?c:((c) + [@res.namedArgLoc ]) ?d:((expr)[@res.namedArgLoc ])) ~a:((a) + [@res.namedArgLoc ]) ~b:((bArg)[@res.namedArgLoc ]) ?c:((c) + [@res.namedArgLoc ]) ?d:((expr)[@res.namedArgLoc ]) +;;f ~a:(((x : int))[@res.namedArgLoc ]) ?b:(((y : int))[@res.namedArgLoc ]) ;;connection#platformId ;;((connection#left)#account)#accountName ;;john#age #= 99 diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/expected/record.res.txt b/jscomp/syntax/tests/parsing/grammar/expressions/expected/record.res.txt index fd2790aa77..52cdba58c7 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/expected/record.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/expressions/expected/record.res.txt @@ -10,8 +10,8 @@ let r = { a = (expr : int); b = (x : string) } let r = { expr with pexp_attributes = [||] } let r = { expr with pexp_attributes = [||]; pexp_loc = loc } let r = { expr with pexp_attributes = [||] } -let r = { (((make ())[@res.uapp ]) : myRecord) with foo = bar } -let r = { (((make ())[@res.uapp ]) : myRecord) with foo = bar } +let r = { (make () : myRecord) with foo = bar } +let r = { (make () : myRecord) with foo = bar } let r = { x = ((None)[@res.optional ]); diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/expected/sideEffects.res.txt b/jscomp/syntax/tests/parsing/grammar/expressions/expected/sideEffects.res.txt index 690fd9e973..aaa9b7ee2a 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/expected/sideEffects.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/expressions/expected/sideEffects.res.txt @@ -1,27 +1,13 @@ -;;((foo ())[@res.uapp ]) -;;((bar ())[@res.uapp ]) -let () = ((((foo ())[@res.uapp ]); ((bar ())[@res.uapp ]))[@res.braces ]) +;;foo () +;;bar () +let () = ((foo (); bar ())[@res.braces ]) let () = ((let x = 1 in - ((sideEffect ()) - [@res.uapp ]); - (let y = 2 in - ((sideEffect2 ()) - [@res.uapp ]); - (let z = 3 in ((sideEffect3 ())[@res.uapp ])))) + sideEffect (); + (let y = 2 in sideEffect2 (); (let z = 3 in sideEffect3 ()))) [@res.braces ]) ;;while true do - ((sideEffect1 ()) - [@res.uapp ]); - (let x = 1 in - ((sideEffect2 ()) - [@res.uapp ]); - (let y = 2 in ((sideEffect3 ())[@res.uapp ]))) - done + sideEffect1 (); + (let x = 1 in sideEffect2 (); (let y = 2 in sideEffect3 ())) done ;;match color with - | Blue -> - (((getResult ()) - [@res.uapp ]); - ((sideEffect ()) - [@res.uapp ]); - (let x = 1 in ((sideEffect2 ())[@res.uapp ]))) \ No newline at end of file + | Blue -> (getResult (); sideEffect (); (let x = 1 in sideEffect2 ())) \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/expected/switch.res.txt b/jscomp/syntax/tests/parsing/grammar/expressions/expected/switch.res.txt index abc17296f1..520fe4fb01 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/expected/switch.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/expressions/expected/switch.res.txt @@ -5,7 +5,7 @@ ;;match person1 with | Teacher _ -> () | Student { reportCard = { gpa } } when gpa < 0.5 -> - ((Js.log {js|What's happening|js})[@res.uapp ]) + Js.log {js|What's happening|js} | Student { reportCard = { gpa } } when gpa > 0.9 -> - ((Js.log {js|Take more free time, you study too much.|js})[@res.uapp ]) - | Student _ -> ((Js.log {js|Heyo|js})[@res.uapp ]) \ No newline at end of file + Js.log {js|Take more free time, you study too much.|js} + | Student _ -> Js.log {js|Heyo|js} \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/expected/try.res.txt b/jscomp/syntax/tests/parsing/grammar/expressions/expected/try.res.txt index c941bc5db9..5516982c57 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/expected/try.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/expressions/expected/try.res.txt @@ -1,10 +1,6 @@ -;;try - ((let x = 1 in let y = 2 in ((dangerousCall (x + y))[@res.uapp ])) - [@res.braces ]) - with | Foo -> ((Js.log {js|catched Foo|js})[@res.uapp ]) - | Exit -> ((Js.log {js|catched exit|js})[@res.uapp ]) -;;try ((myDangerousFn ())[@res.uapp ]) - with | Foo -> ((Js.log {js|catched Foo|js})[@res.uapp ])[@@attr ] -let x = - ((let y = 1 in try ((apply y)[@res.braces ][@res.uapp ]) with | _ -> 2) +;;try ((let x = 1 in let y = 2 in dangerousCall (x + y))[@res.braces ]) + with | Foo -> Js.log {js|catched Foo|js} + | Exit -> Js.log {js|catched exit|js} +;;try myDangerousFn () with | Foo -> Js.log {js|catched Foo|js}[@@attr ] +let x = ((let y = 1 in try ((apply y)[@res.braces ]) with | _ -> 2) [@res.braces ]) \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/expected/tupleVsDivision.res.txt b/jscomp/syntax/tests/parsing/grammar/expressions/expected/tupleVsDivision.res.txt index d3dc173f3e..24f94f3599 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/expected/tupleVsDivision.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/expressions/expected/tupleVsDivision.res.txt @@ -1,12 +1,8 @@ -;;((foo ())[@res.uapp ]) / 1 -;;((foo ())[@res.uapp ]) +;;(foo ()) / 1 +;;foo () ;;(1, 2) |.u printTuple let f = ((Function$ - (fun () -> - ((((foo ())[@res.uapp ]) / 1; - ((foo ()) - [@res.uapp ]); - (1, 2) |.u printTuple) + (fun () -> (((foo ()) / 1; foo (); (1, 2) |.u printTuple) [@res.braces ]))) [@res.arity 1]) \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/expected/uncurried.res.txt b/jscomp/syntax/tests/parsing/grammar/expressions/expected/uncurried.res.txt index 8937d3f80a..db8486599f 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/expected/uncurried.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/expressions/expected/uncurried.res.txt @@ -26,5 +26,5 @@ let f = (fun ((a)[@attr ]) -> fun ((b)[@attr2 ]) -> fun ((c)[@attr3 ]) -> fun ((d)[@attr4 ]) -> ())) [@res.arity 4]) -;;((add 1 2)[@res.uapp ]) -;;((((((add 2 3 4)[@res.uapp ]) 5 6 7)[@res.uapp ]) 8 9 10)[@res.uapp ]) \ No newline at end of file +;;add 1 2 +;;add 2 3 4 5 6 7 8 9 10 \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/expected/underscoreApply.res.txt b/jscomp/syntax/tests/parsing/grammar/expressions/expected/underscoreApply.res.txt index 846308f379..f26f2f3d08 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/expected/underscoreApply.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/expressions/expected/underscoreApply.res.txt @@ -2,57 +2,44 @@ let l = ([1; 2; 3] |.u ((Function$ (fun __x -> - ((List.map ((Function$ (fun i -> i + 1))[@res.arity 1]) __x) - [@res.uapp ]))) + List.map ((Function$ (fun i -> i + 1))[@res.arity 1]) __x)) [@res.arity 1])) |.u ((Function$ (fun __x -> - ((List.filter ((Function$ (fun i -> i > 0))[@res.arity 1]) __x) - [@res.uapp ]))) + List.filter ((Function$ (fun i -> i > 0))[@res.arity 1]) __x)) [@res.arity 1]) let l = ((Function$ (fun i -> i + 1))[@res.arity 1]) |.u - ((Function$ (fun __x -> ((List.map __x [1; 2; 3])[@res.uapp ]))) - [@res.arity 1]) -let x = ((Function$ (fun __x -> ((List.length __x)[@res.uapp ]))) - [@res.arity 1]) + ((Function$ (fun __x -> List.map __x [1; 2; 3]))[@res.arity 1]) +let x = ((Function$ (fun __x -> List.length __x))[@res.arity 1]) let nested = ((Function$ - (fun x -> ((Function$ (fun __x -> ((List.length __x)[@res.uapp ]))) - [@res.arity 1]))) + (fun x -> ((Function$ (fun __x -> List.length __x))[@res.arity 1]))) [@res.arity 1]) let incr = ((Function$ (fun ~v:((v)[@res.namedArgLoc ]) -> v + 1)) [@res.arity 1]) let l1 = - ((List.length - ((List.map ((Function$ (fun __x -> ((incr ~v:__x)[@res.uapp ]))) - [@res.arity 1]) [1; 2; 3])[@res.uapp ])) - [@res.uapp ]) + List.length + (List.map ((Function$ (fun __x -> incr ~v:__x))[@res.arity 1]) [1; 2; 3]) let l2 = - ((List.length - ((List.map ((Function$ (fun __x -> ((incr ~v:__x)[@res.uapp ]))) - [@res.arity 1]) [1; 2; 3])[@res.uapp ])) - [@res.uapp ]) + List.length + (List.map ((Function$ (fun __x -> incr ~v:__x))[@res.arity 1]) [1; 2; 3]) let optParam = ((Function$ (fun ?v:((v)[@res.namedArgLoc ]) -> fun () -> ((if v = None then 0 else 1)[@res.ternary ]))) [@res.arity 2]) let l1 = - ((List.length - ((List.map ((Function$ (fun __x -> ((optParam ?v:__x ())[@res.uapp ]))) - [@res.arity 1]) [Some 1; None; Some 2])[@res.uapp ])) - [@res.uapp ]) + List.length + (List.map ((Function$ (fun __x -> optParam ?v:__x ()))[@res.arity 1]) + [Some 1; None; Some 2]) let l2 = - ((List.length - ((List.map ((Function$ (fun __x -> ((optParam ?v:__x ())[@res.uapp ]))) - [@res.arity 1]) [Some 1; None; Some 2])[@res.uapp ])) - [@res.uapp ]) + List.length + (List.map ((Function$ (fun __x -> optParam ?v:__x ()))[@res.arity 1]) + [Some 1; None; Some 2]) ;;((Function$ (fun __x -> - ((underscoreWithComments - ((Function$ - (fun x -> ((something ())[@res.braces ][@res.uapp ]))) - [@res.arity 1]) __x) - [@res.uapp ])))[@res.arity 1]) \ No newline at end of file + underscoreWithComments + ((Function$ (fun x -> ((something ())[@res.braces ]))) + [@res.arity 1]) __x))[@res.arity 1]) \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/expected/while.res.txt b/jscomp/syntax/tests/parsing/grammar/expressions/expected/while.res.txt index cd02e75d45..91c85df409 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/expected/while.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/expressions/expected/while.res.txt @@ -1,5 +1,3 @@ ;;while not eofReached do - let a = 1 in - let b = 2 in ((Lexbuf.next ())[@res.uapp ]); (a + b) |.u Js.log done -;;while (not ((isLineEnding buf)[@res.uapp ])) && true do - ((foo ())[@res.uapp ]); ((next ())[@res.uapp ]) done \ No newline at end of file + let a = 1 in let b = 2 in Lexbuf.next (); (a + b) |.u Js.log done +;;while (not (isLineEnding buf)) && true do foo (); next () done \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/grammar/modexpr/expected/firstClassModules.res.txt b/jscomp/syntax/tests/parsing/grammar/modexpr/expected/firstClassModules.res.txt index 3d8d5fb9f0..668b92e718 100644 --- a/jscomp/syntax/tests/parsing/grammar/modexpr/expected/firstClassModules.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/modexpr/expected/firstClassModules.res.txt @@ -1,15 +1,14 @@ module Device = (val - (((let deviceName = ((parseCmdline ())[@res.uapp ]) in - try ((Hashtbl.find devices deviceName)[@res.uapp ]) - with | Not_found -> ((exit 2)[@res.uapp ])) + (((let deviceName = parseCmdline () in + try Hashtbl.find devices deviceName with | Not_found -> exit 2) [@res.braces ]) : (module Device))) let draw_using_device = ((Function$ (fun device_name -> fun picture -> - ((let module Device = (val (((Hashtbl.find devices device_name) - [@res.uapp ]) : (module DEVICE))) in ((Device.draw picture) - [@res.uapp ])) + ((let module Device = (val + (Hashtbl.find devices device_name : (module DEVICE))) in + Device.draw picture) [@res.braces ]))) [@res.arity 2]) module New_three = (val (three : (module X_int))) diff --git a/jscomp/syntax/tests/parsing/grammar/modexpr/expected/functor.res.txt b/jscomp/syntax/tests/parsing/grammar/modexpr/expected/functor.res.txt index 9fd5785bd0..ef100a32bf 100644 --- a/jscomp/syntax/tests/parsing/grammar/modexpr/expected/functor.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/modexpr/expected/functor.res.txt @@ -33,10 +33,7 @@ module Make(Cmp:sig ((Function$ (fun (y : coll) -> fun (e : key) -> - if - ((List.exists ((Function$ (fun x -> ((eq x e)[@res.uapp ]))) - [@res.arity 1]) y) - [@res.uapp ]) + if List.exists ((Function$ (fun x -> eq x e))[@res.arity 1]) y then y else e :: y)) [@res.arity 2]) diff --git a/jscomp/syntax/tests/parsing/grammar/pattern/expected/constant.res.txt b/jscomp/syntax/tests/parsing/grammar/pattern/expected/constant.res.txt index 8dad10cd68..add745ee57 100644 --- a/jscomp/syntax/tests/parsing/grammar/pattern/expected/constant.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/pattern/expected/constant.res.txt @@ -45,26 +45,22 @@ let f = ((Function$ (fun (1 : int) -> ()))[@res.arity 1]) ;;for i as x = 0 to 10 do () done ;;match listPatterns with | (true, pattern)::patterns -> - let patterns = - ((List.rev ((List.map filterSpread patterns)[@res.uapp ])) - [@res.uapp ]) in - ((makeListPattern loc patterns (Some pattern))[@res.uapp ]) + let patterns = List.rev (List.map filterSpread patterns) in + makeListPattern loc patterns (Some pattern) | patterns -> - let patterns = - ((List.rev ((List.map filterSpread patterns)[@res.uapp ])) - [@res.uapp ]) in - ((makeListPattern loc patterns None)[@res.uapp ]) + let patterns = List.rev (List.map filterSpread patterns) in + makeListPattern loc patterns None let _0 = 0x9A let print = ((Function$ (fun ppf -> fun i -> match i.stamp with - | 0 -> ((fprintf ppf {js|%s!|js} i.name)[@res.uapp ]) - | (-1) -> ((fprintf ppf {js|%s#|js} i.name)[@res.uapp ]) - | 1 -> ((fprintf ppf {js|%s#|js} i.name)[@res.uapp ]) - | (-1.) -> ((fprintf ppf {js|%s#|js} i.name)[@res.uapp ]) - | 1. -> ((fprintf ppf {js|%s#|js} i.name)[@res.uapp ]))) + | 0 -> fprintf ppf {js|%s!|js} i.name + | (-1) -> fprintf ppf {js|%s#|js} i.name + | 1 -> fprintf ppf {js|%s#|js} i.name + | (-1.) -> fprintf ppf {js|%s#|js} i.name + | 1. -> fprintf ppf {js|%s#|js} i.name)) [@res.arity 2]) let (-1)..(-1.) = x ;;match science with diff --git a/jscomp/syntax/tests/parsing/grammar/pattern/expected/constructor.res.txt b/jscomp/syntax/tests/parsing/grammar/pattern/expected/constructor.res.txt index ee8410a339..591a6bfb5c 100644 --- a/jscomp/syntax/tests/parsing/grammar/pattern/expected/constructor.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/pattern/expected/constructor.res.txt @@ -74,5 +74,5 @@ let f = ((Function$ (fun (Instance (comp : Component.t) : React.t) -> ())) ;;for Point { x; y; z } = x to y do () done ;;for Point { x; y; z } as p = x to y do () done ;;match truth with - | true -> ((Js.log {js|true|js})[@res.uapp ]) - | false -> ((Js.log {js|false|js})[@res.uapp ]) \ No newline at end of file + | true -> Js.log {js|true|js} + | false -> Js.log {js|false|js} \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/grammar/pattern/expected/firstClassModules.res.txt b/jscomp/syntax/tests/parsing/grammar/pattern/expected/firstClassModules.res.txt index 142cb617dd..bff40ddbbe 100644 --- a/jscomp/syntax/tests/parsing/grammar/pattern/expected/firstClassModules.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/pattern/expected/firstClassModules.res.txt @@ -10,15 +10,12 @@ let sort (type s) = ((module Set) : (module Set.S with type elt = s and type elt2 = t)) -> fun l -> ())) [@res.arity 2]) -let foo = - ((Function$ (fun (module Foo) -> fun baz -> ((Foo.bar baz)[@res.uapp ]))) +let foo = ((Function$ (fun (module Foo) -> fun baz -> Foo.bar baz)) [@res.arity 2]) let bump_list (type a) = ((Function$ (fun ((module B) : (module Bumpable with type t = a)) -> - fun (l : a list) -> - ((List.map ~f:((B.bump l)[@res.namedArgLoc ][@res.uapp ])) - [@res.uapp ]))) + fun (l : a list) -> List.map ~f:((B.bump l)[@res.namedArgLoc ]))) [@res.arity 2]) ;;match x with | (module Set) -> () diff --git a/jscomp/syntax/tests/parsing/grammar/pattern/expected/variants.res.txt b/jscomp/syntax/tests/parsing/grammar/pattern/expected/variants.res.txt index 7f0b809f4c..3ec7ed09e4 100644 --- a/jscomp/syntax/tests/parsing/grammar/pattern/expected/variants.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/pattern/expected/variants.res.txt @@ -73,4 +73,4 @@ let f = ((Function$ (fun (`Instance (comp : Component.t) : React.t) -> ())) | `1 -> () | `42 -> () | `42444 -> () - | `3 (x, y, z) -> ((Js.log3 x y z)[@res.uapp ]) \ No newline at end of file + | `3 (x, y, z) -> Js.log3 x y z \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/grammar/signature/expected/itemExtension.res.txt b/jscomp/syntax/tests/parsing/grammar/signature/expected/itemExtension.res.txt index 83e4bc1a83..bd9926db75 100644 --- a/jscomp/syntax/tests/parsing/grammar/signature/expected/itemExtension.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/signature/expected/itemExtension.res.txt @@ -2,7 +2,6 @@ module type Ext = sig [%%item.extension ] [%%item.extension.with.args {js|argument|js}] - [%%item.extension.with.args - ((Function$ (fun x -> ((f x)[@res.uapp ])))[@res.arity 1])] + [%%item.extension.with.args ((Function$ (fun x -> f x))[@res.arity 1])] [%%item.extension ][@@withAttr ] end \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/grammar/structure/expected/externalDefinition.res.txt b/jscomp/syntax/tests/parsing/grammar/structure/expected/externalDefinition.res.txt index cd22652574..1ed836fd34 100644 --- a/jscomp/syntax/tests/parsing/grammar/structure/expected/externalDefinition.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/structure/expected/externalDefinition.res.txt @@ -10,4 +10,4 @@ external svg : (unit -> React.element, [ `Has_arity1 ]) function$ = "svg" external svg : (unit -> React.element, [ `Has_arity1 ]) function$ = "svg" external createDate : (unit -> unit -> date, [ `Has_arity2 ]) function$ = "Date"[@@new ] -let foobar = ((((createDate ())[@res.uapp ]) ())[@res.uapp ]) \ No newline at end of file +let foobar = (createDate ()) () \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/grammar/structure/expected/itemExtension.res.txt b/jscomp/syntax/tests/parsing/grammar/structure/expected/itemExtension.res.txt index 309411dc36..79c8084e6a 100644 --- a/jscomp/syntax/tests/parsing/grammar/structure/expected/itemExtension.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/structure/expected/itemExtension.res.txt @@ -1,6 +1,5 @@ [%%itemExtension ] [%%item.extension ] [%%item.extension.with.args {js|argument|js}] -[%%item.extension.with.args - ((Function$ (fun x -> ((f x)[@res.uapp ])))[@res.arity 1])] +[%%item.extension.with.args ((Function$ (fun x -> f x))[@res.arity 1])] [%%itemExtension ][@@attrOnExtension ] \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/grammar/structure/expected/letBinding.res.txt b/jscomp/syntax/tests/parsing/grammar/structure/expected/letBinding.res.txt index 704106b96f..0d8bf07a45 100644 --- a/jscomp/syntax/tests/parsing/grammar/structure/expected/letBinding.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/structure/expected/letBinding.res.txt @@ -6,11 +6,8 @@ let f : type t. t foo = ((Function$ (fun sideEffect -> ((let module M = struct exception E of t end in - ((sideEffect ()) - [@res.uapp ]); - ((Function$ ((fun x -> M.E x))) - [@res.arity 1])) + sideEffect (); ((Function$ ((fun x -> M.E x)))[@res.arity 1])) [@res.braces ]))) [@res.arity 1]) -let f : type t x u. (t * x * y) list = - ((Function$ (fun l -> ((f l)[@res.uapp ])))[@res.arity 1]) \ No newline at end of file +let f : type t x u. (t * x * y) list = ((Function$ (fun l -> f l)) + [@res.arity 1]) \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/grammar/structure/expected/modExprExtension.res.txt b/jscomp/syntax/tests/parsing/grammar/structure/expected/modExprExtension.res.txt index 866d9e8514..4d4b2404ac 100644 --- a/jscomp/syntax/tests/parsing/grammar/structure/expected/modExprExtension.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/structure/expected/modExprExtension.res.txt @@ -2,5 +2,4 @@ module A = [%modExprExtension ] module B = [%mod.expr.extension ] module C = [%mod.expr.extension.with.args {js|argument|js}] module D = - [%mod.expr.extension.with.args - ((Function$ (fun x -> ((f x)[@res.uapp ])))[@res.arity 1])] \ No newline at end of file + [%mod.expr.extension.with.args ((Function$ (fun x -> f x))[@res.arity 1])] \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/grammar/structure/expected/moduleTypeExtension.res.txt b/jscomp/syntax/tests/parsing/grammar/structure/expected/moduleTypeExtension.res.txt index 7b8a5db29d..b3d4e58075 100644 --- a/jscomp/syntax/tests/parsing/grammar/structure/expected/moduleTypeExtension.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/structure/expected/moduleTypeExtension.res.txt @@ -2,5 +2,4 @@ module type A = [%modTypeExtension ] module type B = [%mod.type.extension ] module type C = [%mod.type.extension.with.args {js|argument|js}] module type D = - [%mod.type.extension.with.args - ((Function$ (fun x -> ((f x)[@res.uapp ])))[@res.arity 1])] \ No newline at end of file + [%mod.type.extension.with.args ((Function$ (fun x -> f x))[@res.arity 1])] \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/grammar/typexpr/expected/firstClassModules.res.txt b/jscomp/syntax/tests/parsing/grammar/typexpr/expected/firstClassModules.res.txt index 9349ef39a6..447d072667 100644 --- a/jscomp/syntax/tests/parsing/grammar/typexpr/expected/firstClassModules.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/typexpr/expected/firstClassModules.res.txt @@ -6,5 +6,4 @@ type nonrec toValueLikeInstance = function$ type nonrec 'a t = (module Test with type a = 'a) type nonrec t = (module Console) ref -let (devices : (string, (module DEVICE)) Hastbl.t) = ((Hashtbl.creat 17) - [@res.uapp ]) \ No newline at end of file +let (devices : (string, (module DEVICE)) Hastbl.t) = Hashtbl.creat 17 \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/grammar/typexpr/expected/objectTypeSpreading.res.txt b/jscomp/syntax/tests/parsing/grammar/typexpr/expected/objectTypeSpreading.res.txt index d022b4c704..daf3a17b05 100644 --- a/jscomp/syntax/tests/parsing/grammar/typexpr/expected/objectTypeSpreading.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/typexpr/expected/objectTypeSpreading.res.txt @@ -16,23 +16,22 @@ let steve = ((([%obj { name = {js|Steve|js}; age = 30 }] : < user ;age: int > )) [@res.braces ]) let printFullUser = - ((Function$ - (fun (steve : < user ;age: int > ) -> ((Js.log steve)[@res.uapp ]))) + ((Function$ (fun (steve : < user ;age: int > ) -> Js.log steve)) [@res.arity 1]) let printFullUser = ((Function$ (fun ~user:(((user : < user ;age: int > ))[@res.namedArgLoc ]) -> - ((Js.log steve)[@res.uapp ]))) + Js.log steve)) [@res.arity 1]) let printFullUser = ((Function$ (fun ~user:(((user : < user ;age: int > ))[@res.namedArgLoc ]) -> - ((Js.log steve)[@res.uapp ]))) + Js.log steve)) [@res.arity 1]) let printFullUser = ((Function$ (fun ?user:(((user)[@res.namedArgLoc ])= - (steve : < user ;age: int > )) -> ((Js.log steve)[@res.uapp ]))) + (steve : < user ;age: int > )) -> Js.log steve)) [@res.arity 1]) external steve : < user ;age: int > = "steve"[@@val ] let makeCeoOf30yearsOld = diff --git a/jscomp/syntax/tests/parsing/grammar/typexpr/expected/unit.res.txt b/jscomp/syntax/tests/parsing/grammar/typexpr/expected/unit.res.txt index ff4b761fe8..de2e44b365 100644 --- a/jscomp/syntax/tests/parsing/grammar/typexpr/expected/unit.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/typexpr/expected/unit.res.txt @@ -3,19 +3,14 @@ type nonrec t = (unit -> unit, [ `Has_arity1 ]) function$ type nonrec t = (unit -> unit -> unit, [ `Has_arity2 ]) function$ type nonrec t = (unit -> unit, [ `Has_arity1 ]) function$ let f = - ((Function$ - (fun (f : (unit -> unit, [ `Has_arity1 ]) function$) -> ((f ()) - [@res.uapp ]))) + ((Function$ (fun (f : (unit -> unit, [ `Has_arity1 ]) function$) -> f ())) [@res.arity 1]) let f = - ((Function$ - (fun (f : (unit -> unit, [ `Has_arity1 ]) function$) -> ((f ()) - [@res.uapp ]))) + ((Function$ (fun (f : (unit -> unit, [ `Has_arity1 ]) function$) -> f ())) [@res.arity 1]) let f = ((Function$ - (fun (f : (unit -> unit -> unit, [ `Has_arity2 ]) function$) -> - ((f () ())[@res.uapp ]))) + (fun (f : (unit -> unit -> unit, [ `Has_arity2 ]) function$) -> f () ())) [@res.arity 1]) external svg : (unit -> React.element, [ `Has_arity1 ]) function$ = "svg" external thing : (unit -> unit, [ `Has_arity1 ]) function$ = "svg" \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/infiniteLoops/expected/equalAfterBinaryExpr.res.txt b/jscomp/syntax/tests/parsing/infiniteLoops/expected/equalAfterBinaryExpr.res.txt index aef1717ef0..fe3aa4a269 100644 --- a/jscomp/syntax/tests/parsing/infiniteLoops/expected/equalAfterBinaryExpr.res.txt +++ b/jscomp/syntax/tests/parsing/infiniteLoops/expected/equalAfterBinaryExpr.res.txt @@ -21,60 +21,46 @@ let rec _addLoop = then () else if - (((let uncle = ((uncleOf currentNode)[@res.uapp ]) in + (((let uncle = uncleOf currentNode in (uncle != None) && ((uncle |.u castNotOption).color == Red))) [@res.braces ]) then ((currentNode.parent |.u castNotOption).color <- Black; - (((uncleOf currentNode)[@res.uapp ]) |.u castNotOption).color - <- Black; - (((grandParentOf currentNode)[@res.uapp ]) |.u - castNotOption).color - <- Red; - ((_addLoop rbt - (((grandParentOf currentNode)[@res.uapp ]) |.u - castNotOption)) - [@res.uapp ])) + ((uncleOf currentNode) |.u castNotOption).color <- Black; + ((grandParentOf currentNode) |.u castNotOption).color <- + Red; + _addLoop rbt + ((grandParentOf currentNode) |.u castNotOption)) else (let currentNode = if - (not ((isLeft currentNode)[@res.uapp ])) && - ((isLeft (currentNode.parent |.u castNotOption)) - [@res.uapp ]) + (not (isLeft currentNode)) && + (isLeft (currentNode.parent |.u castNotOption)) then - (((rotateLeft rbt - (currentNode.parent |.u castNotOption)) - [@res.uapp ]); + (rotateLeft rbt + (currentNode.parent |.u castNotOption); currentNode.left |.u castNotOption) else if - ((isLeft currentNode)[@res.uapp ]) && + (isLeft currentNode) && (not - ((isLeft - (currentNode.parent |.u castNotOption)) - [@res.uapp ])) + (isLeft (currentNode.parent |.u castNotOption))) then - (((rotateRight rbt - (currentNode.parent |.u castNotOption)) - [@res.uapp ]); + (rotateRight rbt + (currentNode.parent |.u castNotOption); currentNode.right |.u castNotOption) else currentNode in (currentNode.parent |.u castNotOption).color <- Black; - (((grandParentOf currentNode)[@res.uapp ]) |.u - castNotOption).color - <- Red; - if ((isLeft currentNode)[@res.uapp ]) + ((grandParentOf currentNode) |.u castNotOption).color <- + Red; + if isLeft currentNode then - ((rotateRight rbt - (((grandParentOf currentNode)[@res.uapp ]) |.u - castNotOption)) - [@res.uapp ]) + rotateRight rbt + ((grandParentOf currentNode) |.u castNotOption) else - ((rotateLeft rbt - (((grandParentOf currentNode)[@res.uapp ]) |.u - castNotOption)) - [@res.uapp ]))) + rotateLeft rbt + ((grandParentOf currentNode) |.u castNotOption))) [@res.braces ]))) [@res.arity 2]) let removeNode = @@ -87,30 +73,28 @@ let removeNode = then (successor.color <- Black; if successor.parent == None - then rbt |.u ((rootSet (Some successor))[@res.uapp ])) + then rbt |.u (rootSet (Some successor))) else - (let break = ((ref false)[@res.uapp ]) in - let successorRef = ((ref successor)[@res.uapp ]) in + (let break = ref false in + let successorRef = ref successor in while not break.contents do let successor = successorRef.contents in match successor.parent with | None -> - (rbt |.u ((rootSet (Some successor))[@res.uapp ]); + (rbt |.u (rootSet (Some successor)); break.contents <- true) | Some successorParent -> - let sibling = ((siblingOf successor)[@res.uapp ]) in + let sibling = siblingOf successor in (if (sibling != None) && ((sibling |.u castNotOption).color == Red) then (successorParent.color <- Red; (sibling |.u castNotOption).color <- Black; - if ((isLeft successor)[@res.uapp ]) - then ((rotateLeft rbt successorParent) - [@res.uapp ]) - else ((rotateRight rbt successorParent) - [@res.uapp ])); - (let sibling = ((siblingOf successor)[@res.uapp ]) in + if isLeft successor + then rotateLeft rbt successorParent + else rotateRight rbt successorParent); + (let sibling = siblingOf successor in let siblingNN = sibling |.u castNotOption in if (successorParent.color == Black) && @@ -151,7 +135,7 @@ let removeNode = then (let sibling = sibling |.u castNotOption in if - ((((isLeft successor)[@res.uapp ]) && + (((isLeft successor) && ((sibling.right == None) || ((sibling.right |.u castNotOption).color == Black))) @@ -163,12 +147,10 @@ let removeNode = (sibling.color <- Red; (sibling.left |.u castNotOption).color <- Black; - ((rotateRight rbt sibling) - [@res.uapp ])) + rotateRight rbt sibling) else if - (((not ((isLeft successor)[@res.uapp ])) - && + (((not (isLeft successor)) && ((sibling.left == None) || ((sibling.left |.u castNotOption).color == Black))) @@ -180,27 +162,23 @@ let removeNode = (sibling.color <- Red; (sibling.right |.u castNotOption).color <- Black; - ((rotateLeft rbt sibling) - [@res.uapp ])); + rotateLeft rbt sibling); break.contents <- true) else - (let sibling = ((siblingOf successor) - [@res.uapp ]) in + (let sibling = siblingOf successor in let sibling = sibling |.u castNotOption in sibling.color <- (successorParent.color); - if ((isLeft successor)[@res.uapp ]) + if isLeft successor then ((sibling.right |.u castNotOption).color <- Black; - ((rotateRight rbt successorParent) - [@res.uapp ])) + rotateRight rbt successorParent) else ((sibling.left |.u castNotOption).color <- Black; - ((rotateLeft rbt successorParent) - [@res.uapp ]))))) + rotateLeft rbt successorParent)))) done)); - if ((isLeaf successor)[@res.uapp ]) + if isLeaf successor then (if (rbt |.u root) == (Some successor) then (rbt |.u root) = None)) diff --git a/jscomp/syntax/tests/parsing/infiniteLoops/expected/nonRecTypes.res.txt b/jscomp/syntax/tests/parsing/infiniteLoops/expected/nonRecTypes.res.txt index f29702c160..b8cab408c9 100644 --- a/jscomp/syntax/tests/parsing/infiniteLoops/expected/nonRecTypes.res.txt +++ b/jscomp/syntax/tests/parsing/infiniteLoops/expected/nonRecTypes.res.txt @@ -86,7 +86,7 @@ include [@res.template ]) ;;Arity_2 (value, value) ;;int - ;;((t value)[@res.uapp ]) = {js||js} + ;;(t value) = {js||js} ;;{js|BS:6.0.1\x84\x95\xa6\xbe\0\0\0#\0\0\0\r\0\0\0&\0\0\0#\x91\xa0\xa0A\xa0$size@\xa0\xa0A\xa0$root@\xa0\xa0A\xa0'compare@@|js} external sizeSet : ('value t -> int -> unit, [ `Has_arity2 ]) function$ = "size" @@ -134,9 +134,7 @@ include let has = ((Function$ (fun rbt -> - fun value -> - ((_findNode rbt ((rootGet rbt)[@res.uapp ]) value) - [@res.uapp ]) != None)) + fun value -> (_findNode rbt (rootGet rbt) value) != None)) [@res.arity 2]) let rec minNode = ((Function$ (fun node -> [%rescript.exprhole ])) [@res.arity 1]) @@ -147,293 +145,195 @@ include (fun rbt -> fun node -> ((let nodeToRemove = - match (((leftGet node)[@res.uapp ]), ((rightGet node) - [@res.uapp ])) - with + match ((leftGet node), (rightGet node)) with | (Some _, Some _) -> let successor = - ((castNotOption - ((minNode ((rightGet node)[@res.uapp ])) - [@res.uapp ])) - [@res.uapp ]) in - (((valueSet node ((valueGet successor)[@res.uapp ])) - [@res.uapp ]); - ((heightSet node ((heightGet successor)[@res.uapp ])) - [@res.uapp ]); + castNotOption (minNode (rightGet node)) in + (valueSet node (valueGet successor); + heightSet node (heightGet successor); successor) | _ -> node in let successor = - match ((leftGet nodeToRemove)[@res.uapp ]) with - | None -> ((rightGet nodeToRemove)[@res.uapp ]) + match leftGet nodeToRemove with + | None -> rightGet nodeToRemove | left -> left in let (successor, isLeaf) = match successor with | None -> let leaf = - ((createNode - ~value:((Js.Internal.raw_expr {js|0|js}) - [@res.namedArgLoc ][@res.uapp ]) ~color:((Black) - [@res.namedArgLoc ]) ~height:((0.) - [@res.namedArgLoc ])) - [@res.uapp ]) in + createNode ~value:((Js.Internal.raw_expr {js|0|js}) + [@res.namedArgLoc ]) ~color:((Black) + [@res.namedArgLoc ]) ~height:((0.) + [@res.namedArgLoc ]) in let isLeaf = - ((Js.Internal.fn_mk1 - ((Function$ (fun x -> x == leaf))[@res.arity 1])) - [@res.uapp ]) in + Js.Internal.fn_mk1 ((Function$ (fun x -> x == leaf)) + [@res.arity 1]) in (leaf, isLeaf) | Some successor -> (successor, - ((Js.Internal.fn_mk1 ((Function$ (fun _ -> false)) - [@res.arity 1]))[@res.uapp ])) in - let nodeParent = ((parentGet nodeToRemove)[@res.uapp ]) in - ((parentSet successor nodeParent) - [@res.uapp ]); + (Js.Internal.fn_mk1 ((Function$ (fun _ -> false)) + [@res.arity 1]))) in + let nodeParent = parentGet nodeToRemove in + parentSet successor nodeParent; (match nodeParent with | None -> () | Some parent -> - ((leftOrRightSet parent ~node:((nodeToRemove) - [@res.namedArgLoc ]) (Some successor)) - [@res.uapp ])); - ((updateSumRecursive rbt successor) - [@res.uapp ]); - if ((colorGet nodeToRemove)[@res.uapp ]) == Black + leftOrRightSet parent ~node:((nodeToRemove) + [@res.namedArgLoc ]) (Some successor)); + updateSumRecursive rbt successor; + if (colorGet nodeToRemove) == Black then - (if ((colorGet successor)[@res.uapp ]) == Red + (if (colorGet successor) == Red then - (((colorSet successor Black) - [@res.uapp ]); - if ((parentGet successor)[@res.uapp ]) == None - then ((rootSet rbt (Some successor))[@res.uapp ])) + (colorSet successor Black; + if (parentGet successor) == None + then rootSet rbt (Some successor)) else - (let break = ((ref false)[@res.uapp ]) in - let successorRef = ((ref successor)[@res.uapp ]) in + (let break = ref false in + let successorRef = ref successor in while not break.contents do let successor = successorRef.contents in - match ((parentGet successor)[@res.uapp ]) with + match parentGet successor with | None -> - (((rootSet rbt (Some successor)) - [@res.uapp ]); + (rootSet rbt (Some successor); break.contents <- true) | Some successorParent -> - let sibling = ((siblingOf successor) - [@res.uapp ]) in + let sibling = siblingOf successor in (if (sibling != None) && - (((colorGet ((castNotOption sibling) - [@res.uapp ])) - [@res.uapp ]) == Red) + ((colorGet (castNotOption sibling)) == Red) then - (((colorSet successorParent Red) - [@res.uapp ]); - ((colorSet ((castNotOption sibling) - [@res.uapp ]) Black) - [@res.uapp ]); - if ((isLeft successor)[@res.uapp ]) - then ((rotateLeft rbt successorParent) - [@res.uapp ]) - else ((rotateRight rbt successorParent) - [@res.uapp ])); - (let sibling = ((siblingOf successor) - [@res.uapp ]) in - let siblingNN = ((castNotOption sibling) - [@res.uapp ]) in + (colorSet successorParent Red; + colorSet (castNotOption sibling) Black; + if isLeft successor + then rotateLeft rbt successorParent + else rotateRight rbt successorParent); + (let sibling = siblingOf successor in + let siblingNN = castNotOption sibling in if - (((colorGet successorParent)[@res.uapp ]) == - Black) - && + ((colorGet successorParent) == Black) && ((sibling == None) || - (((((colorGet siblingNN)[@res.uapp ]) - == Black) - && - ((((leftGet siblingNN)[@res.uapp ]) - == None) - || - (((colorGet - ((castNotOption - ((leftGet siblingNN) - [@res.uapp ])) - [@res.uapp ])) - [@res.uapp ]) == Black))) + ((((colorGet siblingNN) == Black) && + (((leftGet siblingNN) == None) || + ((colorGet + (castNotOption + (leftGet siblingNN))) + == Black))) && - ((((rightGet siblingNN)[@res.uapp ]) - == None) - || - (((colorGet - ((castNotOption - ((rightGet siblingNN) - [@res.uapp ])) - [@res.uapp ])) - [@res.uapp ]) == Black)))) + (((rightGet siblingNN) == None) || + ((colorGet + (castNotOption + (rightGet siblingNN))) + == Black)))) then (if sibling != None - then ((colorSet siblingNN Red)[@res.uapp ]); + then colorSet siblingNN Red; successorRef.contents <- successorParent) else if - (((colorGet successorParent)[@res.uapp ]) - == Red) - && + ((colorGet successorParent) == Red) && ((sibling == None) || - (((((colorGet siblingNN)[@res.uapp ]) - == Black) - && - ((((leftGet siblingNN) - [@res.uapp ]) == None) - || - (((colorGet - ((castNotOption - ((leftGet siblingNN) - [@res.uapp ])) - [@res.uapp ])) - [@res.uapp ]) == Black))) + ((((colorGet siblingNN) == Black) && + (((leftGet siblingNN) == None) || + ((colorGet + (castNotOption + (leftGet siblingNN))) + == Black))) && - ((((rightGet siblingNN) - [@res.uapp ]) == None) - || - (((colorGet - ((castNotOption - ((rightGet siblingNN) - [@res.uapp ])) - [@res.uapp ])) - [@res.uapp ]) == Black)))) + (((rightGet siblingNN) == None) || + ((colorGet + (castNotOption + (rightGet siblingNN))) + == Black)))) then (if sibling != None - then ((colorSet siblingNN Red) - [@res.uapp ]); - ((colorSet successorParent Black) - [@res.uapp ]); + then colorSet siblingNN Red; + colorSet successorParent Black; break.contents <- true) else if (sibling != None) && - (((colorGet ((castNotOption sibling) - [@res.uapp ])) - [@res.uapp ]) == Black) + ((colorGet (castNotOption sibling)) == + Black) then - (let sibling = ((castNotOption sibling) - [@res.uapp ]) in + (let sibling = castNotOption sibling in if - ((((isLeft successor)[@res.uapp ]) && - ((((rightGet sibling) - [@res.uapp ]) == None) - || - (((colorGet - ((castNotOption - ((rightGet sibling) - [@res.uapp ])) - [@res.uapp ])) - [@res.uapp ]) == Black))) - && - (((leftGet sibling)[@res.uapp ]) - != None)) + (((isLeft successor) && + (((rightGet sibling) == None) || + ((colorGet + (castNotOption + (rightGet sibling))) + == Black))) + && ((leftGet sibling) != None)) && - (((colorGet - ((castNotOption - ((leftGet sibling) - [@res.uapp ])) - [@res.uapp ])) - [@res.uapp ]) == Red) + ((colorGet + (castNotOption + (leftGet sibling))) + == Red) then - (((colorSet sibling Red) - [@res.uapp ]); - ((colorSet - ((castNotOption - ((leftGet sibling) - [@res.uapp ]))[@res.uapp ]) - Black) - [@res.uapp ]); - ((rotateRight rbt sibling) - [@res.uapp ])) + (colorSet sibling Red; + colorSet + (castNotOption (leftGet sibling)) + Black; + rotateRight rbt sibling) else if - (((not ((isLeft successor) - [@res.uapp ])) - && - ((((leftGet sibling) - [@res.uapp ]) == None) - || - (((colorGet - ((castNotOption - ((leftGet sibling) - [@res.uapp ])) - [@res.uapp ])) - [@res.uapp ]) == Black))) - && - (((rightGet sibling) - [@res.uapp ]) != None)) + (((not (isLeft successor)) && + (((leftGet sibling) == None) || + ((colorGet + (castNotOption + (leftGet sibling))) + == Black))) + && ((rightGet sibling) != None)) && - (((colorGet - ((castNotOption - ((rightGet sibling) - [@res.uapp ])) - [@res.uapp ])) - [@res.uapp ]) == Red) + ((colorGet + (castNotOption + (rightGet sibling))) + == Red) then - (((colorSet sibling Red) - [@res.uapp ]); - ((colorSet - ((castNotOption - ((rightGet sibling) - [@res.uapp ])) - [@res.uapp ]) Black) - [@res.uapp ]); - ((rotateLeft rbt sibling) - [@res.uapp ])); + (colorSet sibling Red; + colorSet + (castNotOption + (rightGet sibling)) Black; + rotateLeft rbt sibling); break.contents <- true) else - (let sibling = ((siblingOf successor) - [@res.uapp ]) in - let sibling = ((castNotOption sibling) - [@res.uapp ]) in - ((colorSet sibling - ((colorGet successorParent) - [@res.uapp ])) - [@res.uapp ]); - if ((isLeft successor)[@res.uapp ]) + (let sibling = siblingOf successor in + let sibling = castNotOption sibling in + colorSet sibling + (colorGet successorParent); + if isLeft successor then - (((colorSet - ((castNotOption - ((rightGet sibling) - [@res.uapp ]))[@res.uapp ]) - Black) - [@res.uapp ]); - ((rotateRight rbt successorParent) - [@res.uapp ])) + (colorSet + (castNotOption (rightGet sibling)) + Black; + rotateRight rbt successorParent) else - (((colorSet - ((castNotOption - ((leftGet sibling) - [@res.uapp ]))[@res.uapp ]) - Black) - [@res.uapp ]); - ((rotateLeft rbt successorParent) - [@res.uapp ]))))) + (colorSet + (castNotOption (leftGet sibling)) + Black; + rotateLeft rbt successorParent)))) done)); - if ((Js.Internal.fn_run1 isLeaf successor)[@res.uapp ]) + if Js.Internal.fn_run1 isLeaf successor then - (if ((rootGet rbt)[@res.uapp ]) == (Some successor) - then ((rootSet rbt None)[@res.uapp ]); - (match ((parentGet successor)[@res.uapp ]) with + (if (rootGet rbt) == (Some successor) + then rootSet rbt None; + (match parentGet successor with | None -> () | Some parent -> - ((leftOrRightSet parent ~node:((successor) - [@res.namedArgLoc ]) None) - [@res.uapp ])))) + leftOrRightSet parent ~node:((successor) + [@res.namedArgLoc ]) None))) [@res.braces ]))) [@res.arity 2]) let remove = ((Function$ (fun rbt -> fun value -> - match ((_findNode rbt ((rootGet rbt)[@res.uapp ]) value) - [@res.uapp ]) - with + match _findNode rbt (rootGet rbt) value with | Some node -> - (((removeNode rbt node) - [@res.uapp ]); - ((sizeSet rbt (((sizeGet rbt)[@res.uapp ]) - 1)) - [@res.uapp ]); - Some ((heightGet node)[@res.uapp ])) + (removeNode rbt node; + sizeSet rbt ((sizeGet rbt) - 1); + Some (heightGet node)) | None -> None)) [@res.arity 2]) let findThroughCallback = @@ -449,36 +349,28 @@ include | None -> None | Some node -> let cmp = - ((Js.Internal.fn_run1 cb ((valueGet node) - [@res.uapp ])) - [@res.uapp ]) in + Js.Internal.fn_run1 cb (valueGet node) in if cmp == 0 then Some node else if cmp < 0 then - ((findThroughCallback rbt - ((leftGet node)[@res.uapp ]) cb) - [@res.uapp ]) + findThroughCallback rbt (leftGet node) + cb else - ((findThroughCallback rbt - ((rightGet node)[@res.uapp ]) cb) - [@res.uapp ]))) + findThroughCallback rbt (rightGet node) + cb)) [@res.arity 3]) in - match ((findThroughCallback rbt ((rootGet rbt)[@res.uapp ]) - cb) - [@res.uapp ]) - with + match findThroughCallback rbt (rootGet rbt) cb with | None -> None - | Some node -> Some ((valueGet node)[@res.uapp ])) + | Some node -> Some (valueGet node)) [@res.braces ]))) [@res.arity 2]) let make = ((Function$ (fun ~compare:((compare)[@res.namedArgLoc ]) -> - ((t ~size:((0)[@res.namedArgLoc ]) ~root:((None) - [@res.namedArgLoc ]) ~compare:((compare)[@res.namedArgLoc ])) - [@res.uapp ]))) + t ~size:((0)[@res.namedArgLoc ]) ~root:((None) + [@res.namedArgLoc ]) ~compare:((compare)[@res.namedArgLoc ]))) [@res.arity 1]) let rec heightOfInterval = ((Function$ @@ -490,46 +382,31 @@ include | None -> 0. | Some n -> if (lhs == None) && (rhs == None) - then ((sumGet n)[@res.uapp ]) + then sumGet n else if (lhs != None) && - (((Js.Internal.fn_run2 ((compareGet rbt) - [@res.uapp ]) ((valueGet n)[@res.uapp ]) - ((castNotOption lhs)[@res.uapp ])) - [@res.uapp ]) < 0) - then - ((heightOfInterval rbt ((rightGet n)[@res.uapp ]) - lhs rhs) - [@res.uapp ]) + ((Js.Internal.fn_run2 (compareGet rbt) + (valueGet n) (castNotOption lhs)) + < 0) + then heightOfInterval rbt (rightGet n) lhs rhs else if (rhs != None) && - (((Js.Internal.fn_run2 ((compareGet rbt) - [@res.uapp ]) ((valueGet n)[@res.uapp ]) - ((castNotOption rhs)[@res.uapp ])) - [@res.uapp ]) > 0) - then - ((heightOfInterval rbt ((leftGet n)[@res.uapp ]) - lhs rhs) - [@res.uapp ]) + ((Js.Internal.fn_run2 (compareGet rbt) + (valueGet n) (castNotOption rhs)) + > 0) + then heightOfInterval rbt (leftGet n) lhs rhs else - (((heightGet n)[@res.uapp ]) +. - ((heightOfInterval rbt ((leftGet n) - [@res.uapp ]) lhs None) - [@res.uapp ])) + ((heightGet n) +. + (heightOfInterval rbt (leftGet n) lhs None)) +. - ((heightOfInterval rbt ((rightGet n) - [@res.uapp ]) None rhs) - [@res.uapp ]))) + (heightOfInterval rbt (rightGet n) None rhs))) [@res.arity 4]) let heightOfInterval = ((Function$ (fun rbt -> - fun lhs -> - fun rhs -> - ((heightOfInterval rbt ((rootGet rbt)[@res.uapp ]) lhs rhs) - [@res.uapp ]))) + fun lhs -> fun rhs -> heightOfInterval rbt (rootGet rbt) lhs rhs)) [@res.arity 3]) let rec firstVisibleNode = ((Function$ @@ -538,98 +415,86 @@ include match node with | None -> None | Some node -> - if ((sumGet node)[@res.uapp ]) <= offset + if (sumGet node) <= offset then None else - (let nodeHeight = ((heightGet node)[@res.uapp ]) in + (let nodeHeight = heightGet node in let sumLeft = - match ((leftGet node)[@res.uapp ]) with + match leftGet node with | None -> 0.0 - | Some left -> ((sumGet left)[@res.uapp ]) in + | Some left -> sumGet left in if sumLeft > offset - then - ((firstVisibleNode ((leftGet node)[@res.uapp ]) - offset) - [@res.uapp ]) + then firstVisibleNode (leftGet node) offset else if (sumLeft +. nodeHeight) > offset then Some node else - ((firstVisibleNode ((rightGet node)[@res.uapp ]) - (offset -. (sumLeft +. nodeHeight))) - [@res.uapp ])))) + firstVisibleNode (rightGet node) + (offset -. (sumLeft +. nodeHeight))))) [@res.arity 2]) let lastVisibleNode = ((Function$ (fun node -> fun offset -> - match ((firstVisibleNode node offset)[@res.uapp ]) with - | None -> ((maxNode node)[@res.uapp ]) + match firstVisibleNode node offset with + | None -> maxNode node | first -> first)) [@res.arity 2]) let firstVisible = ((Function$ (fun rbt -> fun ~offset:((offset)[@res.namedArgLoc ]) -> - match ((firstVisibleNode ((rootGet rbt)[@res.uapp ]) offset) - [@res.uapp ]) - with + match firstVisibleNode (rootGet rbt) offset with | None -> None - | Some node -> Some ((valueGet node)[@res.uapp ]))) + | Some node -> Some (valueGet node))) [@res.arity 2]) let rec leftmost = ((Function$ (fun node -> - match ((leftGet node)[@res.uapp ]) with + match leftGet node with | None -> node - | Some node -> ((leftmost node)[@res.uapp ]))) + | Some node -> leftmost node)) [@res.arity 1]) let rec firstRightParent = ((Function$ (fun node -> - match ((parentGet node)[@res.uapp ]) with + match parentGet node with | None -> None | Some parent -> - if ((isLeft node)[@res.uapp ]) - then Some parent - else ((firstRightParent parent)[@res.uapp ]))) + if isLeft node then Some parent else firstRightParent parent)) [@res.arity 1]) let nextNode = ((Function$ (fun node -> - match ((rightGet node)[@res.uapp ]) with - | None -> ((firstRightParent node)[@res.uapp ]) - | Some right -> Some ((leftmost right)[@res.uapp ]))) + match rightGet node with + | None -> firstRightParent node + | Some right -> Some (leftmost right))) [@res.arity 1]) let rec sumLeftSpine = ((Function$ (fun node -> fun ~fromRightChild:((fromRightChild)[@res.namedArgLoc ]) -> ((let leftSpine = - match ((leftGet node)[@res.uapp ]) with - | None -> ((heightGet node)[@res.uapp ]) + match leftGet node with + | None -> heightGet node | Some left -> if fromRightChild - then - ((heightGet node)[@res.uapp ]) +. ((sumGet left) - [@res.uapp ]) + then (heightGet node) +. (sumGet left) else 0.0 in - match ((parentGet node)[@res.uapp ]) with + match parentGet node with | None -> leftSpine | Some parent -> leftSpine +. - ((sumLeftSpine parent - ~fromRightChild:((((rightGet parent)[@res.uapp ]) - == (Some node)) - [@res.namedArgLoc ])) - [@res.uapp ])) + (sumLeftSpine parent + ~fromRightChild:(((rightGet parent) == (Some node)) + [@res.namedArgLoc ]))) [@res.braces ]))) [@res.arity 2]) let getY = ((Function$ (fun node -> - ((sumLeftSpine node ~fromRightChild:((true)[@res.namedArgLoc ])) - [@res.uapp ]) -. ((heightGet node)[@res.uapp ]))) + (sumLeftSpine node ~fromRightChild:((true)[@res.namedArgLoc ])) + -. (heightGet node))) [@res.arity 1]) let linearSearch = ((Function$ @@ -639,21 +504,16 @@ include ((Function$ (fun node -> fun callback -> - if - ((Js.Internal.fn_run1 callback ((valueGet node) - [@res.uapp ])) - [@res.uapp ]) - then Some ((valueGet node)[@res.uapp ]) + if Js.Internal.fn_run1 callback (valueGet node) + then Some (valueGet node) else - (match ((nextNode node)[@res.uapp ]) with + (match nextNode node with | None -> None - | Some node -> ((find node callback) - [@res.uapp ])))) + | Some node -> find node callback))) [@res.arity 2]) in - match ((minNode ((rootGet rbt)[@res.uapp ]))[@res.uapp ]) - with + match minNode (rootGet rbt) with | None -> None - | Some node -> ((find node callback)[@res.uapp ])) + | Some node -> find node callback) [@res.braces ]))) [@res.arity 2]) let rec iterate = @@ -665,19 +525,14 @@ include match firstNode with | None -> () | Some node -> - (if inclusive - then ((Js.Internal.fn_run1 callback node) - [@res.uapp ]); + (if inclusive then Js.Internal.fn_run1 callback node; if firstNode != lastNode then (if not inclusive - then ((Js.Internal.fn_run1 callback node) - [@res.uapp ]); - ((iterate ~inclusive:((inclusive) - [@res.namedArgLoc ]) ((nextNode node) - [@res.uapp ]) lastNode ~callback:((callback) - [@res.namedArgLoc ])) - [@res.uapp ]))))) + then Js.Internal.fn_run1 callback node; + iterate ~inclusive:((inclusive) + [@res.namedArgLoc ]) (nextNode node) lastNode + ~callback:((callback)[@res.namedArgLoc ]))))) [@res.arity 4]) let rec iterateWithY = ((Function$ @@ -690,24 +545,17 @@ include | None -> () | Some node -> let y = - match y with - | None -> ((getY node)[@res.uapp ]) - | Some y -> y in + match y with | None -> getY node | Some y -> y in (if inclusive - then ((Js.Internal.fn_run2 callback node y) - [@res.uapp ]); + then Js.Internal.fn_run2 callback node y; if firstNode != lastNode then (if not inclusive - then ((Js.Internal.fn_run2 callback node y) - [@res.uapp ]); - ((iterateWithY - ~y:((y +. ((heightGet node)[@res.uapp ])) - [@res.namedArgLoc ]) ~inclusive:((inclusive) - [@res.namedArgLoc ]) ((nextNode node) - [@res.uapp ]) lastNode ~callback:((callback) - [@res.namedArgLoc ])) - [@res.uapp ]))))) + then Js.Internal.fn_run2 callback node y; + iterateWithY ~y:((y +. (heightGet node)) + [@res.namedArgLoc ]) ~inclusive:((inclusive) + [@res.namedArgLoc ]) (nextNode node) lastNode + ~callback:((callback)[@res.namedArgLoc ]))))) [@res.arity 5]) let rec updateSum = ((Function$ @@ -716,28 +564,22 @@ include match node with | None -> () | Some node -> - (((sumSet node (((sumGet node)[@res.uapp ]) +. delta)) - [@res.uapp ]); - ((updateSum ((parentGet node)[@res.uapp ]) - ~delta:((delta)[@res.namedArgLoc ])) - [@res.uapp ])))) + (sumSet node ((sumGet node) +. delta); + updateSum (parentGet node) ~delta:((delta) + [@res.namedArgLoc ])))) [@res.arity 2]) let setHeight = ((Function$ (fun rbt -> fun value -> fun ~height:((height)[@res.namedArgLoc ]) -> - match ((_findNode rbt ((rootGet rbt)[@res.uapp ]) value) - [@res.uapp ]) - with + match _findNode rbt (rootGet rbt) value with | None -> () | Some node -> - let delta = height -. ((heightGet node)[@res.uapp ]) in - (((heightSet node height) - [@res.uapp ]); - ((updateSum (Some node) ~delta:((delta) - [@res.namedArgLoc ])) - [@res.uapp ])))) + let delta = height -. (heightGet node) in + (heightSet node height; + updateSum (Some node) ~delta:((delta) + [@res.namedArgLoc ])))) [@res.arity 3]) type nonrec 'value oldNewVisibleNodes = { diff --git a/jscomp/syntax/tests/parsing/other/expected/list.res.txt b/jscomp/syntax/tests/parsing/other/expected/list.res.txt index 737f92c358..0283da1149 100644 --- a/jscomp/syntax/tests/parsing/other/expected/list.res.txt +++ b/jscomp/syntax/tests/parsing/other/expected/list.res.txt @@ -3,5 +3,5 @@ let x = list + list let f = Foo.list let x = list.list let y = Ok.Bar.list -;;((list a b)[@res.uapp ]) +;;list a b ;;list.list <- list \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/other/expected/singleLineCommentWithoutNewline.res.txt b/jscomp/syntax/tests/parsing/other/expected/singleLineCommentWithoutNewline.res.txt index 66e04e9834..af7fe8e4a4 100644 --- a/jscomp/syntax/tests/parsing/other/expected/singleLineCommentWithoutNewline.res.txt +++ b/jscomp/syntax/tests/parsing/other/expected/singleLineCommentWithoutNewline.res.txt @@ -1 +1 @@ -;;((RootView.init ())[@res.uapp ]) \ No newline at end of file +;;RootView.init () \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/recovery/expression/expected/if.res.txt b/jscomp/syntax/tests/parsing/recovery/expression/expected/if.res.txt index ad87666e75..3e4d5bcb43 100644 --- a/jscomp/syntax/tests/parsing/recovery/expression/expected/if.res.txt +++ b/jscomp/syntax/tests/parsing/recovery/expression/expected/if.res.txt @@ -16,6 +16,4 @@ Did you forget a `{` here? -;;if foo = bar - then ((Js.log {js|if-branch|js})[@res.uapp ]) - else ((Js.log {js|else-branch|js})[@res.uapp ]) \ No newline at end of file +;;if foo = bar then Js.log {js|if-branch|js} else Js.log {js|else-branch|js} \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/recovery/expression/expected/infinite.res.txt b/jscomp/syntax/tests/parsing/recovery/expression/expected/infinite.res.txt index 7ee261130c..90da3f773b 100644 --- a/jscomp/syntax/tests/parsing/recovery/expression/expected/infinite.res.txt +++ b/jscomp/syntax/tests/parsing/recovery/expression/expected/infinite.res.txt @@ -1 +1 @@ -let smallest = ((heap.compare ())[@res.uapp ]) < (a |.u ((f b)[@res.uapp ])) \ No newline at end of file +let smallest = (heap.compare ()) < (a |.u (f b)) \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/recovery/expression/expected/list.res.txt b/jscomp/syntax/tests/parsing/recovery/expression/expected/list.res.txt index 34fe2a4666..670bd8558a 100644 --- a/jscomp/syntax/tests/parsing/recovery/expression/expected/list.res.txt +++ b/jscomp/syntax/tests/parsing/recovery/expression/expected/list.res.txt @@ -29,20 +29,19 @@ Solution: if it's to validate the first few elements, use a `when` clause + Arra let flags = ((if reasonFormat then - ((let parts = ((Utils.split_on_char ' ' flags)[@res.uapp ]) in + ((let parts = Utils.split_on_char ' ' flags in let rec loop = ((Function$ (fun items -> ((match items with - | [|{js|-pp|js};_ppFlag;rest|] -> ((loop rest) - [@res.uapp ]) + | [|{js|-pp|js};_ppFlag;rest|] -> loop rest | [|x;rest|] -> ((Belt.Array.concatMany)[@res.spread ]) - [|[|x|];((loop rest)[@res.uapp ])|] + [|[|x|];(loop rest)|] | [||] -> [||]) [@res.braces ]))) [@res.arity 1]) in - ((String.concat {js| |js} ((loop parts)[@res.uapp ]))[@res.uapp ])) + String.concat {js| |js} (loop parts)) [@res.braces ]) else flags) [@res.ternary ]) \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/recovery/structure/expected/letBinding.res.txt b/jscomp/syntax/tests/parsing/recovery/structure/expected/letBinding.res.txt index 08ffa1f01c..2f07041c32 100644 --- a/jscomp/syntax/tests/parsing/recovery/structure/expected/letBinding.res.txt +++ b/jscomp/syntax/tests/parsing/recovery/structure/expected/letBinding.res.txt @@ -7,4 +7,4 @@ This let-binding misses an expression -let x = ((doStuff y)[@res.uapp ]) \ No newline at end of file +let x = doStuff y \ No newline at end of file