Skip to content

Commit 346d575

Browse files
authored
Merge pull request #4124 from BuckleScript/tweak
not setting -strict-sequence for compatibility && post-processing when bspack
2 parents fe25788 + b8c3511 commit 346d575

28 files changed

+366
-406
lines changed

jscomp/bsb/bsb_merlin_gen.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ let output_merlin_namespace buffer ns=
8989
let bsc_flg_to_merlin_ocamlc_flg bsc_flags =
9090
merlin_flg ^
9191
String.concat Ext_string.single_space
92-
("-strict-sequence" :: List.filter (fun x -> not (Ext_string.starts_with x bs_flg_prefix )) (
92+
(List.filter (fun x -> not (Ext_string.starts_with x bs_flg_prefix )) (
9393
Literals.dash_nostdlib::bsc_flags))
9494

9595
(* No need for [-warn-error] in merlin *)

jscomp/bsb/templates/tea/bsconfig.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,5 @@
1212
"suffix": ".bs.js",
1313
"bs-dependencies": [
1414
"bucklescript-tea"
15-
],
16-
"warnings": {
17-
"error" : "+101"
18-
}
15+
]
1916
}
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
We've found a bug for you!
2+
Warning number 5 (configured as error)
33
/.../fixtures/warnings1.re 3:3-7
44

55
1 │ let x = (a, b) => a + b;
@@ -8,7 +8,5 @@
88
4 │ 10
99
5 │ };
1010

11-
This has type:
12-
int => int
13-
But somewhere wanted:
14-
unit
11+
this function application is partial,
12+
maybe some arguments are missing.
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11

2-
We've found a bug for you!
2+
Warning number 10
33
/.../fixtures/warnings2.re 2:3-4
44

55
1 │ let z = () => {
6-
2 │ 10;
6+
2 │ 10;
77
3 │ 10
88
4 │ };
99

10-
This has type:
11-
int
12-
But somewhere wanted:
13-
unit
10+
This expression returns a value, but you're not doing anything with it. If this is on purpose, wrap it with `ignore`.

jscomp/core/bs_conditional_initial.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ let setup_env () =
3838
Clflags.debug := true;
3939
Clflags.record_event_when_debug := false;
4040
Clflags.binary_annotations := true;
41-
Clflags.strict_sequence := true;
41+
(* Clflags.strict_sequence := true; *)
4242
(* Turn on [-no-alias-deps] by default -- double check *)
4343
Oprint.out_ident := Outcome_printer_ns.out_ident;
4444
Builtin_attributes.check_bs_attributes_inclusion := Record_attributes_check.check_bs_attributes_inclusion;

jscomp/ext/bsc_warnings.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,6 @@
7272
7373
- 102 Bs_polymorphic_comparison
7474
*)
75-
let defaults_w = "+a-4-40-41-42-50-102"
75+
let defaults_w = "+a-4-9-40-41-42-50-102"
7676
let defaults_warn_error = "-a+5+101";;
77+
(*TODO: add +10*)

jscomp/main/native_ppx_main.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ let expr_mapper (self : mapper) ( e : Parsetree.expression) =
3939
(s, (Some delim)))
4040
->
4141
Ast_utf8_string_interp.transform e s delim
42-
| Pexp_fun (arg_label, _, pat , body)
43-
when Ast_compatible.is_arg_label_simple arg_label ->
42+
| Pexp_fun (Nolabel, _, pat , body)
43+
->
4444
begin match Ext_list.exclude_with_val
4545
e.pexp_attributes
4646
Ast_attributes.is_bs with

jscomp/snapshot.ninja

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
releaseMode = -D BS_RELEASE_BUILD=true
22
rule bspack
3-
command = ./bin/bspack.exe $flags -bs-main $main -o $out
3+
command = ./bin/bspack.exe $flags -bs-main $main -o $out $post_process
44
depfile = $out.d
55
generator = true
66

7-
7+
LTO= ../scripts/buckle_lto.js
88
OCAML_SRC_UTILS=$native_ocaml_path/utils
99
OCAML_SRC_PARSING=$native_ocaml_path/parsing
1010
OCAML_SRC_TYPING=$native_ocaml_path/typing
@@ -19,12 +19,12 @@ build snapshot: phony $SNAP/whole_compiler.ml $SNAP/bsppx.ml $SNAP/bsdep.ml $SN
1919
build $SNAP/whole_compiler.ml: bspack | ./bin/bspack.exe
2020
flags = ${releaseMode} -bs-MD -module-alias Config=Config_whole_compiler -bs-exclude-I config -I $OCAML_SRC_UTILS -I $OCAML_SRC_PARSING -I $OCAML_SRC_TYPING -I $OCAML_SRC_BYTECOMP -I $OCAML_SRC_DRIVER ${includes}
2121
main = Js_main
22-
22+
post_process = && node $LTO $SNAP/whole_compiler.ml
2323

2424
build $SNAP/bsppx.ml: bspack | ./bin/bspack.exe
2525
flags = ${releaseMode} -bs-MD -module-alias Config=Config_whole_compiler -I $OCAML_SRC_UTILS -I $OCAML_SRC_PARSING -I stubs -I common -I ext -I syntax -I core -I js_parser -I main
2626
main = Bsppx_main
27-
27+
post_process = && node $LTO $SNAP/bsppx.ml
2828

2929
build $SNAP/bsdep.ml: bspack | ./bin/bspack.exe
3030
flags = -D BS_OCAMLDEP=true ${releaseMode} -bs-MD -module-alias Config=Config_whole_compiler -I $OCAML_SRC_UTILS -I $OCAML_SRC_PARSING -I $OCAML_SRC_DRIVER -I $OCAML_SRC_TOOLS -I common -I ext -I syntax -I depends -I core -I stubs -I main

jscomp/syntax/ast_compatible.ml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,10 @@ let default_loc = Location.none
3030

3131
type poly_var_label = Asttypes.label Asttypes.loc
3232

33-
type arg_label = Asttypes.arg_label =
34-
| Nolabel
35-
| Labelled of string
36-
| Optional of string
3733

38-
let is_arg_label_simple (s : arg_label) = s = (Nolabel : arg_label)
39-
type label = arg_label
34+
35+
36+
4037

4138

4239

@@ -46,13 +43,14 @@ let arrow ?(loc=default_loc) ?(attrs = []) a b =
4643
let apply_simple
4744
?(loc = default_loc)
4845
?(attrs = [])
49-
fn args : expression =
46+
(fn : expression)
47+
(args : expression list) : expression =
5048
{ pexp_loc = loc;
5149
pexp_attributes = attrs;
5250
pexp_desc =
5351
Pexp_apply(
5452
fn,
55-
(Ext_list.map args (fun x -> Nolabel, x) ) ) }
53+
(Ext_list.map args (fun x -> Asttypes.Nolabel, x) ) ) }
5654

5755
let app1
5856
?(loc = default_loc)
@@ -242,7 +240,7 @@ let const_exp_string_list_as_array xs =
242240
(Ext_list.map xs (fun x -> const_exp_string x ) )
243241

244242
type param_type =
245-
{label : arg_label ;
243+
{label : Asttypes.arg_label ;
246244
ty : Parsetree.core_type ;
247245
attr :Parsetree.attributes;
248246
loc : loc
@@ -273,4 +271,4 @@ let hash_label (x : poly_var_label) : int = Ext_pervasives.hash_variant x.txt
273271
let label_of_name (x : poly_var_label) : string = x.txt
274272

275273
type args =
276-
(arg_label * Parsetree.expression) list
274+
(Asttypes.arg_label * Parsetree.expression) list

jscomp/syntax/ast_compatible.mli

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424

2525

2626
type poly_var_label = Asttypes.label Asttypes.loc
27-
type arg_label = Asttypes.arg_label
28-
type label = arg_label
27+
2928

3029

3130

@@ -110,19 +109,16 @@ val fun_ :
110109
expression ->
111110
expression
112111

113-
val opt_label : string -> arg_label
112+
val opt_label : string -> Asttypes.arg_label
114113

115114
val label_fun :
116115
?loc:Location.t ->
117116
?attrs:attrs ->
118-
label:arg_label ->
117+
label:Asttypes.arg_label ->
119118
pattern ->
120119
expression ->
121120
expression
122121

123-
val is_arg_label_simple :
124-
arg_label -> bool
125-
126122
val arrow :
127123
?loc:Location.t ->
128124
?attrs:attrs ->
@@ -180,7 +176,7 @@ val rec_type_sig:
180176
signature_item
181177

182178
type param_type =
183-
{label : arg_label ;
179+
{label : Asttypes.arg_label ;
184180
ty : Parsetree.core_type ;
185181
attr :Parsetree.attributes;
186182
loc : loc
@@ -199,4 +195,4 @@ val hash_label : poly_var_label -> int
199195
val label_of_name : poly_var_label -> string
200196

201197
type args =
202-
(arg_label * Parsetree.expression) list
198+
(Asttypes.arg_label * Parsetree.expression) list

0 commit comments

Comments
 (0)