Skip to content

Commit 02f3bd4

Browse files
committed
Rename uncurried$ to function$
1 parent 38c5bf0 commit 02f3bd4

11 files changed

+27
-28
lines changed

jscomp/frontend/ast_core_type.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ let get_uncurry_arity (ty : t) =
133133
let get_curry_arity (ty : t) =
134134
match ty.ptyp_desc with
135135
| Ptyp_constr ({ txt = Ldot (Ldot (Lident "Js", "Fn"), _) }, [ t ])
136-
| Ptyp_constr ({ txt = Lident "uncurried$" }, [ t; _ ]) ->
136+
| Ptyp_constr ({ txt = Lident "function$" }, [ t; _ ]) ->
137137
get_uncurry_arity_aux t 0
138138
| _ -> get_uncurry_arity_aux ty 0
139139

jscomp/frontend/ast_core_type_class_type.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ let typ_mapper (self : Bs_ast_mapper.mapper) (ty : Parsetree.core_type) =
7676
[ { ptyp_desc = Ptyp_arrow (label, args, body) } ] )
7777
| Ptyp_constr
7878
(* Js.uncurried is re-wrapped around only in case Nothing below *)
79-
( { txt = Lident "uncurried$" },
79+
( { txt = Lident "function$" },
8080
[ { ptyp_desc = Ptyp_arrow (label, args, body) }; _ ] ) );
8181
(* let it go without regard label names,
8282
it will report error later when the label is not empty

jscomp/frontend/ast_external_process.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ let handle_attributes (loc : Bs_loc.t) (type_annotation : Parsetree.core_type)
870870
let prim_name_with_source = { name = prim_name; source = External } in
871871
let type_annotation, build_uncurried_type =
872872
match type_annotation.ptyp_desc with
873-
| Ptyp_constr (({ txt = Lident "uncurried$"; _ } as lid), [ t; arity_ ]) ->
873+
| Ptyp_constr (({ txt = Lident "function$"; _ } as lid), [ t; arity_ ]) ->
874874
( t,
875875
fun ~arity x ->
876876
let tArity =

jscomp/ml/ast_uncurried.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ let uncurriedType ~loc ~arity tArg =
1414
if new_representation arity then
1515
let tArity = arityType ~loc arity in
1616
Ast_helper.Typ.constr ~loc
17-
{ txt = Lident "uncurried$"; loc }
17+
{ txt = Lident "function$"; loc }
1818
[ tArg; tArity ]
1919
else
2020
Ast_helper.Typ.constr ~loc
@@ -55,7 +55,7 @@ let uncurriedFun ~loc ~arity funExpr =
5555
if new_representation arity then
5656
Ast_helper.Exp.construct ~loc
5757
~attrs:(arity_to_attributes arity)
58-
{ txt = Lident "Uncurried$"; loc }
58+
{ txt = Lident "Function$"; loc }
5959
(Some funExpr)
6060
else
6161
Ast_helper.Exp.record ~loc
@@ -73,14 +73,14 @@ let exprIsUncurriedFun (expr : Parsetree.expression) =
7373
| Pexp_record ([ ({ txt = Ldot (Ldot (Lident "Js", "Fn"), _) }, _e) ], None)
7474
->
7575
true
76-
| Pexp_construct ({ txt = Lident "Uncurried$" }, Some _) -> true
76+
| Pexp_construct ({ txt = Lident "Function$" }, Some _) -> true
7777
| _ -> false
7878

7979
let exprExtractUncurriedFun (expr : Parsetree.expression) =
8080
match expr.pexp_desc with
8181
| Pexp_record ([ ({ txt = Ldot (Ldot (Lident "Js", "Fn"), _) }, e) ], None) ->
8282
e
83-
| Pexp_construct ({ txt = Lident "Uncurried$" }, Some e) -> e
83+
| Pexp_construct ({ txt = Lident "Function$" }, Some e) -> e
8484
| _ -> assert false
8585

8686
(* Typed AST *)
@@ -105,12 +105,12 @@ let type_to_arity (tArity : Types.type_expr) =
105105

106106
let mk_js_fn ~env ~arity t =
107107
let typ_arity = arity_to_type arity in
108-
let lid : Longident.t = Lident "uncurried$" in
108+
let lid : Longident.t = Lident "function$" in
109109
let path = Env.lookup_type lid env in
110110
Ctype.newconstr path [ t; typ_arity ]
111111

112112
let uncurried_type_get_arity ~env typ =
113113
match (Ctype.expand_head env typ).desc with
114-
| Tconstr (Pident { name = "uncurried$" }, [ _t; tArity ], _) ->
114+
| Tconstr (Pident { name = "function$" }, [ _t; tArity ], _) ->
115115
type_to_arity tArity
116116
| _ -> assert false

jscomp/ml/predef.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ and ident_floatarray = ident_create "floatarray"
4949
and ident_unknown = ident_create "unknown"
5050

5151
and ident_promise = ident_create "promise"
52-
and ident_uncurried = ident_create "uncurried$"
52+
and ident_uncurried = ident_create "function$"
5353

5454
type test =
5555
| For_sure_yes
@@ -178,7 +178,7 @@ and ident_cons = ident_create "::"
178178
and ident_none = ident_create "None"
179179
and ident_some = ident_create "Some"
180180
and ident_ctor_unknown = ident_create "Unknown"
181-
and ident_ctor_uncurried = ident_create "Uncurried$"
181+
and ident_ctor_uncurried = ident_create "Function$"
182182

183183
let common_initial_env add_type add_extension empty_env =
184184
let decl_bool =

jscomp/ml/translcore.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ and transl_exp0 (e : Typedtree.expression) : Lambda.lambda =
775775
with Not_constant -> Lprim (Pmakeblock Blk_tuple, ll, e.exp_loc))
776776
| Texp_construct ({ txt = Lident "false" }, _, []) -> Lconst Const_false
777777
| Texp_construct ({ txt = Lident "true" }, _, []) -> Lconst Const_true
778-
| Texp_construct ({ txt = Lident "Uncurried$"}, _, [expr]) ->
778+
| Texp_construct ({ txt = Lident "Function$"}, _, [expr]) ->
779779
(* ReScript uncurried encoding *)
780780
let loc = expr.exp_loc in
781781
let lambda = transl_exp expr in

jscomp/ml/typecore.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2105,7 +2105,7 @@ and type_expect_ ?in_function ?(recarg=Rejected) env sexp ty_expected =
21052105
exp_env = env }
21062106
| Pexp_construct(lid, sarg) ->
21072107
(match lid.txt with
2108-
| Lident "Uncurried$" ->
2108+
| Lident "Function$" ->
21092109
let arity = Ast_uncurried.attributes_to_arity sexp.pexp_attributes in
21102110
let uncurried_typ = Ast_uncurried.mk_js_fn ~env ~arity (newvar()) in
21112111
unify_exp_types loc env ty_expected uncurried_typ
@@ -2998,7 +2998,7 @@ and type_application uncurried env funct (sargs : sargs) : targs * Types.type_ex
29982998
then int_of_string (String.sub a 5 (String.length a - 5))
29992999
else 0 in
30003000
Some (arity, t)
3001-
| Tconstr (Pident {name = "uncurried$"},[t; tArity],_) ->
3001+
| Tconstr (Pident {name = "function$"},[t; tArity],_) ->
30023002
let arity = Ast_uncurried.type_to_arity tArity in
30033003
Some (arity, t)
30043004
| _ -> None in

jscomp/ml/typedecl.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1593,8 +1593,8 @@ let rec parse_native_repr_attributes env core_type ty =
15931593
let parse_native_repr_attributes env core_type ty =
15941594
match core_type.ptyp_desc, (Ctype.repr ty).desc
15951595
with
1596-
| Ptyp_constr ({txt = Lident "uncurried$"}, [{ptyp_desc = Ptyp_arrow (_, _, ct2)}; _]),
1597-
Tconstr (Pident {name = "uncurried$"},[{desc = Tarrow (_, _, t2, _)}; _],_) ->
1596+
| Ptyp_constr ({txt = Lident "function$"}, [{ptyp_desc = Ptyp_arrow (_, _, ct2)}; _]),
1597+
Tconstr (Pident {name = "function$"},[{desc = Tarrow (_, _, t2, _)}; _],_) ->
15981598
let repr_args, repr_res = parse_native_repr_attributes env ct2 t2 in
15991599
let native_repr_args = Same_as_ocaml_repr :: repr_args in
16001600
(native_repr_args, repr_res)

jscomp/super_errors/super_typecore.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ let report_error env ppf = function
183183
)
184184
| Expr_type_clash (
185185
(_, {desc = Tarrow _}) ::
186-
(_, {desc = Tconstr (Pident {name = "uncurried$"},_,_)}) :: _
186+
(_, {desc = Tconstr (Pident {name = "function$"},_,_)}) :: _
187187
) ->
188188
fprintf ppf "This function is a curried function where an uncurried function is expected"
189189
| Expr_type_clash (
@@ -192,8 +192,8 @@ let report_error env ppf = function
192192
) when arityA <> arityB ->
193193
reportJsFnArityMismatch ~arityA ~arityB ppf
194194
| Expr_type_clash (
195-
(_, {desc = Tconstr (Pident {name = "uncurried$"},[_; tA],_)}) ::
196-
(_, {desc = Tconstr (Pident {name = "uncurried$"},[_; tB],_)}) :: _
195+
(_, {desc = Tconstr (Pident {name = "function$"},[_; tA],_)}) ::
196+
(_, {desc = Tconstr (Pident {name = "function$"},[_; tB],_)}) :: _
197197
) when Ast_uncurried.type_to_arity tA <> Ast_uncurried.type_to_arity tB ->
198198
let arityA = Ast_uncurried.type_to_arity tA |> string_of_int in
199199
let arityB = Ast_uncurried.type_to_arity tB |> string_of_int in

res_syntax/src/res_outcome_printer.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,9 @@ let rec printOutTypeDoc (outType : Outcometree.out_type) =
223223
when isArityIdent ident ->
224224
(* Js.Fn.arity2<(int, int) => int> -> (. int, int) => int*)
225225
printOutArrowType ~uncurried:true arrowType
226-
| Otyp_constr (Oide_ident "uncurried$", [(Otyp_arrow _ as arrowType); _arity])
226+
| Otyp_constr (Oide_ident "function$", [(Otyp_arrow _ as arrowType); _arity])
227227
->
228-
(* uncurried$<(int, int) => int, [#2]> -> (. int, int) => int *)
228+
(* function$<(int, int) => int, [#2]> -> (. int, int) => int *)
229229
printOutArrowType ~uncurried:true arrowType
230230
| Otyp_constr (outIdent, []) -> printOutIdentDoc ~allowUident:false outIdent
231231
| Otyp_manifest (typ1, typ2) ->

res_syntax/src/res_uncurried.ml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ let new_representation arity = arity = 5
3636
let uncurriedType ~loc ~arity tArg =
3737
if new_representation arity then
3838
let tArity = arityType ~loc arity in
39-
Ast_helper.Typ.constr ~loc {txt = Lident "uncurried$"; loc} [tArg; tArity]
39+
Ast_helper.Typ.constr ~loc {txt = Lident "function$"; loc} [tArg; tArity]
4040
else
4141
Ast_helper.Typ.constr ~loc
4242
{
@@ -60,7 +60,7 @@ let uncurriedFun ~loc ~arity funExpr =
6060
if new_representation arity then
6161
Ast_helper.Exp.construct ~loc
6262
~attrs:(arity_to_attributes arity)
63-
{txt = Lident "Uncurried$"; loc}
63+
{txt = Lident "Function$"; loc}
6464
(Some funExpr)
6565
else
6666
Ast_helper.Exp.record ~loc
@@ -74,13 +74,13 @@ let exprIsUncurriedFun (expr : Parsetree.expression) =
7474
match expr.pexp_desc with
7575
| Pexp_record ([({txt = Ldot (Ldot (Lident "Js", "Fn"), _)}, _e)], None) ->
7676
true
77-
| Pexp_construct ({txt = Lident "Uncurried$"}, Some _) -> true
77+
| Pexp_construct ({txt = Lident "Function$"}, Some _) -> true
7878
| _ -> false
7979

8080
let exprExtractUncurriedFun (expr : Parsetree.expression) =
8181
match expr.pexp_desc with
8282
| Pexp_record ([({txt = Ldot (Ldot (Lident "Js", "Fn"), _)}, e)], None) -> e
83-
| Pexp_construct ({txt = Lident "Uncurried$"}, Some e) -> e
83+
| Pexp_construct ({txt = Lident "Function$"}, Some e) -> e
8484
| _ -> assert false
8585

8686
let typeIsUncurriedFun (typ : Parsetree.core_type) =
@@ -89,8 +89,7 @@ let typeIsUncurriedFun (typ : Parsetree.core_type) =
8989
({txt = Ldot (Ldot (Lident "Js", "Fn"), _)}, [{ptyp_desc = Ptyp_arrow _}])
9090
->
9191
true
92-
| Ptyp_constr ({txt = Lident "uncurried$"}, [{ptyp_desc = Ptyp_arrow _}; _])
93-
->
92+
| Ptyp_constr ({txt = Lident "function$"}, [{ptyp_desc = Ptyp_arrow _}; _]) ->
9493
true
9594
| _ -> false
9695

@@ -102,6 +101,6 @@ let typeExtractUncurriedFun (typ : Parsetree.core_type) =
102101
((String.sub [@doesNotRaise]) arity 5 (String.length arity - 5))
103102
in
104103
(arity, tArg)
105-
| Ptyp_constr ({txt = Lident "uncurried$"}, [tArg; tArity]) ->
104+
| Ptyp_constr ({txt = Lident "function$"}, [tArg; tArity]) ->
106105
(arityFromType tArity, tArg)
107106
| _ -> assert false

0 commit comments

Comments
 (0)