Skip to content

Commit 7ed6b09

Browse files
committed
strict_formats, strict_sequence enabled
1 parent 2261bb9 commit 7ed6b09

File tree

9 files changed

+18
-44
lines changed

9 files changed

+18
-44
lines changed

jscomp/common/bs_version.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* You should have received a copy of the GNU Lesser General Public License
2323
* along with this program; if not, write to the Free Software
2424
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
25-
let version = "7.4.0-dev.1"
25+
let version = "8.0.0-dev.1"
2626
let header =
2727
"// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE"
2828
let package_name = "bs-platform"

jscomp/core/bs_conditional_initial.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ let setup_env () =
4444
Clflags.debug := true;
4545
Clflags.record_event_when_debug := false;
4646
Clflags.binary_annotations := true;
47-
(* Clflags.strict_sequence := true; *)
47+
Clflags.strict_sequence := true;
48+
Clflags.strict_formats := true;
4849
(* Turn on [-no-alias-deps] by default -- double check *)
4950
Oprint.out_ident := Outcome_printer_ns.out_ident;
5051
Builtin_attributes.check_bs_attributes_inclusion := Record_attributes_check.check_bs_attributes_inclusion;

jscomp/core/ocaml_options.ml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,6 @@ let mk_short_paths f =
134134
"-stdin", Arg.Unit f, " Read script from standard input"
135135
;; *)
136136

137-
let mk_strict_sequence f =
138-
"-strict-sequence", Arg.Unit f,
139-
" Left-hand part of a sequence must have type unit"
140-
;;
141137

142138
let mk_unsafe f =
143139
"-unsafe", Arg.Unit f,
@@ -235,14 +231,6 @@ let mk_dlambda f =
235231
\ (reduces necessary recompilation on module change)"
236232
;; *)
237233

238-
let mk_strict_formats f =
239-
"-strict-formats", Arg.Unit f,
240-
" Reject invalid formats accepted by legacy implementations\n\
241-
\ (Warning: Invalid formats may behave differently from\n\
242-
\ previous OCaml versions, and will become always-rejected\n\
243-
\ in future OCaml versions. You should use this flag\n\
244-
\ to detect and fix invalid formats.)"
245-
;;
246234

247235
(* let mk__ f =
248236
"-", Arg.String f,
@@ -309,8 +297,6 @@ let ocaml_options =
309297
let _rectypes = set Clflags.recursive_types in
310298
(* let _safe_string = unset unsafe_string in *)
311299
let _short_paths = unset Clflags.real_paths in
312-
let _strict_sequence = set Clflags.strict_sequence in
313-
let _strict_formats = set Clflags.strict_formats in
314300
let _unsafe = set Clflags.fast in
315301
(* let _unsafe_string = set unsafe_string in *)
316302
(* let _v () = print_version_and_library "compiler" in *)
@@ -359,8 +345,6 @@ let ocaml_options =
359345
mk_rectypes _rectypes;
360346
(* mk_safe_string _safe_string; *)
361347
mk_short_paths _short_paths;
362-
mk_strict_sequence _strict_sequence;
363-
mk_strict_formats _strict_formats;
364348
mk_unsafe _unsafe;
365349
mk_v _v;
366350
mk_verbose _verbose;

jscomp/test/caml_format_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,7 @@ var formatter_suites_001 = /* :: */[
980980
])
981981
])
982982
]),
983-
"@[%23d %2i %3u %4n %0xl %0xL %N %03x %X %o %s %S %c %C %3f %2F %2e %E %g %G %B %b %ld %li %lu %lx %lX %lo %nd %ni %nu %nx %nx %no @]"
983+
"@[%23d %2i %3u %n %0xl %0xL %N %03x %X %o %s %S %c %C %3f %2F %2e %E %g %G %B %b %ld %li %lu %lx %lX %lo %nd %ni %nu %nx %nx %no @]"
984984
]), [
985985
1,
986986
2,

jscomp/test/caml_format_test.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ let formatter_suites = Mt.[
8080
"fmt_gen",
8181
(fun _ -> Eq(Format.asprintf ("%s %03d %L" ^^ "%S %03d %L %a" ) "32" 33 33 "a" 33 3 (Format.pp_print_list Format.pp_print_int) [1;2;3], "32 033 33\"a\" 033 3 12\n3"));
8282
"long_fmt", (fun _ -> Eq(Format.asprintf "%d %i %u %n %l %L %N %x %X %o %s %S %c %C %f %F %e %E %g %G %B %b %ld %li %lu %lx %lX %lo %nd %ni %nu %nx %nx %no " 1 2 3 4 5 6 7 8 9 10 "a" "b" 'c' 'd' 1. 2. 3. 4. 5. 6. true false 0l 1l 2l 3l 4l 5l 6n 7n 8n 9n 10n 11n , "1 2 3 4 5 6 7 8 9 12 a \"b\" c 'd' 1.000000 2. 3.000000e+00 4.000000E+00 5 6 true false 0 1 2 3 4 5 6 7 8 9 a 13 "));
83-
"long_fmt_2", (fun _ -> Eq(Format.asprintf "@[%23d %2i %3u %4n %0xl %0xL %N %03x %X %o %s %S %c %C %3f %2F %2e %E %g %G %B %b %ld %li %lu %lx %lX %lo %nd %ni %nu %nx %nx %no @]" 1 2 3 4 5 6 7 8 9 10 "a" "b" 'c' 'd' 1. 2. 3. 4. 5. 6. true false 0l 1l 2l 3l 4l 5l 6n 7n 8n 9n 10n 11n, " 1 2 3 4 5l 6L 7 008 9 12 a \"b\" c 'd' 1.000000 2. 3.000000e+00 4.000000E+00 5 6 true false 0 1 2 3 4 5 6 7 8 9 a 13 "));
83+
"long_fmt_2", (fun _ -> Eq(Format.asprintf "@[%23d %2i %3u %n %0xl %0xL %N %03x %X %o %s %S %c %C %3f %2F %2e %E %g %G %B %b %ld %li %lu %lx %lX %lo %nd %ni %nu %nx %nx %no @]" 1 2 3 4 5 6 7 8 9 10 "a" "b" 'c' 'd' 1. 2. 3. 4. 5. 6. true false 0l 1l 2l 3l 4l 5l 6n 7n 8n 9n 10n 11n, " 1 2 3 4 5l 6L 7 008 9 12 a \"b\" c 'd' 1.000000 2. 3.000000e+00 4.000000E+00 5 6 true false 0 1 2 3 4 5 6 7 8 9 a 13 "));
8484
"width_1", (fun _ -> Eq(Format.asprintf "%014d" 32, "00000000000032"));
8585
"width_2", (fun _ -> Eq(Format.asprintf "%10.3f" 32333.02, " 32333.020"));
8686
"alternate_1", (fun _ -> Eq(Format.asprintf "%0x" 32333, "7e4d"));

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78157,7 +78157,8 @@ let setup_env () =
7815778157
Clflags.debug := true;
7815878158
Clflags.record_event_when_debug := false;
7815978159
Clflags.binary_annotations := true;
78160-
(* Clflags.strict_sequence := true; *)
78160+
Clflags.strict_sequence := true;
78161+
Clflags.strict_formats := true;
7816178162
(* Turn on [-no-alias-deps] by default -- double check *)
7816278163
Oprint.out_ident := Outcome_printer_ns.out_ident;
7816378164
Builtin_attributes.check_bs_attributes_inclusion := Record_attributes_check.check_bs_attributes_inclusion;

lib/4.06.1/unstable/js_refmt_compiler.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371483,7 +371483,8 @@ let setup_env () =
371483371483
Clflags.debug := true;
371484371484
Clflags.record_event_when_debug := false;
371485371485
Clflags.binary_annotations := true;
371486-
(* Clflags.strict_sequence := true; *)
371486+
Clflags.strict_sequence := true;
371487+
Clflags.strict_formats := true;
371487371488
(* Turn on [-no-alias-deps] by default -- double check *)
371488371489
Oprint.out_ident := Outcome_printer_ns.out_ident;
371489371490
Builtin_attributes.check_bs_attributes_inclusion := Record_attributes_check.check_bs_attributes_inclusion;

lib/4.06.1/whole_compiler.ml

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -347290,7 +347290,7 @@ and type_format loc str env =
347290347290
in formats parsed from strings. *)
347291347291
assert false
347292347292
in
347293-
let legacy_behavior = not !Clflags.strict_formats in
347293+
let legacy_behavior = not true in
347294347294
let Fmt_EBB fmt = fmt_ebb_of_string ~legacy_behavior str in
347295347295
mk_constr "Format" [ mk_fmt fmt; mk_string str ]
347296347296
))
@@ -347726,7 +347726,7 @@ and type_statement env sexp =
347726347726
let ty = expand_head env exp.exp_type and tv = newvar() in
347727347727
if is_Tvar ty && ty.level > tv.level then
347728347728
Location.prerr_warning loc Warnings.Nonreturning_statement;
347729-
if !Clflags.strict_sequence then
347729+
if true then
347730347730
let expected_ty = instance_def Predef.type_unit in
347731347731
unify_exp env exp expected_ty;
347732347732
exp
@@ -361720,7 +361720,8 @@ let setup_env () =
361720361720
Clflags.debug := true;
361721361721
Clflags.record_event_when_debug := false;
361722361722
Clflags.binary_annotations := true;
361723-
(* Clflags.strict_sequence := true; *)
361723+
Clflags.strict_sequence := true;
361724+
Clflags.strict_formats := true;
361724361725
(* Turn on [-no-alias-deps] by default -- double check *)
361725361726
Oprint.out_ident := Outcome_printer_ns.out_ident;
361726361727
Builtin_attributes.check_bs_attributes_inclusion := Record_attributes_check.check_bs_attributes_inclusion;
@@ -417945,10 +417946,6 @@ let mk_short_paths f =
417945417946
"-stdin", Arg.Unit f, " Read script from standard input"
417946417947
;; *)
417947417948

417948-
let mk_strict_sequence f =
417949-
"-strict-sequence", Arg.Unit f,
417950-
" Left-hand part of a sequence must have type unit"
417951-
;;
417952417949

417953417950
let mk_unsafe f =
417954417951
"-unsafe", Arg.Unit f,
@@ -418046,14 +418043,6 @@ let mk_dlambda f =
418046418043
\ (reduces necessary recompilation on module change)"
418047418044
;; *)
418048418045

418049-
let mk_strict_formats f =
418050-
"-strict-formats", Arg.Unit f,
418051-
" Reject invalid formats accepted by legacy implementations\n\
418052-
\ (Warning: Invalid formats may behave differently from\n\
418053-
\ previous OCaml versions, and will become always-rejected\n\
418054-
\ in future OCaml versions. You should use this flag\n\
418055-
\ to detect and fix invalid formats.)"
418056-
;;
418057418046

418058418047
(* let mk__ f =
418059418048
"-", Arg.String f,
@@ -418118,8 +418107,6 @@ let ocaml_options =
418118418107
let _rectypes = set Clflags.recursive_types in
418119418108
(* let _safe_string = unset unsafe_string in *)
418120418109
let _short_paths = unset Clflags.real_paths in
418121-
let _strict_sequence = set Clflags.strict_sequence in
418122-
let _strict_formats = set Clflags.strict_formats in
418123418110
let _unsafe = set Clflags.fast in
418124418111
(* let _unsafe_string = set unsafe_string in *)
418125418112
(* let _v () = print_version_and_library "compiler" in *)
@@ -418168,8 +418155,6 @@ let ocaml_options =
418168418155
mk_rectypes _rectypes;
418169418156
(* mk_safe_string _safe_string; *)
418170418157
mk_short_paths _short_paths;
418171-
mk_strict_sequence _strict_sequence;
418172-
mk_strict_formats _strict_formats;
418173418158
mk_unsafe _unsafe;
418174418159
mk_v _v;
418175418160
mk_verbose _verbose;

scripts/buckle_lto.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,19 @@ var pairs = [
1010
["no_std_include", "true"],
1111
["Clflags.use_threads", "false"],
1212
["Clflags.use_vmthreads", "false"],
13-
["Clflags.no_implicit_current_dir","true"]
13+
["Clflags.no_implicit_current_dir", "true"],
14+
["Clflags.strict_sequence", "true"],
15+
["Clflags.strict_formats", "true"],
1416
];
1517

16-
var regexp = RegExp(`${pairs.map(x => "!" + x[0]).join("|")}`, "g");
18+
var regexp = RegExp(`${pairs.map((x) => "!" + x[0]).join("|")}`, "g");
1719

1820
/**
1921
*
2022
* @param {string} s
2123
*/
2224
function transform(s) {
23-
return s.replace(regexp, s => {
25+
return s.replace(regexp, (s) => {
2426
for (let [k, v] of pairs) {
2527
if (s.includes(k)) {
2628
return v;

0 commit comments

Comments
 (0)