Skip to content

Commit 3bb4545

Browse files
committed
Ignore -uncurried compiler flag.
1 parent 7d6b8d9 commit 3bb4545

File tree

207 files changed

+3085
-2168
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

207 files changed

+3085
-2168
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
- Avoid generating calls to Curry when adjusting arity of uncurried functions. https://github.com/rescript-lang/rescript-compiler/pull/6870
6767
- Remove `@@uncurried.swap`, which was used for internal tests. https://github.com/rescript-lang/rescript-compiler/pull/6875
6868
- Build the compiler libraries/tests in uncurried mode. https://github.com/rescript-lang/rescript-compiler/pull/6864
69+
- Ignore `-uncurried` command-line flag. https://github.com/rescript-lang/rescript-compiler/pull/6885
6970

7071
#### :nail_care: Polish
7172

jscomp/bsc/rescript_compiler_main.ml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ let process_file sourcefile ?(kind ) ppf =
4040
The {!Location.input_name} relies on that we write the binary ast
4141
properly
4242
*)
43-
let uncurried = !Config.uncurried in
4443
setup_outcome_printer ();
4544
let kind =
4645
match kind with
@@ -78,11 +77,9 @@ let process_file sourcefile ?(kind ) ppf =
7877
| Unknown ->
7978
Bsc_args.bad_arg ("don't know what to do with " ^ sourcefile)
8079
in
81-
Config.uncurried := uncurried;
8280
res
8381

8482
let reprint_source_file sourcefile =
85-
let uncurried = !Config.uncurried in
8683
let kind = Ext_file_extensions.classify_input (Ext_filename.get_extension_maybe sourcefile) in
8784
let sourcefile = set_abs_input_name sourcefile in
8885
let res = match kind with
@@ -119,7 +116,6 @@ let reprint_source_file sourcefile =
119116
print_endline ("Invalid input for reprinting ReScript source. Must be a ReScript file: " ^ sourcefile);
120117
exit 2
121118
in
122-
Config.uncurried := uncurried;
123119
res
124120

125121
let usage = "Usage: bsc <options> <files>\nOptions are:"
@@ -406,8 +402,8 @@ let buckle_script_flags : (string * Bsc_args.spec * string) array =
406402

407403
"-nopervasives", set Clflags.nopervasives,
408404
"*internal*";
409-
"-uncurried", unit_call (fun () -> Config.uncurried := Uncurried),
410-
"*internal* Set jsx module";
405+
"-uncurried", unit_call (fun () -> ()),
406+
"*internal* deprecated";
411407
"-v", unit_call print_version_string,
412408
"Print compiler version and location of standard library and exit";
413409

jscomp/build_tests/super_errors/expected/warnings3.res.expected

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
2 [2m│[0m let _ = string_of_float(34.)
77
3 [2m│[0m let _ = string_of_float(34.)
88

9-
deprecated: PervasivesU.string_of_float
9+
deprecated: Pervasives.string_of_float
1010
Please use Js.Float.toString instead, string_of_float generates unparseable floats
1111

1212

@@ -18,7 +18,7 @@
1818
3 [2m│[0m let _ = string_of_float(34.)
1919
4 [2m│[0m
2020

21-
deprecated: PervasivesU.string_of_float
21+
deprecated: Pervasives.string_of_float
2222
Please use Js.Float.toString instead, string_of_float generates unparseable floats
2323

2424

@@ -30,5 +30,5 @@
3030
[1;33m3[0m [2m│[0m let _ = [1;33mstring_of_float[0m(34.)
3131
4 [2m│[0m
3232

33-
deprecated: PervasivesU.string_of_float
33+
deprecated: Pervasives.string_of_float
3434
Please use Js.Float.toString instead, string_of_float generates unparseable floats

jscomp/build_tests/super_errors/input.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const fixtures = fs
1111
.filter(fileName => path.extname(fileName) === ".res");
1212

1313
// const runtime = path.join(__dirname, '..', '..', 'runtime')
14-
const prefix = `${bsc} -w +A -uncurried`;
14+
const prefix = `${bsc} -w +A`;
1515

1616
const updateTests = process.argv[2] === "update";
1717

jscomp/build_tests/uncurried_printer/input.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

jscomp/build_tests/uncurried_printer/rescript.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

jscomp/build_tests/uncurried_printer/src/a.res

Lines changed: 0 additions & 1 deletion
This file was deleted.

jscomp/core/res_compmisc.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ let initial_env ?(modulename) () =
5353
let initial = Env.initial_safe_string in
5454
let env =
5555
if !Clflags.nopervasives then initial
56-
else open_implicit_module (if !Config.uncurried = Uncurried then "PervasivesU" else "Pervasives") initial
56+
else open_implicit_module "Pervasives" initial
5757
in
5858
List.fold_left
5959
(fun env m -> open_implicit_module m env)

jscomp/ext/config.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ let bs_only = ref true
1212
let unsafe_empty_array = ref false
1313

1414
type uncurried = Legacy | Uncurried
15-
let uncurried = ref Legacy
1615

17-
and cmi_magic_number = "Caml1999I022"
16+
let cmi_magic_number = "Caml1999I022"
1817

1918
and ast_impl_magic_number = "Caml1999M022"
2019

jscomp/ext/config.mli

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,3 @@ val cmt_magic_number : string
4343
val print_config : out_channel -> unit
4444

4545
type uncurried = Legacy | Uncurried
46-
val uncurried : uncurried ref

jscomp/frontend/ast_attributes.ml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,16 +188,13 @@ let iter_process_bs_string_int_unwrap_uncurry (attrs : t) =
188188
st := v)
189189
else Bs_syntaxerr.err loc Conflict_attributes
190190
in
191-
Ext_list.iter attrs (fun (({txt; loc = _}, (payload : _)) as attr) ->
191+
Ext_list.iter attrs (fun (({txt; loc = _}, _) as attr) ->
192192
match txt with
193193
| "string" -> assign `String attr
194194
| "int" -> assign `Int attr
195195
| "ignore" -> assign `Ignore attr
196196
| "unwrap" -> assign `Unwrap attr
197-
| "uncurry" ->
198-
if !Config.uncurried = Uncurried then
199-
Used_attributes.mark_used_attribute attr
200-
else assign (`Uncurry (Ast_payload.is_single_int payload)) attr
197+
| "uncurry" -> Used_attributes.mark_used_attribute attr
201198
| _ -> ());
202199
!st
203200

jscomp/frontend/ast_config.ml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ let process_directives str =
5050
match Ast_payload.is_single_string payload with
5151
| Some (d, _) -> Js_config.directives := !Js_config.directives @ [d]
5252
| None -> Bs_syntaxerr.err item.pstr_loc Expect_string_literal)
53-
| Pstr_attribute ({txt = "uncurried"}, _) ->
54-
Config.uncurried := Uncurried
5553
| _ -> ())
5654

5755
let rec iter_on_bs_config_str (x : Parsetree.structure) =

jscomp/frontend/ast_derive_projector.ml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@ let init () =
2222
(fun (tdcls : tdcls) _explict_nonrec ->
2323
let handle_uncurried_accessor_tranform ~loc ~arity accessor =
2424
(* Accessors with no params (arity of 0) are simply values and not functions *)
25-
match Config.uncurried.contents with
26-
| Uncurried when arity > 0 ->
27-
Ast_uncurried.uncurried_fun ~loc ~arity accessor
28-
| _ -> accessor
25+
if arity > 0 then Ast_uncurried.uncurried_fun ~loc ~arity accessor
26+
else accessor
2927
in
3028
let handle_tdcl tdcl =
3129
let core_type =
@@ -121,11 +119,8 @@ let init () =
121119
signature_gen =
122120
(fun (tdcls : Parsetree.type_declaration list) _explict_nonrec ->
123121
let handle_uncurried_type_tranform ~loc ~arity t =
124-
match Config.uncurried.contents with
125-
(* Accessors with no params (arity of 0) are simply values and not functions *)
126-
| Uncurried when arity > 0 ->
127-
Ast_uncurried.uncurried_type ~loc ~arity t
128-
| _ -> t
122+
if arity > 0 then Ast_uncurried.uncurried_type ~loc ~arity t
123+
else t
129124
in
130125
let handle_tdcl tdcl =
131126
let core_type =

jscomp/jsoo/jsoo_playground_main.ml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,13 @@ module BundleConfig = struct
7676
mutable filename: string option;
7777
mutable warn_flags: string;
7878
mutable open_modules: string list;
79-
80-
(* This one can't be mutated since we only provide
81-
third-party packages that were compiled for uncurried
82-
mode *)
83-
uncurried: bool;
8479
}
8580

8681
let make () = {
8782
module_system=Ext_module_system.Commonjs;
8883
filename=None;
8984
warn_flags=Bsc_warnings.defaults_w;
9085
open_modules=[];
91-
uncurried=(!Config.uncurried = Uncurried);
9286
}
9387

9488

@@ -201,8 +195,6 @@ end
201195
(* One time setup for all relevant modules *)
202196
let () =
203197
Bs_conditional_initial.setup_env ();
204-
(* From now on the default setting will be uncurried mode *)
205-
Config.uncurried := Uncurried;
206198
Clflags.binary_annotations := false;
207199
Clflags.color := Some Always;
208200
Lazy.force Res_outcome_printer.setup
@@ -646,7 +638,6 @@ module Export = struct
646638
);
647639
"warn_flags",
648640
inject @@ (Js.string config.warn_flags);
649-
"uncurried", inject @@ (Js.bool config.uncurried);
650641
"open_modules", inject @@ (config.open_modules |> Array.of_list |> Js.array);
651642
|]))
652643
);

jscomp/ml/ctype.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2329,7 +2329,7 @@ and unify3 env t1 t1' t2 t2' =
23292329
link_type t2' t1;
23302330
| (Tfield _, Tfield _) -> (* special case for GADTs *)
23312331
unify_fields env t1' t2'
2332-
| (Tconstr (Pident {name="function$"}, [t_fun; _], _), Tarrow _) when !Config.uncurried = Uncurried ->
2332+
| (Tconstr (Pident {name="function$"}, [t_fun; _], _), Tarrow _) ->
23332333
(* subtype: an uncurried function is cast to a curried one *)
23342334
unify2 env t_fun t2
23352335
| _ ->

jscomp/ml/typecore.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3076,7 +3076,6 @@ and type_argument ?type_clash_context ?recarg env sarg ty_expected' ty_expected
30763076
texp
30773077
and is_automatic_curried_application env funct =
30783078
(* When a curried function is used with uncurried application, treat it as a curried application *)
3079-
!Config.uncurried = Uncurried &&
30803079
match (expand_head env funct.exp_type).desc with
30813080
| Tarrow _ -> true
30823081
| _ -> false

jscomp/others/release.ninja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
bsc_primitive_flags = -no-keep-locs -no-alias-deps -bs-no-version-header -bs-no-check-div-by-zero -nostdlib -bs-cross-module-opt -make-runtime -nopervasives -unsafe -w +50 -warn-error A -uncurried
2+
bsc_primitive_flags = -no-keep-locs -no-alias-deps -bs-no-version-header -bs-no-check-div-by-zero -nostdlib -bs-cross-module-opt -make-runtime -nopervasives -unsafe -w +50 -warn-error A
33
bsc_flags = $bsc_primitive_flags -open Belt_internals
44

55
rule cc

jscomp/runtime/release.ninja

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
bsc_no_open_flags = -no-keep-locs -no-alias-deps -bs-no-version-header -bs-no-check-div-by-zero -nostdlib -bs-cross-module-opt -make-runtime -nopervasives -unsafe -w +50 -warn-error A -uncurried
2+
bsc_no_open_flags = -no-keep-locs -no-alias-deps -bs-no-version-header -bs-no-check-div-by-zero -nostdlib -bs-cross-module-opt -make-runtime -nopervasives -unsafe -w +50 -warn-error A
33
bsc_flags = $bsc_no_open_flags -open Bs_stdlib_mini
44

55
rule cc
@@ -10,7 +10,7 @@ rule cc_cmi
1010
description = $in -> $out
1111

1212
o runtime/bs_stdlib_mini.cmi : cc runtime/bs_stdlib_mini.resi
13-
bsc_flags = -nostdlib -nopervasives -uncurried
13+
bsc_flags = -nostdlib -nopervasives
1414
o runtime/js.cmj runtime/js.cmi : cc runtime/js.res
1515
bsc_flags = $bsc_no_open_flags
1616
o runtime/caml.cmj : cc_cmi runtime/caml.res | runtime/caml.cmi runtime/caml_int64_extern.cmj

jscomp/stdlib-406/release.ninja

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
bsc_flags = -no-keep-locs -no-alias-deps -bs-no-version-header -bs-no-check-div-by-zero -nostdlib -bs-cross-module-opt -make-runtime -w -9-3-106 -warn-error A -I others -uncurried
2+
bsc_flags = -no-keep-locs -no-alias-deps -bs-no-version-header -bs-no-check-div-by-zero -nostdlib -bs-cross-module-opt -make-runtime -w -9-3-106 -warn-error A -I others
33

44
rule cc
55
command = $bsc -bs-cmi -bs-cmj $bsc_flags -I stdlib-406 $in
@@ -9,15 +9,15 @@ rule cc_cmi
99
description = $in -> $out
1010

1111
o stdlib-406/pervasives.cmj : cc_cmi stdlib-406/pervasives.res | stdlib-406/pervasives.cmi $bsc others
12-
bsc_flags = $bsc_flags -nopervasives -uncurried
12+
bsc_flags = $bsc_flags -nopervasives
1313
o stdlib-406/pervasives.cmi : cc stdlib-406/pervasives.resi | $bsc others
14-
bsc_flags = $bsc_flags -nopervasives -uncurried
14+
bsc_flags = $bsc_flags -nopervasives
1515
o stdlib-406/pervasivesU.cmj : cc_cmi stdlib-406/pervasivesU.res | stdlib-406/pervasivesU.cmi $bsc others
16-
bsc_flags = $bsc_flags -nopervasives -uncurried
16+
bsc_flags = $bsc_flags -nopervasives
1717
o stdlib-406/pervasivesU.cmi : cc stdlib-406/pervasivesU.resi | $bsc others
18-
bsc_flags = $bsc_flags -nopervasives -uncurried
19-
o stdlib-406/arg.cmj : cc_cmi stdlib-406/arg.res | stdlib-406/arg.cmi stdlib-406/array.cmj stdlib-406/buffer.cmj stdlib-406/list.cmj stdlib-406/string.cmj stdlib-406/sys.cmj $bsc others
20-
o stdlib-406/arg.cmi : cc stdlib-406/arg.resi | stdlib-406/pervasives.cmj $bsc others
18+
bsc_flags = $bsc_flags -nopervasives
19+
o stdlib-406/arg.cmj : cc_cmi stdlib-406/arg.res | stdlib-406/arg.cmi stdlib-406/array.cmj stdlib-406/buffer.cmj stdlib-406/list.cmj stdlib-406/set.cmj stdlib-406/string.cmj stdlib-406/sys.cmj $bsc others
20+
o stdlib-406/arg.cmi : cc stdlib-406/arg.resi | stdlib-406/pervasives.cmj stdlib-406/set.cmi stdlib-406/string.cmi $bsc others
2121
o stdlib-406/array.cmj : cc_cmi stdlib-406/array.res | stdlib-406/array.cmi $bsc others
2222
o stdlib-406/array.cmi : cc stdlib-406/array.resi | stdlib-406/pervasives.cmj $bsc others
2323
o stdlib-406/arrayLabels.cmj : cc_cmi stdlib-406/arrayLabels.res | stdlib-406/arrayLabels.cmi $bsc others
@@ -43,7 +43,7 @@ o stdlib-406/digest.cmi : cc stdlib-406/digest.resi | stdlib-406/pervasives.cmj
4343
o stdlib-406/filename.cmj : cc_cmi stdlib-406/filename.res | stdlib-406/buffer.cmj stdlib-406/filename.cmi stdlib-406/string.cmj stdlib-406/sys.cmj $bsc others
4444
o stdlib-406/filename.cmi : cc stdlib-406/filename.resi | stdlib-406/pervasives.cmj $bsc others
4545
o stdlib-406/genlex.cmj : cc_cmi stdlib-406/genlex.res | stdlib-406/bytes.cmj stdlib-406/char.cmj stdlib-406/genlex.cmi stdlib-406/hashtbl.cmj stdlib-406/list.cmj stdlib-406/stream.cmj stdlib-406/string.cmj $bsc others
46-
o stdlib-406/genlex.cmi : cc stdlib-406/genlex.resi | stdlib-406/pervasives.cmj stdlib-406/stream.cmi $bsc others
46+
o stdlib-406/genlex.cmi : cc stdlib-406/genlex.resi | stdlib-406/char.cmi stdlib-406/pervasives.cmj stdlib-406/stream.cmi stdlib-406/string.cmi $bsc others
4747
o stdlib-406/hashtbl.cmj : cc_cmi stdlib-406/hashtbl.res | stdlib-406/array.cmj stdlib-406/hashtbl.cmi stdlib-406/lazy.cmj stdlib-406/random.cmj $bsc others
4848
o stdlib-406/hashtbl.cmi : cc stdlib-406/hashtbl.resi | stdlib-406/pervasives.cmj $bsc others
4949
o stdlib-406/hashtblLabels.cmi stdlib-406/hashtblLabels.cmj : cc stdlib-406/hashtblLabels.res | stdlib-406/hashtbl.cmj stdlib-406/pervasives.cmj $bsc others
@@ -70,7 +70,7 @@ o stdlib-406/parsing.cmj : cc_cmi stdlib-406/parsing.res | stdlib-406/array.cmj
7070
o stdlib-406/parsing.cmi : cc stdlib-406/parsing.resi | stdlib-406/lexing.cmi stdlib-406/obj.cmi stdlib-406/pervasives.cmj $bsc others
7171
o stdlib-406/queue.cmj : cc_cmi stdlib-406/queue.res | stdlib-406/queue.cmi $bsc others
7272
o stdlib-406/queue.cmi : cc stdlib-406/queue.resi | stdlib-406/pervasives.cmj $bsc others
73-
o stdlib-406/random.cmj : cc_cmi stdlib-406/random.res | stdlib-406/array.cmj stdlib-406/char.cmj stdlib-406/digest.cmj stdlib-406/int32.cmj stdlib-406/int64.cmj stdlib-406/random.cmi stdlib-406/string.cmj $bsc others
73+
o stdlib-406/random.cmj : cc_cmi stdlib-406/random.res | stdlib-406/array.cmj stdlib-406/char.cmj stdlib-406/digest.cmj stdlib-406/int32.cmj stdlib-406/int64.cmj stdlib-406/random.cmi $bsc others
7474
o stdlib-406/random.cmi : cc stdlib-406/random.resi | stdlib-406/int32.cmi stdlib-406/int64.cmi stdlib-406/pervasives.cmj $bsc others
7575
o stdlib-406/set.cmj : cc_cmi stdlib-406/set.res | stdlib-406/list.cmj stdlib-406/set.cmi $bsc others
7676
o stdlib-406/set.cmi : cc stdlib-406/set.resi | stdlib-406/pervasives.cmj $bsc others

jscomp/syntax/src/jsx_v4.ml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -998,11 +998,9 @@ let map_binding ~config ~empty_loc ~pstr_loc ~file_name ~rec_flag binding =
998998
else inner_expression)
999999
in
10001000
let full_expression =
1001-
if !Config.uncurried = Uncurried then
1002-
full_expression
1003-
|> Ast_uncurried.uncurried_fun ~loc:full_expression.pexp_loc
1004-
~arity:(if has_forward_ref then 2 else 1)
1005-
else full_expression
1001+
full_expression
1002+
|> Ast_uncurried.uncurried_fun ~loc:full_expression.pexp_loc
1003+
~arity:(if has_forward_ref then 2 else 1)
10061004
in
10071005
let full_expression =
10081006
match full_module_name with

jscomp/syntax/src/reactjs_jsx_v3.ml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -979,11 +979,9 @@ let jsx_mapper ~config =
979979
inner_expression_with_ref
980980
in
981981
let full_expression =
982-
if !Config.uncurried = Uncurried then
983-
full_expression
984-
|> Ast_uncurried.uncurried_fun ~loc:full_expression.pexp_loc
985-
~arity:1
986-
else full_expression
982+
full_expression
983+
|> Ast_uncurried.uncurried_fun ~loc:full_expression.pexp_loc
984+
~arity:1
987985
in
988986
let full_expression =
989987
match full_module_name with

0 commit comments

Comments
 (0)