From 5927f25bf0a061548d633f618c4ef1520d9027bf Mon Sep 17 00:00:00 2001 From: jmagaram Date: Sat, 25 Mar 2023 17:27:41 -0700 Subject: [PATCH 01/16] attempt at bigint compare --- jscomp/runtime/caml_obj.ml | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/jscomp/runtime/caml_obj.ml b/jscomp/runtime/caml_obj.ml index f7d1828a97..183036a631 100644 --- a/jscomp/runtime/caml_obj.ml +++ b/jscomp/runtime/caml_obj.ml @@ -159,7 +159,10 @@ let rec compare (a : Obj.t) (b : Obj.t) : int = raise (Invalid_argument "compare: functional value") | "function", _ -> 1 | _, "function" -> -1 - | "number", "number" -> + | "bigint", "bigint" + | "number", "number" + | "number", "bigint" + | "bigint", "number" -> Pervasives.compare (Obj.magic a : float) (Obj.magic b : float) | "number", _ -> if b == Obj.repr Js.null || Caml_option.isNested b then 1 @@ -282,8 +285,8 @@ let rec equal (a : Obj.t) (b : Obj.t) : bool = else let a_type = Js.typeof a in if - a_type = "string" || a_type = "number" || a_type = "boolean" - || a_type = "undefined" + a_type = "string" || a_type = "number" || a_type = "bigint" + || a_type = "boolean" || a_type = "undefined" || a == [%raw {|null|}] then false else @@ -293,7 +296,8 @@ let rec equal (a : Obj.t) (b : Obj.t) : bool = (* first, check using reference equality *) else if (* a_type = "object" || "symbol" *) - b_type = "number" || b_type = "undefined" || b == [%raw {|null|}] + b_type = "number" || b_type = "bigint" || b_type = "undefined" + || b == [%raw {|null|}] then false else (* [a] [b] could not be null, so it can not raise *) @@ -354,29 +358,28 @@ let equal_nullable (x : Obj.t) (y : Obj.t Js.nullable) = | None -> x == Obj.magic y | Some y -> equal x y +let isNumberOrBigInt a = Js.typeof a = "number" || Js.typeof a = "bigint" + +let canNumericCompare a b = isNumberOrBigInt a && isNumberOrBigInt b + let notequal a b = - if Js.typeof a = "number" && Js.typeof b = "number" then - (Obj.magic a : float) <> (Obj.magic b : float) + if canNumericCompare a b then (Obj.magic a : float) <> (Obj.magic b : float) else not (equal a b) let greaterequal a b = - if Js.typeof a = "number" && Js.typeof b = "number" then - (Obj.magic a : float) >= (Obj.magic b : float) + if canNumericCompare a b then (Obj.magic a : float) >= (Obj.magic b : float) else compare a b >= 0 let greaterthan a b = - if Js.typeof a = "number" && Js.typeof b = "number" then - (Obj.magic a : float) > (Obj.magic b : float) + if canNumericCompare a b then (Obj.magic a : float) > (Obj.magic b : float) else compare a b > 0 let lessequal a b = - if Js.typeof a = "number" && Js.typeof b = "number" then - (Obj.magic a : float) <= (Obj.magic b : float) + if canNumericCompare a b then (Obj.magic a : float) <= (Obj.magic b : float) else compare a b <= 0 let lessthan a b = - if Js.typeof a = "number" && Js.typeof b = "number" then - (Obj.magic a : float) < (Obj.magic b : float) + if canNumericCompare a b then (Obj.magic a : float) < (Obj.magic b : float) else compare a b < 0 let min (x : Obj.t) y = if compare x y <= 0 then x else y From ae78e7b6be76bbf32ddf0557e8cfdee5f8a40c13 Mon Sep 17 00:00:00 2001 From: jmagaram Date: Sat, 25 Mar 2023 17:54:14 -0700 Subject: [PATCH 02/16] bigint compare tests --- jscomp/test/caml_compare_bigint_test.ml | 51 +++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 jscomp/test/caml_compare_bigint_test.ml diff --git a/jscomp/test/caml_compare_bigint_test.ml b/jscomp/test/caml_compare_bigint_test.ml new file mode 100644 index 0000000000..d57ceaa670 --- /dev/null +++ b/jscomp/test/caml_compare_bigint_test.ml @@ -0,0 +1,51 @@ +external fromString : string -> float = "BigInt" [@@bs.val] + +let sml = fromString "123" +let big = fromString "3944949939394" + +let suites : Mt.pair_suites = + [ + (* compare bigint and bigint *) + ("compare bigint and bigint", fun _ -> Eq (true, compare big sml > 0)); + ("compare bigint and bigint", fun _ -> Eq (true, compare sml big < 0)); + ("compare bigint and bigint", fun _ -> Eq (true, compare sml sml == 0)); + (* compare bigint and float *) + ("compare bigint and float", fun _ -> Eq (true, compare big 1.1 > 0)); + ("compare bigint and float", fun _ -> Eq (true, compare 1.1 big < 0)); + ( "compare bigint and float", + fun _ -> Eq (true, compare (fromString "3") (fromString "3") == 0) ); + (* < operator *) + ("< operator", fun _ -> Eq (true, sml < big)); + ("< operator", fun _ -> Eq (false, big < sml)); + ("< operator", fun _ -> Eq (false, big < big)); + (* < operator with float *) + ("< operator with float", fun _ -> Eq (true, 1.1 < big)); + ("< operator with float", fun _ -> Eq (false, big < 1.1)); + (* <= operator *) + ("<= operator", fun _ -> Eq (true, sml <= big)); + ("<= operator", fun _ -> Eq (false, big <= sml)); + ("<= operator", fun _ -> Eq (true, big <= big)); + (* > operator *) + ("> operator", fun _ -> Eq (false, sml > big)); + ("> operator", fun _ -> Eq (true, big > sml)); + ("> operator", fun _ -> Eq (false, big > big)); + (* >= operator *) + (">= operator", fun _ -> Eq (false, sml >= big)); + (">= operator", fun _ -> Eq (true, big >= sml)); + (">= operator", fun _ -> Eq (true, big >= big)); + (* == operator *) + ("== operator", fun _ -> Eq (false, sml == big)); + ("== operator", fun _ -> Eq (true, big == big)); + (* == operator with float *) + (* ("== operator with float", fun _ -> Eq (true, fromString "3" == 3.0)); + ("== operator with float", fun _ -> Eq (true, 3.0 == fromString "3")); + ("== operator with float", fun _ -> Eq (false, 3.0 == big)); *) + (* != operator *) + ("!= operator", fun _ -> Eq (true, sml != big)); + ("!= operator", fun _ -> Eq (true, big == big)); + (* != operator with float *) + (* ("!= operator with float", fun _ -> Eq (false, fromString "3" != 3.0)); + ("!= operator with float", fun _ -> Eq (false, 3.0 != fromString "3")); + ("!= operator with float", fun _ -> Eq (true, 3.0 != big)); *) + ] +let () = Mt.from_pair_suites __FILE__ suites From 51671a80abedf8181215f551fa1e014cc67b30bc Mon Sep 17 00:00:00 2001 From: jmagaram Date: Sat, 25 Mar 2023 19:43:04 -0700 Subject: [PATCH 03/16] better tests --- jscomp/test/caml_compare_bigint_test.ml | 94 ++++++++++++++----------- 1 file changed, 51 insertions(+), 43 deletions(-) diff --git a/jscomp/test/caml_compare_bigint_test.ml b/jscomp/test/caml_compare_bigint_test.ml index d57ceaa670..36e6e9ebcc 100644 --- a/jscomp/test/caml_compare_bigint_test.ml +++ b/jscomp/test/caml_compare_bigint_test.ml @@ -3,49 +3,57 @@ external fromString : string -> float = "BigInt" [@@bs.val] let sml = fromString "123" let big = fromString "3944949939394" -let suites : Mt.pair_suites = +let sameTypes a b = Js.typeof a == Js.typeof b + +let assertLessThan title smaller bigger = + [ + ("compare: " ^ title, fun _ -> Mt.Eq (true, compare bigger smaller > 0)); + ("compare: " ^ title, fun _ -> Mt.Eq (true, compare smaller bigger < 0)); + ("< operator: " ^ title, fun _ -> Mt.Eq (true, smaller < bigger)); + ("<= operator: " ^ title, fun _ -> Mt.Eq (true, smaller <= bigger)); + ("> operator: " ^ title, fun _ -> Mt.Eq (true, bigger > smaller)); + (">= operator: " ^ title, fun _ -> Mt.Eq (true, bigger >= smaller)); + ("min: " ^ title, fun _ -> Mt.Eq (smaller, min bigger smaller)); + ("min: " ^ title, fun _ -> Mt.Eq (smaller, min smaller bigger)); + ("max: " ^ title, fun _ -> Mt.Eq (bigger, max bigger smaller)); + ("max: " ^ title, fun _ -> Mt.Eq (bigger, max smaller bigger)); + ] + @ ([ + ("!= operator: " ^ title, fun _ -> Mt.Eq (true, bigger != smaller)); + ("!= operator: " ^ title, fun _ -> Mt.Eq (true, smaller != bigger)); + ("== operator: " ^ title, fun _ -> Mt.Eq (false, bigger == smaller)); + ("== operator: " ^ title, fun _ -> Mt.Eq (false, smaller == bigger)); + ] + |> List.filter (fun _ -> sameTypes smaller bigger)) + +let assertEqual title num1 num2 = [ - (* compare bigint and bigint *) - ("compare bigint and bigint", fun _ -> Eq (true, compare big sml > 0)); - ("compare bigint and bigint", fun _ -> Eq (true, compare sml big < 0)); - ("compare bigint and bigint", fun _ -> Eq (true, compare sml sml == 0)); - (* compare bigint and float *) - ("compare bigint and float", fun _ -> Eq (true, compare big 1.1 > 0)); - ("compare bigint and float", fun _ -> Eq (true, compare 1.1 big < 0)); - ( "compare bigint and float", - fun _ -> Eq (true, compare (fromString "3") (fromString "3") == 0) ); - (* < operator *) - ("< operator", fun _ -> Eq (true, sml < big)); - ("< operator", fun _ -> Eq (false, big < sml)); - ("< operator", fun _ -> Eq (false, big < big)); - (* < operator with float *) - ("< operator with float", fun _ -> Eq (true, 1.1 < big)); - ("< operator with float", fun _ -> Eq (false, big < 1.1)); - (* <= operator *) - ("<= operator", fun _ -> Eq (true, sml <= big)); - ("<= operator", fun _ -> Eq (false, big <= sml)); - ("<= operator", fun _ -> Eq (true, big <= big)); - (* > operator *) - ("> operator", fun _ -> Eq (false, sml > big)); - ("> operator", fun _ -> Eq (true, big > sml)); - ("> operator", fun _ -> Eq (false, big > big)); - (* >= operator *) - (">= operator", fun _ -> Eq (false, sml >= big)); - (">= operator", fun _ -> Eq (true, big >= sml)); - (">= operator", fun _ -> Eq (true, big >= big)); - (* == operator *) - ("== operator", fun _ -> Eq (false, sml == big)); - ("== operator", fun _ -> Eq (true, big == big)); - (* == operator with float *) - (* ("== operator with float", fun _ -> Eq (true, fromString "3" == 3.0)); - ("== operator with float", fun _ -> Eq (true, 3.0 == fromString "3")); - ("== operator with float", fun _ -> Eq (false, 3.0 == big)); *) - (* != operator *) - ("!= operator", fun _ -> Eq (true, sml != big)); - ("!= operator", fun _ -> Eq (true, big == big)); - (* != operator with float *) - (* ("!= operator with float", fun _ -> Eq (false, fromString "3" != 3.0)); - ("!= operator with float", fun _ -> Eq (false, 3.0 != fromString "3")); - ("!= operator with float", fun _ -> Eq (true, 3.0 != big)); *) + ("compare: " ^ title, fun _ -> Mt.Eq (0, compare num1 num2)); + ("compare: " ^ title, fun _ -> Mt.Eq (0, compare num2 num1)); + ("< operator: " ^ title, fun _ -> Mt.Eq (false, num2 < num1)); + ("<= operator: " ^ title, fun _ -> Mt.Eq (true, num2 <= num1)); + ("> operator: " ^ title, fun _ -> Mt.Eq (false, num1 > num2)); + (">= operator: " ^ title, fun _ -> Mt.Eq (true, num1 >= num2)); + ("min: " ^ title, fun _ -> Mt.Eq (num1, min num1 num2)); + ("max: " ^ title, fun _ -> Mt.Eq (num1, max num1 num2)); ] + @ ([ + ("!= operator: " ^ title, fun _ -> Mt.Eq (false, num1 != num2)); + ("!= operator: " ^ title, fun _ -> Mt.Eq (false, num2 != num1)); + ("== operator: " ^ title, fun _ -> Mt.Eq (true, num1 == num2)); + ("== operator: " ^ title, fun _ -> Mt.Eq (true, num2 == num1)); + ] + |> List.filter (fun _ -> sameTypes num1 num2)) + +let fiveBigInt = fromString "5" + +let suites : Mt.pair_suites = + assertLessThan "123 bigint and 555555 bigint" (fromString "123") + (fromString "555555") + @ assertLessThan "123 bigint and float 9999.99" (fromString "123") 9999.99 + @ assertEqual "98765 bigint and 98765 bigint" (fromString "98765") + (fromString "98765") + @ assertEqual "same instance" fiveBigInt fiveBigInt + @ assertEqual "5 bigint and 5 float" fiveBigInt 5.0 + let () = Mt.from_pair_suites __FILE__ suites From 914ca6b7845606aff764f7fcdd44ce66a85f1b14 Mon Sep 17 00:00:00 2001 From: jmagaram Date: Sat, 25 Mar 2023 20:14:13 -0700 Subject: [PATCH 04/16] do not compare float and bigint --- jscomp/test/caml_compare_bigint_test.ml | 50 +++++++++---------------- 1 file changed, 18 insertions(+), 32 deletions(-) diff --git a/jscomp/test/caml_compare_bigint_test.ml b/jscomp/test/caml_compare_bigint_test.ml index 36e6e9ebcc..94025b4174 100644 --- a/jscomp/test/caml_compare_bigint_test.ml +++ b/jscomp/test/caml_compare_bigint_test.ml @@ -1,11 +1,6 @@ -external fromString : string -> float = "BigInt" [@@bs.val] +external big : string -> float = "BigInt" [@@bs.val] -let sml = fromString "123" -let big = fromString "3944949939394" - -let sameTypes a b = Js.typeof a == Js.typeof b - -let assertLessThan title smaller bigger = +let isLessThan title smaller bigger = [ ("compare: " ^ title, fun _ -> Mt.Eq (true, compare bigger smaller > 0)); ("compare: " ^ title, fun _ -> Mt.Eq (true, compare smaller bigger < 0)); @@ -17,43 +12,34 @@ let assertLessThan title smaller bigger = ("min: " ^ title, fun _ -> Mt.Eq (smaller, min smaller bigger)); ("max: " ^ title, fun _ -> Mt.Eq (bigger, max bigger smaller)); ("max: " ^ title, fun _ -> Mt.Eq (bigger, max smaller bigger)); + ("!= operator: " ^ title, fun _ -> Mt.Eq (true, bigger != smaller)); + ("!= operator: " ^ title, fun _ -> Mt.Eq (true, smaller != bigger)); + ("== operator: " ^ title, fun _ -> Mt.Eq (false, bigger == smaller)); + ("== operator: " ^ title, fun _ -> Mt.Eq (false, smaller == bigger)); ] - @ ([ - ("!= operator: " ^ title, fun _ -> Mt.Eq (true, bigger != smaller)); - ("!= operator: " ^ title, fun _ -> Mt.Eq (true, smaller != bigger)); - ("== operator: " ^ title, fun _ -> Mt.Eq (false, bigger == smaller)); - ("== operator: " ^ title, fun _ -> Mt.Eq (false, smaller == bigger)); - ] - |> List.filter (fun _ -> sameTypes smaller bigger)) -let assertEqual title num1 num2 = +let isEqual title num1 num2 = [ - ("compare: " ^ title, fun _ -> Mt.Eq (0, compare num1 num2)); - ("compare: " ^ title, fun _ -> Mt.Eq (0, compare num2 num1)); ("< operator: " ^ title, fun _ -> Mt.Eq (false, num2 < num1)); ("<= operator: " ^ title, fun _ -> Mt.Eq (true, num2 <= num1)); ("> operator: " ^ title, fun _ -> Mt.Eq (false, num1 > num2)); (">= operator: " ^ title, fun _ -> Mt.Eq (true, num1 >= num2)); ("min: " ^ title, fun _ -> Mt.Eq (num1, min num1 num2)); ("max: " ^ title, fun _ -> Mt.Eq (num1, max num1 num2)); + ("compare: " ^ title, fun _ -> Mt.Eq (0, compare num1 num2)); + ("compare: " ^ title, fun _ -> Mt.Eq (0, compare num2 num1)); + ("!= operator: " ^ title, fun _ -> Mt.Eq (false, num1 != num2)); + ("!= operator: " ^ title, fun _ -> Mt.Eq (false, num2 != num1)); + ("== operator: " ^ title, fun _ -> Mt.Eq (true, num1 == num2)); + ("== operator: " ^ title, fun _ -> Mt.Eq (true, num2 == num1)); ] - @ ([ - ("!= operator: " ^ title, fun _ -> Mt.Eq (false, num1 != num2)); - ("!= operator: " ^ title, fun _ -> Mt.Eq (false, num2 != num1)); - ("== operator: " ^ title, fun _ -> Mt.Eq (true, num1 == num2)); - ("== operator: " ^ title, fun _ -> Mt.Eq (true, num2 == num1)); - ] - |> List.filter (fun _ -> sameTypes num1 num2)) -let fiveBigInt = fromString "5" +let fiveBigInt = big "5" +(** Not comparing floats and Bigint; not sure this is correct since works in JavaScript*) let suites : Mt.pair_suites = - assertLessThan "123 bigint and 555555 bigint" (fromString "123") - (fromString "555555") - @ assertLessThan "123 bigint and float 9999.99" (fromString "123") 9999.99 - @ assertEqual "98765 bigint and 98765 bigint" (fromString "98765") - (fromString "98765") - @ assertEqual "same instance" fiveBigInt fiveBigInt - @ assertEqual "5 bigint and 5 float" fiveBigInt 5.0 + isLessThan "123 and 555555" (big "123") (big "555555") + @ isEqual "98765 and 98765" (big "98765") (big "98765") + @ isEqual "same instance" fiveBigInt fiveBigInt let () = Mt.from_pair_suites __FILE__ suites From 77033b3e8fc0d052d9a5788541d749e520876a3a Mon Sep 17 00:00:00 2001 From: jmagaram Date: Sat, 25 Mar 2023 20:20:55 -0700 Subject: [PATCH 05/16] more bigint compare --- jscomp/test/build.ninja | 3 +- jscomp/test/caml_compare_bigint_test.js | 337 ++++++++++++++++++++++++ jscomp/test/caml_compare_bigint_test.ml | 40 +-- lib/es6/caml_obj.js | 45 +++- lib/js/caml_obj.js | 45 +++- 5 files changed, 429 insertions(+), 41 deletions(-) create mode 100644 jscomp/test/caml_compare_bigint_test.js diff --git a/jscomp/test/build.ninja b/jscomp/test/build.ninja index 09f6d12761..a09ac8d6c2 100644 --- a/jscomp/test/build.ninja +++ b/jscomp/test/build.ninja @@ -109,6 +109,7 @@ o test/bs_string_test.cmi test/bs_string_test.cmj : cc test/bs_string_test.ml | o test/bs_unwrap_test.cmi test/bs_unwrap_test.cmj : cc test/bs_unwrap_test.ml | $bsc $stdlib runtime o test/buffer_test.cmi test/buffer_test.cmj : cc test/buffer_test.ml | test/mt.cmj $bsc $stdlib runtime o test/bytes_split_gpr_743_test.cmi test/bytes_split_gpr_743_test.cmj : cc test/bytes_split_gpr_743_test.ml | test/mt.cmj $bsc $stdlib runtime +o test/caml_compare_bigint_test.cmi test/caml_compare_bigint_test.cmj : cc test/caml_compare_bigint_test.ml | test/mt.cmj $bsc $stdlib runtime o test/caml_compare_test.cmi test/caml_compare_test.cmj : cc test/caml_compare_test.ml | test/mt.cmj $bsc $stdlib runtime o test/caml_format_test.cmi test/caml_format_test.cmj : cc test/caml_format_test.res | test/mt.cmj $bsc $stdlib runtime o test/caml_sys_poly_fill_test.cmi test/caml_sys_poly_fill_test.cmj : cc test/caml_sys_poly_fill_test.ml | test/mt.cmj $bsc $stdlib runtime @@ -721,4 +722,4 @@ o test/variant.cmi test/variant.cmj : cc test/variant.ml | $bsc $stdlib runtime o test/variantsMatching.cmi test/variantsMatching.cmj : cc test/variantsMatching.res | $bsc $stdlib runtime o test/watch_test.cmi test/watch_test.cmj : cc test/watch_test.ml | $bsc $stdlib runtime o test/webpack_config.cmi test/webpack_config.cmj : cc test/webpack_config.ml | $bsc $stdlib runtime -o test : phony test/406_primitive_test.cmi test/406_primitive_test.cmj test/EmptyRecord.cmi test/EmptyRecord.cmj test/SafePromises.cmi test/SafePromises.cmj test/UncurriedAlways.cmi test/UncurriedAlways.cmj test/UncurriedExternals.cmi test/UncurriedExternals.cmj test/UncurriedPervasives.cmi test/UncurriedPervasives.cmj test/a.cmi test/a.cmj test/a_filename_test.cmi test/a_filename_test.cmj test/a_list_test.cmi test/a_list_test.cmj test/a_recursive_type.cmi test/a_recursive_type.cmj test/a_scope_bug.cmi test/a_scope_bug.cmj test/a_string_test.cmi test/a_string_test.cmj test/abstract_type.cmi test/abstract_type.cmj test/adt_optimize_test.cmi test/adt_optimize_test.cmj test/alias_default_value_test.cmi test/alias_default_value_test.cmj test/alias_test.cmi test/alias_test.cmj test/and_or_tailcall_test.cmi test/and_or_tailcall_test.cmj test/app_root_finder.cmi test/app_root_finder.cmj test/argv_test.cmi test/argv_test.cmj test/ari_regress_test.cmi test/ari_regress_test.cmj test/arith_lexer.cmi test/arith_lexer.cmj test/arith_parser.cmi test/arith_parser.cmj test/arith_syntax.cmi test/arith_syntax.cmj test/arity.cmi test/arity.cmj test/arity_deopt.cmi test/arity_deopt.cmj test/arity_infer.cmi test/arity_infer.cmj test/array_data_util.cmi test/array_data_util.cmj test/array_safe_get.cmi test/array_safe_get.cmj test/array_subtle_test.cmi test/array_subtle_test.cmj test/array_test.cmi test/array_test.cmj test/ast_abstract_test.cmi test/ast_abstract_test.cmj test/ast_mapper_unused_warning_test.cmi test/ast_mapper_unused_warning_test.cmj test/async_await.cmi test/async_await.cmj test/async_ideas.cmi test/async_ideas.cmj test/async_inline.cmi test/async_inline.cmj test/attr_test.cmi test/attr_test.cmj test/b.cmi test/b.cmj test/bal_set_mini.cmi test/bal_set_mini.cmj test/bang_primitive.cmi test/bang_primitive.cmj test/basic_module_test.cmi test/basic_module_test.cmj test/bb.cmi test/bb.cmj test/bdd.cmi test/bdd.cmj test/belt_internal_test.cmi test/belt_internal_test.cmj test/belt_result_alias_test.cmi test/belt_result_alias_test.cmj test/bench.cmi test/bench.cmj test/big_enum.cmi test/big_enum.cmj test/big_polyvar_test.cmi test/big_polyvar_test.cmj test/block_alias_test.cmi test/block_alias_test.cmj test/boolean_test.cmi test/boolean_test.cmj test/bs_MapInt_test.cmi test/bs_MapInt_test.cmj test/bs_abstract_test.cmi test/bs_abstract_test.cmj test/bs_array_test.cmi test/bs_array_test.cmj test/bs_auto_uncurry.cmi test/bs_auto_uncurry.cmj test/bs_auto_uncurry_test.cmi test/bs_auto_uncurry_test.cmj test/bs_float_test.cmi test/bs_float_test.cmj test/bs_hashmap_test.cmi test/bs_hashmap_test.cmj test/bs_hashset_int_test.cmi test/bs_hashset_int_test.cmj test/bs_hashtbl_string_test.cmi test/bs_hashtbl_string_test.cmj test/bs_ignore_effect.cmi test/bs_ignore_effect.cmj test/bs_ignore_test.cmi test/bs_ignore_test.cmj test/bs_int_test.cmi test/bs_int_test.cmj test/bs_list_test.cmi test/bs_list_test.cmj test/bs_map_set_dict_test.cmi test/bs_map_set_dict_test.cmj test/bs_map_test.cmi test/bs_map_test.cmj test/bs_min_max_test.cmi test/bs_min_max_test.cmj test/bs_mutable_set_test.cmi test/bs_mutable_set_test.cmj test/bs_node_string_buffer_test.cmi test/bs_node_string_buffer_test.cmj test/bs_poly_map_test.cmi test/bs_poly_map_test.cmj test/bs_poly_mutable_map_test.cmi test/bs_poly_mutable_map_test.cmj test/bs_poly_mutable_set_test.cmi test/bs_poly_mutable_set_test.cmj test/bs_poly_set_test.cmi test/bs_poly_set_test.cmj test/bs_qualified.cmi test/bs_qualified.cmj test/bs_queue_test.cmi test/bs_queue_test.cmj test/bs_rbset_int_bench.cmi test/bs_rbset_int_bench.cmj test/bs_rest_test.cmi test/bs_rest_test.cmj test/bs_set_bench.cmi test/bs_set_bench.cmj test/bs_set_int_test.cmi test/bs_set_int_test.cmj test/bs_sort_test.cmi test/bs_sort_test.cmj test/bs_splice_partial.cmi test/bs_splice_partial.cmj test/bs_stack_test.cmi test/bs_stack_test.cmj test/bs_string_test.cmi test/bs_string_test.cmj test/bs_unwrap_test.cmi test/bs_unwrap_test.cmj test/buffer_test.cmi test/buffer_test.cmj test/bytes_split_gpr_743_test.cmi test/bytes_split_gpr_743_test.cmj test/caml_compare_test.cmi test/caml_compare_test.cmj test/caml_format_test.cmi test/caml_format_test.cmj test/caml_sys_poly_fill_test.cmi test/caml_sys_poly_fill_test.cmj test/chain_code_test.cmi test/chain_code_test.cmj test/chn_test.cmi test/chn_test.cmj test/class_type_ffi_test.cmi test/class_type_ffi_test.cmj test/coercion_module_alias_test.cmi test/coercion_module_alias_test.cmj test/compare_test.cmi test/compare_test.cmj test/complete_parmatch_test.cmi test/complete_parmatch_test.cmj test/complex_if_test.cmi test/complex_if_test.cmj test/complex_test.cmi test/complex_test.cmj test/complex_while_loop.cmi test/complex_while_loop.cmj test/condition_compilation_test.cmi test/condition_compilation_test.cmj test/config1_test.cmi test/config1_test.cmj test/console_log_test.cmi test/console_log_test.cmj test/const_block_test.cmi test/const_block_test.cmj test/const_defs.cmi test/const_defs.cmj test/const_defs_test.cmi test/const_defs_test.cmj test/const_test.cmi test/const_test.cmj test/cont_int_fold_test.cmi test/cont_int_fold_test.cmj test/cps_test.cmi test/cps_test.cmj test/cross_module_inline_test.cmi test/cross_module_inline_test.cmj test/custom_error_test.cmi test/custom_error_test.cmj test/debug_keep_test.cmi test/debug_keep_test.cmj test/debug_mode_value.cmi test/debug_mode_value.cmj test/debug_tmp.cmi test/debug_tmp.cmj test/debugger_test.cmi test/debugger_test.cmj test/default_export_test.cmi test/default_export_test.cmj test/defunctor_make_test.cmi test/defunctor_make_test.cmj test/demo_int_map.cmi test/demo_int_map.cmj test/demo_page.cmi test/demo_page.cmj test/demo_pipe.cmi test/demo_pipe.cmj test/derive_dyntype.cmi test/derive_dyntype.cmj test/derive_projector_test.cmi test/derive_projector_test.cmj test/derive_type_test.cmi test/derive_type_test.cmj test/digest_test.cmi test/digest_test.cmj test/directives.cmi test/directives.cmj test/div_by_zero_test.cmi test/div_by_zero_test.cmj test/dollar_escape_test.cmi test/dollar_escape_test.cmj test/earger_curry_test.cmi test/earger_curry_test.cmj test/effect.cmi test/effect.cmj test/epsilon_test.cmi test/epsilon_test.cmj test/equal_box_test.cmi test/equal_box_test.cmj test/equal_exception_test.cmi test/equal_exception_test.cmj test/equal_test.cmi test/equal_test.cmj test/es6_export.cmi test/es6_export.cmj test/es6_import.cmi test/es6_import.cmj test/es6_module_test.cmi test/es6_module_test.cmj test/escape_esmodule.cmi test/escape_esmodule.cmj test/esmodule_ref.cmi test/esmodule_ref.cmj test/event_ffi.cmi test/event_ffi.cmj test/exception_alias.cmi test/exception_alias.cmj test/exception_def.cmi test/exception_def.cmj test/exception_raise_test.cmi test/exception_raise_test.cmj test/exception_rebind_test.cmi test/exception_rebind_test.cmj test/exception_rebound_err_test.cmi test/exception_rebound_err_test.cmj test/exception_value_test.cmi test/exception_value_test.cmj test/exn_error_pattern.cmi test/exn_error_pattern.cmj test/exponentiation_precedence_test.cmi test/exponentiation_precedence_test.cmj test/export_keyword.cmi test/export_keyword.cmj test/ext_array_test.cmi test/ext_array_test.cmj test/ext_bytes_test.cmi test/ext_bytes_test.cmj test/ext_filename_test.cmi test/ext_filename_test.cmj test/ext_list_test.cmi test/ext_list_test.cmj test/ext_pervasives_test.cmi test/ext_pervasives_test.cmj test/ext_string_test.cmi test/ext_string_test.cmj test/ext_sys_test.cmi test/ext_sys_test.cmj test/extensible_variant_test.cmi test/extensible_variant_test.cmj test/external_polyfill_test.cmi test/external_polyfill_test.cmj test/external_ppx.cmi test/external_ppx.cmj test/external_ppx2.cmi test/external_ppx2.cmj test/fail_comp.cmi test/fail_comp.cmj test/ffi_arity_test.cmi test/ffi_arity_test.cmj test/ffi_array_test.cmi test/ffi_array_test.cmj test/ffi_js_test.cmi test/ffi_js_test.cmj test/ffi_splice_test.cmi test/ffi_splice_test.cmj test/ffi_test.cmi test/ffi_test.cmj test/fib.cmi test/fib.cmj test/flattern_order_test.cmi test/flattern_order_test.cmj test/flexible_array_test.cmi test/flexible_array_test.cmj test/float_array.cmi test/float_array.cmj test/float_of_bits_test.cmi test/float_of_bits_test.cmj test/float_record.cmi test/float_record.cmj test/float_test.cmi test/float_test.cmj test/floatarray_test.cmi test/floatarray_test.cmj test/flow_parser_reg_test.cmi test/flow_parser_reg_test.cmj test/for_loop_test.cmi test/for_loop_test.cmj test/for_side_effect_test.cmi test/for_side_effect_test.cmj test/format_regression.cmi test/format_regression.cmj test/format_test.cmi test/format_test.cmj test/fs_test.cmi test/fs_test.cmj test/fun_pattern_match.cmi test/fun_pattern_match.cmj test/functor_app_test.cmi test/functor_app_test.cmj test/functor_def.cmi test/functor_def.cmj test/functor_ffi.cmi test/functor_ffi.cmj test/functor_inst.cmi test/functor_inst.cmj test/functors.cmi test/functors.cmj test/gbk.cmi test/gbk.cmj test/genlex_test.cmi test/genlex_test.cmj test/gentTypeReTest.cmi test/gentTypeReTest.cmj test/global_exception_regression_test.cmi test/global_exception_regression_test.cmj test/global_mangles.cmi test/global_mangles.cmj test/global_module_alias_test.cmi test/global_module_alias_test.cmj test/google_closure_test.cmi test/google_closure_test.cmj test/gpr496_test.cmi test/gpr496_test.cmj test/gpr_1072.cmi test/gpr_1072.cmj test/gpr_1072_reg.cmi test/gpr_1072_reg.cmj test/gpr_1150.cmi test/gpr_1150.cmj test/gpr_1154_test.cmi test/gpr_1154_test.cmj test/gpr_1170.cmi test/gpr_1170.cmj test/gpr_1240_missing_unbox.cmi test/gpr_1240_missing_unbox.cmj test/gpr_1245_test.cmi test/gpr_1245_test.cmj test/gpr_1268.cmi test/gpr_1268.cmj test/gpr_1409_test.cmi test/gpr_1409_test.cmj test/gpr_1423_app_test.cmi test/gpr_1423_app_test.cmj test/gpr_1423_nav.cmi test/gpr_1423_nav.cmj test/gpr_1438.cmi test/gpr_1438.cmj test/gpr_1481.cmi test/gpr_1481.cmj test/gpr_1484.cmi test/gpr_1484.cmj test/gpr_1503_test.cmi test/gpr_1503_test.cmj test/gpr_1539_test.cmi test/gpr_1539_test.cmj test/gpr_1658_test.cmi test/gpr_1658_test.cmj test/gpr_1667_test.cmi test/gpr_1667_test.cmj test/gpr_1692_test.cmi test/gpr_1692_test.cmj test/gpr_1698_test.cmi test/gpr_1698_test.cmj test/gpr_1701_test.cmi test/gpr_1701_test.cmj test/gpr_1716_test.cmi test/gpr_1716_test.cmj test/gpr_1717_test.cmi test/gpr_1717_test.cmj test/gpr_1728_test.cmi test/gpr_1728_test.cmj test/gpr_1749_test.cmi test/gpr_1749_test.cmj test/gpr_1759_test.cmi test/gpr_1759_test.cmj test/gpr_1760_test.cmi test/gpr_1760_test.cmj test/gpr_1762_test.cmi test/gpr_1762_test.cmj test/gpr_1817_test.cmi test/gpr_1817_test.cmj test/gpr_1822_test.cmi test/gpr_1822_test.cmj test/gpr_1891_test.cmi test/gpr_1891_test.cmj test/gpr_1943_test.cmi test/gpr_1943_test.cmj test/gpr_1946_test.cmi test/gpr_1946_test.cmj test/gpr_2316_test.cmi test/gpr_2316_test.cmj test/gpr_2352_test.cmi test/gpr_2352_test.cmj test/gpr_2413_test.cmi test/gpr_2413_test.cmj test/gpr_2474.cmi test/gpr_2474.cmj test/gpr_2487.cmi test/gpr_2487.cmj test/gpr_2503_test.cmi test/gpr_2503_test.cmj test/gpr_2608_test.cmi test/gpr_2608_test.cmj test/gpr_2614_test.cmi test/gpr_2614_test.cmj test/gpr_2633_test.cmi test/gpr_2633_test.cmj test/gpr_2642_test.cmi test/gpr_2642_test.cmj test/gpr_2652_test.cmi test/gpr_2652_test.cmj test/gpr_2682_test.cmi test/gpr_2682_test.cmj test/gpr_2700_test.cmi test/gpr_2700_test.cmj test/gpr_2731_test.cmi test/gpr_2731_test.cmj test/gpr_2789_test.cmi test/gpr_2789_test.cmj test/gpr_2931_test.cmi test/gpr_2931_test.cmj test/gpr_3142_test.cmi test/gpr_3142_test.cmj test/gpr_3154_test.cmi test/gpr_3154_test.cmj test/gpr_3209_test.cmi test/gpr_3209_test.cmj test/gpr_3492_test.cmi test/gpr_3492_test.cmj test/gpr_3519_jsx_test.cmi test/gpr_3519_jsx_test.cmj test/gpr_3519_test.cmi test/gpr_3519_test.cmj test/gpr_3536_test.cmi test/gpr_3536_test.cmj test/gpr_3546_test.cmi test/gpr_3546_test.cmj test/gpr_3548_test.cmi test/gpr_3548_test.cmj test/gpr_3549_test.cmi test/gpr_3549_test.cmj test/gpr_3566_drive_test.cmi test/gpr_3566_drive_test.cmj test/gpr_3566_test.cmi test/gpr_3566_test.cmj test/gpr_3595_test.cmi test/gpr_3595_test.cmj test/gpr_3609_test.cmi test/gpr_3609_test.cmj test/gpr_3697_test.cmi test/gpr_3697_test.cmj test/gpr_373_test.cmi test/gpr_373_test.cmj test/gpr_3770_test.cmi test/gpr_3770_test.cmj test/gpr_3852_alias.cmi test/gpr_3852_alias.cmj test/gpr_3852_alias_reify.cmi test/gpr_3852_alias_reify.cmj test/gpr_3852_effect.cmi test/gpr_3852_effect.cmj test/gpr_3865.cmi test/gpr_3865.cmj test/gpr_3865_bar.cmi test/gpr_3865_bar.cmj test/gpr_3865_foo.cmi test/gpr_3865_foo.cmj test/gpr_3875_test.cmi test/gpr_3875_test.cmj test/gpr_3877_test.cmi test/gpr_3877_test.cmj test/gpr_3895_test.cmi test/gpr_3895_test.cmj test/gpr_3897_test.cmi test/gpr_3897_test.cmj test/gpr_3931_test.cmi test/gpr_3931_test.cmj test/gpr_3980_test.cmi test/gpr_3980_test.cmj test/gpr_4025_test.cmi test/gpr_4025_test.cmj test/gpr_405_test.cmi test/gpr_405_test.cmj test/gpr_4069_test.cmi test/gpr_4069_test.cmj test/gpr_4265_test.cmi test/gpr_4265_test.cmj test/gpr_4274_test.cmi test/gpr_4274_test.cmj test/gpr_4280_test.cmi test/gpr_4280_test.cmj test/gpr_4407_test.cmi test/gpr_4407_test.cmj test/gpr_441.cmi test/gpr_441.cmj test/gpr_4442_test.cmi test/gpr_4442_test.cmj test/gpr_4491_test.cmi test/gpr_4491_test.cmj test/gpr_4494_test.cmi test/gpr_4494_test.cmj test/gpr_4519_test.cmi test/gpr_4519_test.cmj test/gpr_459_test.cmi test/gpr_459_test.cmj test/gpr_4632.cmi test/gpr_4632.cmj test/gpr_4639_test.cmi test/gpr_4639_test.cmj test/gpr_4900_test.cmi test/gpr_4900_test.cmj test/gpr_4924_test.cmi test/gpr_4924_test.cmj test/gpr_4931.cmi test/gpr_4931.cmj test/gpr_4931_allow.cmi test/gpr_4931_allow.cmj test/gpr_5071_test.cmi test/gpr_5071_test.cmj test/gpr_5169_test.cmi test/gpr_5169_test.cmj test/gpr_5218_test.cmi test/gpr_5218_test.cmj test/gpr_5280_optimize_test.cmi test/gpr_5280_optimize_test.cmj test/gpr_5312.cmi test/gpr_5312.cmj test/gpr_5557.cmi test/gpr_5557.cmj test/gpr_5753.cmi test/gpr_5753.cmj test/gpr_658.cmi test/gpr_658.cmj test/gpr_858_test.cmi test/gpr_858_test.cmj test/gpr_858_unit2_test.cmi test/gpr_858_unit2_test.cmj test/gpr_904_test.cmi test/gpr_904_test.cmj test/gpr_974_test.cmi test/gpr_974_test.cmj test/gpr_977_test.cmi test/gpr_977_test.cmj test/gpr_return_type_unused_attribute.cmi test/gpr_return_type_unused_attribute.cmj test/gray_code_test.cmi test/gray_code_test.cmj test/guide_for_ext.cmi test/guide_for_ext.cmj test/hamming_test.cmi test/hamming_test.cmj test/hash_collision_test.cmi test/hash_collision_test.cmj test/hash_sugar_desugar.cmi test/hash_sugar_desugar.cmj test/hash_test.cmi test/hash_test.cmj test/hashtbl_test.cmi test/hashtbl_test.cmj test/hello.foo.cmi test/hello.foo.cmj test/hello_res.cmi test/hello_res.cmj test/ignore_test.cmi test/ignore_test.cmj test/imm_map_bench.cmi test/imm_map_bench.cmj test/include_side_effect.cmi test/include_side_effect.cmj test/include_side_effect_free.cmi test/include_side_effect_free.cmj test/incomplete_toplevel_test.cmi test/incomplete_toplevel_test.cmj test/infer_type_test.cmi test/infer_type_test.cmj test/inline_const.cmi test/inline_const.cmj test/inline_const_test.cmi test/inline_const_test.cmj test/inline_edge_cases.cmi test/inline_edge_cases.cmj test/inline_map2_test.cmi test/inline_map2_test.cmj test/inline_map_demo.cmi test/inline_map_demo.cmj test/inline_map_test.cmi test/inline_map_test.cmj test/inline_record_test.cmi test/inline_record_test.cmj test/inline_regression_test.cmi test/inline_regression_test.cmj test/inline_string_test.cmi test/inline_string_test.cmj test/inner_call.cmi test/inner_call.cmj test/inner_define.cmi test/inner_define.cmj test/inner_unused.cmi test/inner_unused.cmj test/installation_test.cmi test/installation_test.cmj test/int32_test.cmi test/int32_test.cmj test/int64_mul_div_test.cmi test/int64_mul_div_test.cmj test/int64_string_bench.cmi test/int64_string_bench.cmj test/int64_string_test.cmi test/int64_string_test.cmj test/int64_test.cmi test/int64_test.cmj test/int_hashtbl_test.cmi test/int_hashtbl_test.cmj test/int_map.cmi test/int_map.cmj test/int_overflow_test.cmi test/int_overflow_test.cmj test/int_poly_var.cmi test/int_poly_var.cmj test/int_switch_test.cmi test/int_switch_test.cmj test/internal_unused_test.cmi test/internal_unused_test.cmj test/io_test.cmi test/io_test.cmj test/js_array_test.cmi test/js_array_test.cmj test/js_bool_test.cmi test/js_bool_test.cmj test/js_cast_test.cmi test/js_cast_test.cmj test/js_date_test.cmi test/js_date_test.cmj test/js_dict_test.cmi test/js_dict_test.cmj test/js_exception_catch_test.cmi test/js_exception_catch_test.cmj test/js_float_test.cmi test/js_float_test.cmj test/js_global_test.cmi test/js_global_test.cmj test/js_int_test.cmi test/js_int_test.cmj test/js_json_test.cmi test/js_json_test.cmj test/js_list_test.cmi test/js_list_test.cmj test/js_math_test.cmi test/js_math_test.cmj test/js_null_test.cmi test/js_null_test.cmj test/js_null_undefined_test.cmi test/js_null_undefined_test.cmj test/js_nullable_test.cmi test/js_nullable_test.cmj test/js_obj_test.cmi test/js_obj_test.cmj test/js_option_test.cmi test/js_option_test.cmj test/js_promise_basic_test.cmi test/js_promise_basic_test.cmj test/js_re_test.cmi test/js_re_test.cmj test/js_string_test.cmi test/js_string_test.cmj test/js_typed_array_test.cmi test/js_typed_array_test.cmj test/js_undefined_test.cmi test/js_undefined_test.cmj test/js_val.cmi test/js_val.cmj test/jsoo_400_test.cmi test/jsoo_400_test.cmj test/jsoo_485_test.cmi test/jsoo_485_test.cmj test/jsxv4_newtype.cmi test/jsxv4_newtype.cmj test/key_word_property.cmi test/key_word_property.cmj test/key_word_property2.cmi test/key_word_property2.cmj test/key_word_property_plus_test.cmi test/key_word_property_plus_test.cmj test/label_uncurry.cmi test/label_uncurry.cmj test/large_integer_pat.cmi test/large_integer_pat.cmj test/large_record_duplication_test.cmi test/large_record_duplication_test.cmj test/largest_int_flow.cmi test/largest_int_flow.cmj test/lazy_demo.cmi test/lazy_demo.cmj test/lazy_test.cmi test/lazy_test.cmj test/lib_js_test.cmi test/lib_js_test.cmj test/libarg_test.cmi test/libarg_test.cmj test/libqueue_test.cmi test/libqueue_test.cmj test/limits_test.cmi test/limits_test.cmj test/list_stack.cmi test/list_stack.cmj test/list_test.cmi test/list_test.cmj test/local_exception_test.cmi test/local_exception_test.cmj test/loop_regression_test.cmi test/loop_regression_test.cmj test/loop_suites_test.cmi test/loop_suites_test.cmj test/map_find_test.cmi test/map_find_test.cmj test/map_test.cmi test/map_test.cmj test/mario_game.cmi test/mario_game.cmj test/marshal.cmi test/marshal.cmj test/meth_annotation.cmi test/meth_annotation.cmj test/method_name_test.cmi test/method_name_test.cmj test/method_string_name.cmi test/method_string_name.cmj test/minimal_test.cmi test/minimal_test.cmj test/miss_colon_test.cmi test/miss_colon_test.cmj test/mock_mt.cmi test/mock_mt.cmj test/module_alias_test.cmi test/module_alias_test.cmj test/module_as_class_ffi.cmi test/module_as_class_ffi.cmj test/module_as_function.cmi test/module_as_function.cmj test/module_missing_conversion.cmi test/module_missing_conversion.cmj test/module_parameter_test.cmi test/module_parameter_test.cmj test/module_splice_test.cmi test/module_splice_test.cmj test/more_poly_variant_test.cmi test/more_poly_variant_test.cmj test/more_uncurry.cmi test/more_uncurry.cmj test/mpr_6033_test.cmi test/mpr_6033_test.cmj test/mt.cmi test/mt.cmj test/mt_global.cmi test/mt_global.cmj test/mutable_obj_test.cmi test/mutable_obj_test.cmj test/mutable_uncurry_test.cmi test/mutable_uncurry_test.cmj test/mutual_non_recursive_type.cmi test/mutual_non_recursive_type.cmj test/name_mangle_test.cmi test/name_mangle_test.cmj test/nested_include.cmi test/nested_include.cmj test/nested_module_alias.cmi test/nested_module_alias.cmj test/nested_obj_literal.cmi test/nested_obj_literal.cmj test/nested_obj_test.cmi test/nested_obj_test.cmj test/nested_pattern_match_test.cmi test/nested_pattern_match_test.cmj test/noassert.cmi test/noassert.cmj test/node_fs_test.cmi test/node_fs_test.cmj test/node_path_test.cmi test/node_path_test.cmj test/null_list_test.cmi test/null_list_test.cmj test/number_lexer.cmi test/number_lexer.cmj test/obj_literal_ppx.cmi test/obj_literal_ppx.cmj test/obj_literal_ppx_test.cmi test/obj_literal_ppx_test.cmj test/obj_magic_test.cmi test/obj_magic_test.cmj test/obj_type_test.cmi test/obj_type_test.cmj test/ocaml_re_test.cmi test/ocaml_re_test.cmj test/of_string_test.cmi test/of_string_test.cmj test/offset.cmi test/offset.cmj test/option_encoding_test.cmi test/option_encoding_test.cmj test/option_record_none_test.cmi test/option_record_none_test.cmj test/option_repr_test.cmi test/option_repr_test.cmj test/optional_ffi_test.cmi test/optional_ffi_test.cmj test/optional_regression_test.cmi test/optional_regression_test.cmj test/pipe_send_readline.cmi test/pipe_send_readline.cmj test/pipe_syntax.cmi test/pipe_syntax.cmj test/poly_empty_array.cmi test/poly_empty_array.cmj test/poly_variant_test.cmi test/poly_variant_test.cmj test/polymorphic_raw_test.cmi test/polymorphic_raw_test.cmj test/polymorphism_test.cmi test/polymorphism_test.cmj test/polyvar_convert.cmi test/polyvar_convert.cmj test/polyvar_test.cmi test/polyvar_test.cmj test/ppx_apply_test.cmi test/ppx_apply_test.cmj test/pq_test.cmi test/pq_test.cmj test/pr6726.cmi test/pr6726.cmj test/pr_regression_test.cmi test/pr_regression_test.cmj test/prepend_data_ffi.cmi test/prepend_data_ffi.cmj test/primitive_reg_test.cmi test/primitive_reg_test.cmj test/print_alpha_test.cmi test/print_alpha_test.cmj test/promise_catch_test.cmi test/promise_catch_test.cmj test/queue_402.cmi test/queue_402.cmj test/queue_test.cmi test/queue_test.cmj test/random_test.cmi test/random_test.cmj test/raw_hash_tbl_bench.cmi test/raw_hash_tbl_bench.cmj test/raw_output_test.cmi test/raw_output_test.cmj test/raw_pure_test.cmi test/raw_pure_test.cmj test/rbset.cmi test/rbset.cmj test/react.cmi test/react.cmj test/reactDOMRe.cmi test/reactDOMRe.cmj test/reactDOMServerRe.cmi test/reactDOMServerRe.cmj test/reactEvent.cmi test/reactEvent.cmj test/reactTestUtils.cmi test/reactTestUtils.cmj test/reasonReact.cmi test/reasonReact.cmj test/reasonReactCompat.cmi test/reasonReactCompat.cmj test/reasonReactOptimizedCreateClass.cmi test/reasonReactOptimizedCreateClass.cmj test/reasonReactRouter.cmi test/reasonReactRouter.cmj test/rebind_module.cmi test/rebind_module.cmj test/rebind_module_test.cmi test/rebind_module_test.cmj test/rec_array_test.cmi test/rec_array_test.cmj test/rec_fun_test.cmi test/rec_fun_test.cmj test/rec_module_opt.cmi test/rec_module_opt.cmj test/rec_module_test.cmi test/rec_module_test.cmj test/rec_value_test.cmi test/rec_value_test.cmj test/record_debug_test.cmi test/record_debug_test.cmj test/record_extension_test.cmi test/record_extension_test.cmj test/record_name_test.cmi test/record_name_test.cmj test/record_regression.cmi test/record_regression.cmj test/record_with_test.cmi test/record_with_test.cmj test/recursive_module.cmi test/recursive_module.cmj test/recursive_module_test.cmi test/recursive_module_test.cmj test/recursive_react_component.cmi test/recursive_react_component.cmj test/recursive_records_test.cmi test/recursive_records_test.cmj test/recursive_unbound_module_test.cmi test/recursive_unbound_module_test.cmj test/regression_print.cmi test/regression_print.cmj test/relative_path.cmi test/relative_path.cmj test/res_debug.cmi test/res_debug.cmj test/return_check.cmi test/return_check.cmj test/runtime_encoding_test.cmi test/runtime_encoding_test.cmj test/set_annotation.cmi test/set_annotation.cmj test/set_gen.cmi test/set_gen.cmj test/sexp.cmi test/sexp.cmj test/sexpm.cmi test/sexpm.cmj test/sexpm_test.cmi test/sexpm_test.cmj test/side_effect.cmi test/side_effect.cmj test/side_effect_free.cmi test/side_effect_free.cmj test/simple_derive_test.cmi test/simple_derive_test.cmj test/simple_derive_use.cmi test/simple_derive_use.cmj test/simple_lexer_test.cmi test/simple_lexer_test.cmj test/simplify_lambda_632o.cmi test/simplify_lambda_632o.cmj test/single_module_alias.cmi test/single_module_alias.cmj test/singular_unit_test.cmi test/singular_unit_test.cmj test/small_inline_test.cmi test/small_inline_test.cmj test/splice_test.cmi test/splice_test.cmj test/stack_comp_test.cmi test/stack_comp_test.cmj test/stack_test.cmi test/stack_test.cmj test/stream_parser_test.cmi test/stream_parser_test.cmj test/string_bound_get_test.cmi test/string_bound_get_test.cmj test/string_constant_compare.cmi test/string_constant_compare.cmj test/string_get_set_test.cmi test/string_get_set_test.cmj test/string_literal_print_test.cmi test/string_literal_print_test.cmj test/string_runtime_test.cmi test/string_runtime_test.cmj test/string_set.cmi test/string_set.cmj test/string_set_test.cmi test/string_set_test.cmj test/string_test.cmi test/string_test.cmj test/string_unicode_test.cmi test/string_unicode_test.cmj test/stringmatch_test.cmi test/stringmatch_test.cmj test/submodule.cmi test/submodule.cmj test/submodule_call.cmi test/submodule_call.cmj test/switch_case_test.cmi test/switch_case_test.cmj test/switch_string.cmi test/switch_string.cmj test/tailcall_inline_test.cmi test/tailcall_inline_test.cmj test/template.cmi test/template.cmj test/test.cmi test/test.cmj test/test2.cmi test/test2.cmj test/test_alias.cmi test/test_alias.cmj test/test_ari.cmi test/test_ari.cmj test/test_array.cmi test/test_array.cmj test/test_array_append.cmi test/test_array_append.cmj test/test_array_primitive.cmi test/test_array_primitive.cmj test/test_bool_equal.cmi test/test_bool_equal.cmj test/test_bs_this.cmi test/test_bs_this.cmj test/test_bug.cmi test/test_bug.cmj test/test_bytes.cmi test/test_bytes.cmj test/test_case_opt_collision.cmi test/test_case_opt_collision.cmj test/test_case_set.cmi test/test_case_set.cmj test/test_char.cmi test/test_char.cmj test/test_closure.cmi test/test_closure.cmj test/test_common.cmi test/test_common.cmj test/test_const_elim.cmi test/test_const_elim.cmj test/test_const_propogate.cmi test/test_const_propogate.cmj test/test_cpp.cmi test/test_cpp.cmj test/test_cps.cmi test/test_cps.cmj test/test_demo.cmi test/test_demo.cmj test/test_dup_param.cmi test/test_dup_param.cmj test/test_eq.cmi test/test_eq.cmj test/test_exception.cmi test/test_exception.cmj test/test_exception_escape.cmi test/test_exception_escape.cmj test/test_export2.cmi test/test_export2.cmj test/test_external.cmi test/test_external.cmj test/test_external_unit.cmi test/test_external_unit.cmj test/test_ffi.cmi test/test_ffi.cmj test/test_fib.cmi test/test_fib.cmj test/test_filename.cmi test/test_filename.cmj test/test_for_loop.cmi test/test_for_loop.cmj test/test_for_map.cmi test/test_for_map.cmj test/test_for_map2.cmi test/test_for_map2.cmj test/test_format.cmi test/test_format.cmj test/test_formatter.cmi test/test_formatter.cmj test/test_functor_dead_code.cmi test/test_functor_dead_code.cmj test/test_generative_module.cmi test/test_generative_module.cmj test/test_global_print.cmi test/test_global_print.cmj test/test_google_closure.cmi test/test_google_closure.cmj test/test_include.cmi test/test_include.cmj test/test_incomplete.cmi test/test_incomplete.cmj test/test_incr_ref.cmi test/test_incr_ref.cmj test/test_int_map_find.cmi test/test_int_map_find.cmj test/test_internalOO.cmi test/test_internalOO.cmj test/test_is_js.cmi test/test_is_js.cmj test/test_js_ffi.cmi test/test_js_ffi.cmj test/test_let.cmi test/test_let.cmj test/test_list.cmi test/test_list.cmj test/test_literal.cmi test/test_literal.cmj test/test_literals.cmi test/test_literals.cmj test/test_match_exception.cmi test/test_match_exception.cmj test/test_mutliple.cmi test/test_mutliple.cmj test/test_nat64.cmi test/test_nat64.cmj test/test_nested_let.cmi test/test_nested_let.cmj test/test_nested_print.cmi test/test_nested_print.cmj test/test_non_export.cmi test/test_non_export.cmj test/test_nullary.cmi test/test_nullary.cmj test/test_obj.cmi test/test_obj.cmj test/test_obj_simple_ffi.cmi test/test_obj_simple_ffi.cmj test/test_order.cmi test/test_order.cmj test/test_order_tailcall.cmi test/test_order_tailcall.cmj test/test_other_exn.cmi test/test_other_exn.cmj test/test_pack.cmi test/test_pack.cmj test/test_per.cmi test/test_per.cmj test/test_pervasive.cmi test/test_pervasive.cmj test/test_pervasives2.cmi test/test_pervasives2.cmj test/test_pervasives3.cmi test/test_pervasives3.cmj test/test_primitive.cmi test/test_primitive.cmj test/test_ramification.cmi test/test_ramification.cmj test/test_react.cmi test/test_react.cmj test/test_react_case.cmi test/test_react_case.cmj test/test_regex.cmi test/test_regex.cmj test/test_require.cmi test/test_require.cmj test/test_runtime_encoding.cmi test/test_runtime_encoding.cmj test/test_scope.cmi test/test_scope.cmj test/test_seq.cmi test/test_seq.cmj test/test_set.cmi test/test_set.cmj test/test_side_effect_functor.cmi test/test_side_effect_functor.cmj test/test_simple_include.cmi test/test_simple_include.cmj test/test_simple_pattern_match.cmi test/test_simple_pattern_match.cmj test/test_simple_ref.cmi test/test_simple_ref.cmj test/test_simple_tailcall.cmi test/test_simple_tailcall.cmj test/test_small.cmi test/test_small.cmj test/test_sprintf.cmi test/test_sprintf.cmj test/test_stack.cmi test/test_stack.cmj test/test_static_catch_ident.cmi test/test_static_catch_ident.cmj test/test_string.cmi test/test_string.cmj test/test_string_case.cmi test/test_string_case.cmj test/test_string_const.cmi test/test_string_const.cmj test/test_string_map.cmi test/test_string_map.cmj test/test_string_switch.cmi test/test_string_switch.cmj test/test_switch.cmi test/test_switch.cmj test/test_trywith.cmi test/test_trywith.cmj test/test_tuple.cmi test/test_tuple.cmj test/test_tuple_destructring.cmi test/test_tuple_destructring.cmj test/test_type_based_arity.cmi test/test_type_based_arity.cmj test/test_u.cmi test/test_u.cmj test/test_unknown.cmi test/test_unknown.cmj test/test_unsafe_cmp.cmi test/test_unsafe_cmp.cmj test/test_unsafe_obj_ffi.cmi test/test_unsafe_obj_ffi.cmj test/test_unsafe_obj_ffi_ppx.cmi test/test_unsafe_obj_ffi_ppx.cmj test/test_unsupported_primitive.cmi test/test_unsupported_primitive.cmj test/test_while_closure.cmi test/test_while_closure.cmj test/test_while_side_effect.cmi test/test_while_side_effect.cmj test/test_zero_nullable.cmi test/test_zero_nullable.cmj test/then_mangle_test.cmi test/then_mangle_test.cmj test/ticker.cmi test/ticker.cmj test/to_string_test.cmi test/to_string_test.cmj test/topsort_test.cmi test/topsort_test.cmj test/tramp_fib.cmi test/tramp_fib.cmj test/tuple_alloc.cmi test/tuple_alloc.cmj test/type_disambiguate.cmi test/type_disambiguate.cmj test/typeof_test.cmi test/typeof_test.cmj test/ui_defs.cmi test/unboxed_attribute.cmi test/unboxed_attribute.cmj test/unboxed_attribute_test.cmi test/unboxed_attribute_test.cmj test/unboxed_crash.cmi test/unboxed_crash.cmj test/unboxed_use_case.cmi test/unboxed_use_case.cmj test/uncurried_cast.cmi test/uncurried_cast.cmj test/uncurried_default.args.cmi test/uncurried_default.args.cmj test/uncurried_pipe.cmi test/uncurried_pipe.cmj test/uncurry_external_test.cmi test/uncurry_external_test.cmj test/uncurry_glob_test.cmi test/uncurry_glob_test.cmj test/uncurry_test.cmi test/uncurry_test.cmj test/undef_regression2_test.cmi test/undef_regression2_test.cmj test/undef_regression_test.cmi test/undef_regression_test.cmj test/undefine_conditional.cmi test/undefine_conditional.cmj test/unicode_type_error.cmi test/unicode_type_error.cmj test/unit_undefined_test.cmi test/unit_undefined_test.cmj test/unitest_string.cmi test/unitest_string.cmj test/unsafe_full_apply_primitive.cmi test/unsafe_full_apply_primitive.cmj test/unsafe_ppx_test.cmi test/unsafe_ppx_test.cmj test/unsafe_this.cmi test/unsafe_this.cmj test/update_record_test.cmi test/update_record_test.cmj test/utf8_decode_test.cmi test/utf8_decode_test.cmj test/variant.cmi test/variant.cmj test/variantsMatching.cmi test/variantsMatching.cmj test/watch_test.cmi test/watch_test.cmj test/webpack_config.cmi test/webpack_config.cmj +o test : phony test/406_primitive_test.cmi test/406_primitive_test.cmj test/EmptyRecord.cmi test/EmptyRecord.cmj test/SafePromises.cmi test/SafePromises.cmj test/UncurriedAlways.cmi test/UncurriedAlways.cmj test/UncurriedExternals.cmi test/UncurriedExternals.cmj test/UncurriedPervasives.cmi test/UncurriedPervasives.cmj test/a.cmi test/a.cmj test/a_filename_test.cmi test/a_filename_test.cmj test/a_list_test.cmi test/a_list_test.cmj test/a_recursive_type.cmi test/a_recursive_type.cmj test/a_scope_bug.cmi test/a_scope_bug.cmj test/a_string_test.cmi test/a_string_test.cmj test/abstract_type.cmi test/abstract_type.cmj test/adt_optimize_test.cmi test/adt_optimize_test.cmj test/alias_default_value_test.cmi test/alias_default_value_test.cmj test/alias_test.cmi test/alias_test.cmj test/and_or_tailcall_test.cmi test/and_or_tailcall_test.cmj test/app_root_finder.cmi test/app_root_finder.cmj test/argv_test.cmi test/argv_test.cmj test/ari_regress_test.cmi test/ari_regress_test.cmj test/arith_lexer.cmi test/arith_lexer.cmj test/arith_parser.cmi test/arith_parser.cmj test/arith_syntax.cmi test/arith_syntax.cmj test/arity.cmi test/arity.cmj test/arity_deopt.cmi test/arity_deopt.cmj test/arity_infer.cmi test/arity_infer.cmj test/array_data_util.cmi test/array_data_util.cmj test/array_safe_get.cmi test/array_safe_get.cmj test/array_subtle_test.cmi test/array_subtle_test.cmj test/array_test.cmi test/array_test.cmj test/ast_abstract_test.cmi test/ast_abstract_test.cmj test/ast_mapper_unused_warning_test.cmi test/ast_mapper_unused_warning_test.cmj test/async_await.cmi test/async_await.cmj test/async_ideas.cmi test/async_ideas.cmj test/async_inline.cmi test/async_inline.cmj test/attr_test.cmi test/attr_test.cmj test/b.cmi test/b.cmj test/bal_set_mini.cmi test/bal_set_mini.cmj test/bang_primitive.cmi test/bang_primitive.cmj test/basic_module_test.cmi test/basic_module_test.cmj test/bb.cmi test/bb.cmj test/bdd.cmi test/bdd.cmj test/belt_internal_test.cmi test/belt_internal_test.cmj test/belt_result_alias_test.cmi test/belt_result_alias_test.cmj test/bench.cmi test/bench.cmj test/big_enum.cmi test/big_enum.cmj test/big_polyvar_test.cmi test/big_polyvar_test.cmj test/block_alias_test.cmi test/block_alias_test.cmj test/boolean_test.cmi test/boolean_test.cmj test/bs_MapInt_test.cmi test/bs_MapInt_test.cmj test/bs_abstract_test.cmi test/bs_abstract_test.cmj test/bs_array_test.cmi test/bs_array_test.cmj test/bs_auto_uncurry.cmi test/bs_auto_uncurry.cmj test/bs_auto_uncurry_test.cmi test/bs_auto_uncurry_test.cmj test/bs_float_test.cmi test/bs_float_test.cmj test/bs_hashmap_test.cmi test/bs_hashmap_test.cmj test/bs_hashset_int_test.cmi test/bs_hashset_int_test.cmj test/bs_hashtbl_string_test.cmi test/bs_hashtbl_string_test.cmj test/bs_ignore_effect.cmi test/bs_ignore_effect.cmj test/bs_ignore_test.cmi test/bs_ignore_test.cmj test/bs_int_test.cmi test/bs_int_test.cmj test/bs_list_test.cmi test/bs_list_test.cmj test/bs_map_set_dict_test.cmi test/bs_map_set_dict_test.cmj test/bs_map_test.cmi test/bs_map_test.cmj test/bs_min_max_test.cmi test/bs_min_max_test.cmj test/bs_mutable_set_test.cmi test/bs_mutable_set_test.cmj test/bs_node_string_buffer_test.cmi test/bs_node_string_buffer_test.cmj test/bs_poly_map_test.cmi test/bs_poly_map_test.cmj test/bs_poly_mutable_map_test.cmi test/bs_poly_mutable_map_test.cmj test/bs_poly_mutable_set_test.cmi test/bs_poly_mutable_set_test.cmj test/bs_poly_set_test.cmi test/bs_poly_set_test.cmj test/bs_qualified.cmi test/bs_qualified.cmj test/bs_queue_test.cmi test/bs_queue_test.cmj test/bs_rbset_int_bench.cmi test/bs_rbset_int_bench.cmj test/bs_rest_test.cmi test/bs_rest_test.cmj test/bs_set_bench.cmi test/bs_set_bench.cmj test/bs_set_int_test.cmi test/bs_set_int_test.cmj test/bs_sort_test.cmi test/bs_sort_test.cmj test/bs_splice_partial.cmi test/bs_splice_partial.cmj test/bs_stack_test.cmi test/bs_stack_test.cmj test/bs_string_test.cmi test/bs_string_test.cmj test/bs_unwrap_test.cmi test/bs_unwrap_test.cmj test/buffer_test.cmi test/buffer_test.cmj test/bytes_split_gpr_743_test.cmi test/bytes_split_gpr_743_test.cmj test/caml_compare_bigint_test.cmi test/caml_compare_bigint_test.cmj test/caml_compare_test.cmi test/caml_compare_test.cmj test/caml_format_test.cmi test/caml_format_test.cmj test/caml_sys_poly_fill_test.cmi test/caml_sys_poly_fill_test.cmj test/chain_code_test.cmi test/chain_code_test.cmj test/chn_test.cmi test/chn_test.cmj test/class_type_ffi_test.cmi test/class_type_ffi_test.cmj test/coercion_module_alias_test.cmi test/coercion_module_alias_test.cmj test/compare_test.cmi test/compare_test.cmj test/complete_parmatch_test.cmi test/complete_parmatch_test.cmj test/complex_if_test.cmi test/complex_if_test.cmj test/complex_test.cmi test/complex_test.cmj test/complex_while_loop.cmi test/complex_while_loop.cmj test/condition_compilation_test.cmi test/condition_compilation_test.cmj test/config1_test.cmi test/config1_test.cmj test/console_log_test.cmi test/console_log_test.cmj test/const_block_test.cmi test/const_block_test.cmj test/const_defs.cmi test/const_defs.cmj test/const_defs_test.cmi test/const_defs_test.cmj test/const_test.cmi test/const_test.cmj test/cont_int_fold_test.cmi test/cont_int_fold_test.cmj test/cps_test.cmi test/cps_test.cmj test/cross_module_inline_test.cmi test/cross_module_inline_test.cmj test/custom_error_test.cmi test/custom_error_test.cmj test/debug_keep_test.cmi test/debug_keep_test.cmj test/debug_mode_value.cmi test/debug_mode_value.cmj test/debug_tmp.cmi test/debug_tmp.cmj test/debugger_test.cmi test/debugger_test.cmj test/default_export_test.cmi test/default_export_test.cmj test/defunctor_make_test.cmi test/defunctor_make_test.cmj test/demo_int_map.cmi test/demo_int_map.cmj test/demo_page.cmi test/demo_page.cmj test/demo_pipe.cmi test/demo_pipe.cmj test/derive_dyntype.cmi test/derive_dyntype.cmj test/derive_projector_test.cmi test/derive_projector_test.cmj test/derive_type_test.cmi test/derive_type_test.cmj test/digest_test.cmi test/digest_test.cmj test/directives.cmi test/directives.cmj test/div_by_zero_test.cmi test/div_by_zero_test.cmj test/dollar_escape_test.cmi test/dollar_escape_test.cmj test/earger_curry_test.cmi test/earger_curry_test.cmj test/effect.cmi test/effect.cmj test/epsilon_test.cmi test/epsilon_test.cmj test/equal_box_test.cmi test/equal_box_test.cmj test/equal_exception_test.cmi test/equal_exception_test.cmj test/equal_test.cmi test/equal_test.cmj test/es6_export.cmi test/es6_export.cmj test/es6_import.cmi test/es6_import.cmj test/es6_module_test.cmi test/es6_module_test.cmj test/escape_esmodule.cmi test/escape_esmodule.cmj test/esmodule_ref.cmi test/esmodule_ref.cmj test/event_ffi.cmi test/event_ffi.cmj test/exception_alias.cmi test/exception_alias.cmj test/exception_def.cmi test/exception_def.cmj test/exception_raise_test.cmi test/exception_raise_test.cmj test/exception_rebind_test.cmi test/exception_rebind_test.cmj test/exception_rebound_err_test.cmi test/exception_rebound_err_test.cmj test/exception_value_test.cmi test/exception_value_test.cmj test/exn_error_pattern.cmi test/exn_error_pattern.cmj test/exponentiation_precedence_test.cmi test/exponentiation_precedence_test.cmj test/export_keyword.cmi test/export_keyword.cmj test/ext_array_test.cmi test/ext_array_test.cmj test/ext_bytes_test.cmi test/ext_bytes_test.cmj test/ext_filename_test.cmi test/ext_filename_test.cmj test/ext_list_test.cmi test/ext_list_test.cmj test/ext_pervasives_test.cmi test/ext_pervasives_test.cmj test/ext_string_test.cmi test/ext_string_test.cmj test/ext_sys_test.cmi test/ext_sys_test.cmj test/extensible_variant_test.cmi test/extensible_variant_test.cmj test/external_polyfill_test.cmi test/external_polyfill_test.cmj test/external_ppx.cmi test/external_ppx.cmj test/external_ppx2.cmi test/external_ppx2.cmj test/fail_comp.cmi test/fail_comp.cmj test/ffi_arity_test.cmi test/ffi_arity_test.cmj test/ffi_array_test.cmi test/ffi_array_test.cmj test/ffi_js_test.cmi test/ffi_js_test.cmj test/ffi_splice_test.cmi test/ffi_splice_test.cmj test/ffi_test.cmi test/ffi_test.cmj test/fib.cmi test/fib.cmj test/flattern_order_test.cmi test/flattern_order_test.cmj test/flexible_array_test.cmi test/flexible_array_test.cmj test/float_array.cmi test/float_array.cmj test/float_of_bits_test.cmi test/float_of_bits_test.cmj test/float_record.cmi test/float_record.cmj test/float_test.cmi test/float_test.cmj test/floatarray_test.cmi test/floatarray_test.cmj test/flow_parser_reg_test.cmi test/flow_parser_reg_test.cmj test/for_loop_test.cmi test/for_loop_test.cmj test/for_side_effect_test.cmi test/for_side_effect_test.cmj test/format_regression.cmi test/format_regression.cmj test/format_test.cmi test/format_test.cmj test/fs_test.cmi test/fs_test.cmj test/fun_pattern_match.cmi test/fun_pattern_match.cmj test/functor_app_test.cmi test/functor_app_test.cmj test/functor_def.cmi test/functor_def.cmj test/functor_ffi.cmi test/functor_ffi.cmj test/functor_inst.cmi test/functor_inst.cmj test/functors.cmi test/functors.cmj test/gbk.cmi test/gbk.cmj test/genlex_test.cmi test/genlex_test.cmj test/gentTypeReTest.cmi test/gentTypeReTest.cmj test/global_exception_regression_test.cmi test/global_exception_regression_test.cmj test/global_mangles.cmi test/global_mangles.cmj test/global_module_alias_test.cmi test/global_module_alias_test.cmj test/google_closure_test.cmi test/google_closure_test.cmj test/gpr496_test.cmi test/gpr496_test.cmj test/gpr_1072.cmi test/gpr_1072.cmj test/gpr_1072_reg.cmi test/gpr_1072_reg.cmj test/gpr_1150.cmi test/gpr_1150.cmj test/gpr_1154_test.cmi test/gpr_1154_test.cmj test/gpr_1170.cmi test/gpr_1170.cmj test/gpr_1240_missing_unbox.cmi test/gpr_1240_missing_unbox.cmj test/gpr_1245_test.cmi test/gpr_1245_test.cmj test/gpr_1268.cmi test/gpr_1268.cmj test/gpr_1409_test.cmi test/gpr_1409_test.cmj test/gpr_1423_app_test.cmi test/gpr_1423_app_test.cmj test/gpr_1423_nav.cmi test/gpr_1423_nav.cmj test/gpr_1438.cmi test/gpr_1438.cmj test/gpr_1481.cmi test/gpr_1481.cmj test/gpr_1484.cmi test/gpr_1484.cmj test/gpr_1503_test.cmi test/gpr_1503_test.cmj test/gpr_1539_test.cmi test/gpr_1539_test.cmj test/gpr_1658_test.cmi test/gpr_1658_test.cmj test/gpr_1667_test.cmi test/gpr_1667_test.cmj test/gpr_1692_test.cmi test/gpr_1692_test.cmj test/gpr_1698_test.cmi test/gpr_1698_test.cmj test/gpr_1701_test.cmi test/gpr_1701_test.cmj test/gpr_1716_test.cmi test/gpr_1716_test.cmj test/gpr_1717_test.cmi test/gpr_1717_test.cmj test/gpr_1728_test.cmi test/gpr_1728_test.cmj test/gpr_1749_test.cmi test/gpr_1749_test.cmj test/gpr_1759_test.cmi test/gpr_1759_test.cmj test/gpr_1760_test.cmi test/gpr_1760_test.cmj test/gpr_1762_test.cmi test/gpr_1762_test.cmj test/gpr_1817_test.cmi test/gpr_1817_test.cmj test/gpr_1822_test.cmi test/gpr_1822_test.cmj test/gpr_1891_test.cmi test/gpr_1891_test.cmj test/gpr_1943_test.cmi test/gpr_1943_test.cmj test/gpr_1946_test.cmi test/gpr_1946_test.cmj test/gpr_2316_test.cmi test/gpr_2316_test.cmj test/gpr_2352_test.cmi test/gpr_2352_test.cmj test/gpr_2413_test.cmi test/gpr_2413_test.cmj test/gpr_2474.cmi test/gpr_2474.cmj test/gpr_2487.cmi test/gpr_2487.cmj test/gpr_2503_test.cmi test/gpr_2503_test.cmj test/gpr_2608_test.cmi test/gpr_2608_test.cmj test/gpr_2614_test.cmi test/gpr_2614_test.cmj test/gpr_2633_test.cmi test/gpr_2633_test.cmj test/gpr_2642_test.cmi test/gpr_2642_test.cmj test/gpr_2652_test.cmi test/gpr_2652_test.cmj test/gpr_2682_test.cmi test/gpr_2682_test.cmj test/gpr_2700_test.cmi test/gpr_2700_test.cmj test/gpr_2731_test.cmi test/gpr_2731_test.cmj test/gpr_2789_test.cmi test/gpr_2789_test.cmj test/gpr_2931_test.cmi test/gpr_2931_test.cmj test/gpr_3142_test.cmi test/gpr_3142_test.cmj test/gpr_3154_test.cmi test/gpr_3154_test.cmj test/gpr_3209_test.cmi test/gpr_3209_test.cmj test/gpr_3492_test.cmi test/gpr_3492_test.cmj test/gpr_3519_jsx_test.cmi test/gpr_3519_jsx_test.cmj test/gpr_3519_test.cmi test/gpr_3519_test.cmj test/gpr_3536_test.cmi test/gpr_3536_test.cmj test/gpr_3546_test.cmi test/gpr_3546_test.cmj test/gpr_3548_test.cmi test/gpr_3548_test.cmj test/gpr_3549_test.cmi test/gpr_3549_test.cmj test/gpr_3566_drive_test.cmi test/gpr_3566_drive_test.cmj test/gpr_3566_test.cmi test/gpr_3566_test.cmj test/gpr_3595_test.cmi test/gpr_3595_test.cmj test/gpr_3609_test.cmi test/gpr_3609_test.cmj test/gpr_3697_test.cmi test/gpr_3697_test.cmj test/gpr_373_test.cmi test/gpr_373_test.cmj test/gpr_3770_test.cmi test/gpr_3770_test.cmj test/gpr_3852_alias.cmi test/gpr_3852_alias.cmj test/gpr_3852_alias_reify.cmi test/gpr_3852_alias_reify.cmj test/gpr_3852_effect.cmi test/gpr_3852_effect.cmj test/gpr_3865.cmi test/gpr_3865.cmj test/gpr_3865_bar.cmi test/gpr_3865_bar.cmj test/gpr_3865_foo.cmi test/gpr_3865_foo.cmj test/gpr_3875_test.cmi test/gpr_3875_test.cmj test/gpr_3877_test.cmi test/gpr_3877_test.cmj test/gpr_3895_test.cmi test/gpr_3895_test.cmj test/gpr_3897_test.cmi test/gpr_3897_test.cmj test/gpr_3931_test.cmi test/gpr_3931_test.cmj test/gpr_3980_test.cmi test/gpr_3980_test.cmj test/gpr_4025_test.cmi test/gpr_4025_test.cmj test/gpr_405_test.cmi test/gpr_405_test.cmj test/gpr_4069_test.cmi test/gpr_4069_test.cmj test/gpr_4265_test.cmi test/gpr_4265_test.cmj test/gpr_4274_test.cmi test/gpr_4274_test.cmj test/gpr_4280_test.cmi test/gpr_4280_test.cmj test/gpr_4407_test.cmi test/gpr_4407_test.cmj test/gpr_441.cmi test/gpr_441.cmj test/gpr_4442_test.cmi test/gpr_4442_test.cmj test/gpr_4491_test.cmi test/gpr_4491_test.cmj test/gpr_4494_test.cmi test/gpr_4494_test.cmj test/gpr_4519_test.cmi test/gpr_4519_test.cmj test/gpr_459_test.cmi test/gpr_459_test.cmj test/gpr_4632.cmi test/gpr_4632.cmj test/gpr_4639_test.cmi test/gpr_4639_test.cmj test/gpr_4900_test.cmi test/gpr_4900_test.cmj test/gpr_4924_test.cmi test/gpr_4924_test.cmj test/gpr_4931.cmi test/gpr_4931.cmj test/gpr_4931_allow.cmi test/gpr_4931_allow.cmj test/gpr_5071_test.cmi test/gpr_5071_test.cmj test/gpr_5169_test.cmi test/gpr_5169_test.cmj test/gpr_5218_test.cmi test/gpr_5218_test.cmj test/gpr_5280_optimize_test.cmi test/gpr_5280_optimize_test.cmj test/gpr_5312.cmi test/gpr_5312.cmj test/gpr_5557.cmi test/gpr_5557.cmj test/gpr_5753.cmi test/gpr_5753.cmj test/gpr_658.cmi test/gpr_658.cmj test/gpr_858_test.cmi test/gpr_858_test.cmj test/gpr_858_unit2_test.cmi test/gpr_858_unit2_test.cmj test/gpr_904_test.cmi test/gpr_904_test.cmj test/gpr_974_test.cmi test/gpr_974_test.cmj test/gpr_977_test.cmi test/gpr_977_test.cmj test/gpr_return_type_unused_attribute.cmi test/gpr_return_type_unused_attribute.cmj test/gray_code_test.cmi test/gray_code_test.cmj test/guide_for_ext.cmi test/guide_for_ext.cmj test/hamming_test.cmi test/hamming_test.cmj test/hash_collision_test.cmi test/hash_collision_test.cmj test/hash_sugar_desugar.cmi test/hash_sugar_desugar.cmj test/hash_test.cmi test/hash_test.cmj test/hashtbl_test.cmi test/hashtbl_test.cmj test/hello.foo.cmi test/hello.foo.cmj test/hello_res.cmi test/hello_res.cmj test/ignore_test.cmi test/ignore_test.cmj test/imm_map_bench.cmi test/imm_map_bench.cmj test/include_side_effect.cmi test/include_side_effect.cmj test/include_side_effect_free.cmi test/include_side_effect_free.cmj test/incomplete_toplevel_test.cmi test/incomplete_toplevel_test.cmj test/infer_type_test.cmi test/infer_type_test.cmj test/inline_const.cmi test/inline_const.cmj test/inline_const_test.cmi test/inline_const_test.cmj test/inline_edge_cases.cmi test/inline_edge_cases.cmj test/inline_map2_test.cmi test/inline_map2_test.cmj test/inline_map_demo.cmi test/inline_map_demo.cmj test/inline_map_test.cmi test/inline_map_test.cmj test/inline_record_test.cmi test/inline_record_test.cmj test/inline_regression_test.cmi test/inline_regression_test.cmj test/inline_string_test.cmi test/inline_string_test.cmj test/inner_call.cmi test/inner_call.cmj test/inner_define.cmi test/inner_define.cmj test/inner_unused.cmi test/inner_unused.cmj test/installation_test.cmi test/installation_test.cmj test/int32_test.cmi test/int32_test.cmj test/int64_mul_div_test.cmi test/int64_mul_div_test.cmj test/int64_string_bench.cmi test/int64_string_bench.cmj test/int64_string_test.cmi test/int64_string_test.cmj test/int64_test.cmi test/int64_test.cmj test/int_hashtbl_test.cmi test/int_hashtbl_test.cmj test/int_map.cmi test/int_map.cmj test/int_overflow_test.cmi test/int_overflow_test.cmj test/int_poly_var.cmi test/int_poly_var.cmj test/int_switch_test.cmi test/int_switch_test.cmj test/internal_unused_test.cmi test/internal_unused_test.cmj test/io_test.cmi test/io_test.cmj test/js_array_test.cmi test/js_array_test.cmj test/js_bool_test.cmi test/js_bool_test.cmj test/js_cast_test.cmi test/js_cast_test.cmj test/js_date_test.cmi test/js_date_test.cmj test/js_dict_test.cmi test/js_dict_test.cmj test/js_exception_catch_test.cmi test/js_exception_catch_test.cmj test/js_float_test.cmi test/js_float_test.cmj test/js_global_test.cmi test/js_global_test.cmj test/js_int_test.cmi test/js_int_test.cmj test/js_json_test.cmi test/js_json_test.cmj test/js_list_test.cmi test/js_list_test.cmj test/js_math_test.cmi test/js_math_test.cmj test/js_null_test.cmi test/js_null_test.cmj test/js_null_undefined_test.cmi test/js_null_undefined_test.cmj test/js_nullable_test.cmi test/js_nullable_test.cmj test/js_obj_test.cmi test/js_obj_test.cmj test/js_option_test.cmi test/js_option_test.cmj test/js_promise_basic_test.cmi test/js_promise_basic_test.cmj test/js_re_test.cmi test/js_re_test.cmj test/js_string_test.cmi test/js_string_test.cmj test/js_typed_array_test.cmi test/js_typed_array_test.cmj test/js_undefined_test.cmi test/js_undefined_test.cmj test/js_val.cmi test/js_val.cmj test/jsoo_400_test.cmi test/jsoo_400_test.cmj test/jsoo_485_test.cmi test/jsoo_485_test.cmj test/jsxv4_newtype.cmi test/jsxv4_newtype.cmj test/key_word_property.cmi test/key_word_property.cmj test/key_word_property2.cmi test/key_word_property2.cmj test/key_word_property_plus_test.cmi test/key_word_property_plus_test.cmj test/label_uncurry.cmi test/label_uncurry.cmj test/large_integer_pat.cmi test/large_integer_pat.cmj test/large_record_duplication_test.cmi test/large_record_duplication_test.cmj test/largest_int_flow.cmi test/largest_int_flow.cmj test/lazy_demo.cmi test/lazy_demo.cmj test/lazy_test.cmi test/lazy_test.cmj test/lib_js_test.cmi test/lib_js_test.cmj test/libarg_test.cmi test/libarg_test.cmj test/libqueue_test.cmi test/libqueue_test.cmj test/limits_test.cmi test/limits_test.cmj test/list_stack.cmi test/list_stack.cmj test/list_test.cmi test/list_test.cmj test/local_exception_test.cmi test/local_exception_test.cmj test/loop_regression_test.cmi test/loop_regression_test.cmj test/loop_suites_test.cmi test/loop_suites_test.cmj test/map_find_test.cmi test/map_find_test.cmj test/map_test.cmi test/map_test.cmj test/mario_game.cmi test/mario_game.cmj test/marshal.cmi test/marshal.cmj test/meth_annotation.cmi test/meth_annotation.cmj test/method_name_test.cmi test/method_name_test.cmj test/method_string_name.cmi test/method_string_name.cmj test/minimal_test.cmi test/minimal_test.cmj test/miss_colon_test.cmi test/miss_colon_test.cmj test/mock_mt.cmi test/mock_mt.cmj test/module_alias_test.cmi test/module_alias_test.cmj test/module_as_class_ffi.cmi test/module_as_class_ffi.cmj test/module_as_function.cmi test/module_as_function.cmj test/module_missing_conversion.cmi test/module_missing_conversion.cmj test/module_parameter_test.cmi test/module_parameter_test.cmj test/module_splice_test.cmi test/module_splice_test.cmj test/more_poly_variant_test.cmi test/more_poly_variant_test.cmj test/more_uncurry.cmi test/more_uncurry.cmj test/mpr_6033_test.cmi test/mpr_6033_test.cmj test/mt.cmi test/mt.cmj test/mt_global.cmi test/mt_global.cmj test/mutable_obj_test.cmi test/mutable_obj_test.cmj test/mutable_uncurry_test.cmi test/mutable_uncurry_test.cmj test/mutual_non_recursive_type.cmi test/mutual_non_recursive_type.cmj test/name_mangle_test.cmi test/name_mangle_test.cmj test/nested_include.cmi test/nested_include.cmj test/nested_module_alias.cmi test/nested_module_alias.cmj test/nested_obj_literal.cmi test/nested_obj_literal.cmj test/nested_obj_test.cmi test/nested_obj_test.cmj test/nested_pattern_match_test.cmi test/nested_pattern_match_test.cmj test/noassert.cmi test/noassert.cmj test/node_fs_test.cmi test/node_fs_test.cmj test/node_path_test.cmi test/node_path_test.cmj test/null_list_test.cmi test/null_list_test.cmj test/number_lexer.cmi test/number_lexer.cmj test/obj_literal_ppx.cmi test/obj_literal_ppx.cmj test/obj_literal_ppx_test.cmi test/obj_literal_ppx_test.cmj test/obj_magic_test.cmi test/obj_magic_test.cmj test/obj_type_test.cmi test/obj_type_test.cmj test/ocaml_re_test.cmi test/ocaml_re_test.cmj test/of_string_test.cmi test/of_string_test.cmj test/offset.cmi test/offset.cmj test/option_encoding_test.cmi test/option_encoding_test.cmj test/option_record_none_test.cmi test/option_record_none_test.cmj test/option_repr_test.cmi test/option_repr_test.cmj test/optional_ffi_test.cmi test/optional_ffi_test.cmj test/optional_regression_test.cmi test/optional_regression_test.cmj test/pipe_send_readline.cmi test/pipe_send_readline.cmj test/pipe_syntax.cmi test/pipe_syntax.cmj test/poly_empty_array.cmi test/poly_empty_array.cmj test/poly_variant_test.cmi test/poly_variant_test.cmj test/polymorphic_raw_test.cmi test/polymorphic_raw_test.cmj test/polymorphism_test.cmi test/polymorphism_test.cmj test/polyvar_convert.cmi test/polyvar_convert.cmj test/polyvar_test.cmi test/polyvar_test.cmj test/ppx_apply_test.cmi test/ppx_apply_test.cmj test/pq_test.cmi test/pq_test.cmj test/pr6726.cmi test/pr6726.cmj test/pr_regression_test.cmi test/pr_regression_test.cmj test/prepend_data_ffi.cmi test/prepend_data_ffi.cmj test/primitive_reg_test.cmi test/primitive_reg_test.cmj test/print_alpha_test.cmi test/print_alpha_test.cmj test/promise_catch_test.cmi test/promise_catch_test.cmj test/queue_402.cmi test/queue_402.cmj test/queue_test.cmi test/queue_test.cmj test/random_test.cmi test/random_test.cmj test/raw_hash_tbl_bench.cmi test/raw_hash_tbl_bench.cmj test/raw_output_test.cmi test/raw_output_test.cmj test/raw_pure_test.cmi test/raw_pure_test.cmj test/rbset.cmi test/rbset.cmj test/react.cmi test/react.cmj test/reactDOMRe.cmi test/reactDOMRe.cmj test/reactDOMServerRe.cmi test/reactDOMServerRe.cmj test/reactEvent.cmi test/reactEvent.cmj test/reactTestUtils.cmi test/reactTestUtils.cmj test/reasonReact.cmi test/reasonReact.cmj test/reasonReactCompat.cmi test/reasonReactCompat.cmj test/reasonReactOptimizedCreateClass.cmi test/reasonReactOptimizedCreateClass.cmj test/reasonReactRouter.cmi test/reasonReactRouter.cmj test/rebind_module.cmi test/rebind_module.cmj test/rebind_module_test.cmi test/rebind_module_test.cmj test/rec_array_test.cmi test/rec_array_test.cmj test/rec_fun_test.cmi test/rec_fun_test.cmj test/rec_module_opt.cmi test/rec_module_opt.cmj test/rec_module_test.cmi test/rec_module_test.cmj test/rec_value_test.cmi test/rec_value_test.cmj test/record_debug_test.cmi test/record_debug_test.cmj test/record_extension_test.cmi test/record_extension_test.cmj test/record_name_test.cmi test/record_name_test.cmj test/record_regression.cmi test/record_regression.cmj test/record_with_test.cmi test/record_with_test.cmj test/recursive_module.cmi test/recursive_module.cmj test/recursive_module_test.cmi test/recursive_module_test.cmj test/recursive_react_component.cmi test/recursive_react_component.cmj test/recursive_records_test.cmi test/recursive_records_test.cmj test/recursive_unbound_module_test.cmi test/recursive_unbound_module_test.cmj test/regression_print.cmi test/regression_print.cmj test/relative_path.cmi test/relative_path.cmj test/res_debug.cmi test/res_debug.cmj test/return_check.cmi test/return_check.cmj test/runtime_encoding_test.cmi test/runtime_encoding_test.cmj test/set_annotation.cmi test/set_annotation.cmj test/set_gen.cmi test/set_gen.cmj test/sexp.cmi test/sexp.cmj test/sexpm.cmi test/sexpm.cmj test/sexpm_test.cmi test/sexpm_test.cmj test/side_effect.cmi test/side_effect.cmj test/side_effect_free.cmi test/side_effect_free.cmj test/simple_derive_test.cmi test/simple_derive_test.cmj test/simple_derive_use.cmi test/simple_derive_use.cmj test/simple_lexer_test.cmi test/simple_lexer_test.cmj test/simplify_lambda_632o.cmi test/simplify_lambda_632o.cmj test/single_module_alias.cmi test/single_module_alias.cmj test/singular_unit_test.cmi test/singular_unit_test.cmj test/small_inline_test.cmi test/small_inline_test.cmj test/splice_test.cmi test/splice_test.cmj test/stack_comp_test.cmi test/stack_comp_test.cmj test/stack_test.cmi test/stack_test.cmj test/stream_parser_test.cmi test/stream_parser_test.cmj test/string_bound_get_test.cmi test/string_bound_get_test.cmj test/string_constant_compare.cmi test/string_constant_compare.cmj test/string_get_set_test.cmi test/string_get_set_test.cmj test/string_literal_print_test.cmi test/string_literal_print_test.cmj test/string_runtime_test.cmi test/string_runtime_test.cmj test/string_set.cmi test/string_set.cmj test/string_set_test.cmi test/string_set_test.cmj test/string_test.cmi test/string_test.cmj test/string_unicode_test.cmi test/string_unicode_test.cmj test/stringmatch_test.cmi test/stringmatch_test.cmj test/submodule.cmi test/submodule.cmj test/submodule_call.cmi test/submodule_call.cmj test/switch_case_test.cmi test/switch_case_test.cmj test/switch_string.cmi test/switch_string.cmj test/tailcall_inline_test.cmi test/tailcall_inline_test.cmj test/template.cmi test/template.cmj test/test.cmi test/test.cmj test/test2.cmi test/test2.cmj test/test_alias.cmi test/test_alias.cmj test/test_ari.cmi test/test_ari.cmj test/test_array.cmi test/test_array.cmj test/test_array_append.cmi test/test_array_append.cmj test/test_array_primitive.cmi test/test_array_primitive.cmj test/test_bool_equal.cmi test/test_bool_equal.cmj test/test_bs_this.cmi test/test_bs_this.cmj test/test_bug.cmi test/test_bug.cmj test/test_bytes.cmi test/test_bytes.cmj test/test_case_opt_collision.cmi test/test_case_opt_collision.cmj test/test_case_set.cmi test/test_case_set.cmj test/test_char.cmi test/test_char.cmj test/test_closure.cmi test/test_closure.cmj test/test_common.cmi test/test_common.cmj test/test_const_elim.cmi test/test_const_elim.cmj test/test_const_propogate.cmi test/test_const_propogate.cmj test/test_cpp.cmi test/test_cpp.cmj test/test_cps.cmi test/test_cps.cmj test/test_demo.cmi test/test_demo.cmj test/test_dup_param.cmi test/test_dup_param.cmj test/test_eq.cmi test/test_eq.cmj test/test_exception.cmi test/test_exception.cmj test/test_exception_escape.cmi test/test_exception_escape.cmj test/test_export2.cmi test/test_export2.cmj test/test_external.cmi test/test_external.cmj test/test_external_unit.cmi test/test_external_unit.cmj test/test_ffi.cmi test/test_ffi.cmj test/test_fib.cmi test/test_fib.cmj test/test_filename.cmi test/test_filename.cmj test/test_for_loop.cmi test/test_for_loop.cmj test/test_for_map.cmi test/test_for_map.cmj test/test_for_map2.cmi test/test_for_map2.cmj test/test_format.cmi test/test_format.cmj test/test_formatter.cmi test/test_formatter.cmj test/test_functor_dead_code.cmi test/test_functor_dead_code.cmj test/test_generative_module.cmi test/test_generative_module.cmj test/test_global_print.cmi test/test_global_print.cmj test/test_google_closure.cmi test/test_google_closure.cmj test/test_include.cmi test/test_include.cmj test/test_incomplete.cmi test/test_incomplete.cmj test/test_incr_ref.cmi test/test_incr_ref.cmj test/test_int_map_find.cmi test/test_int_map_find.cmj test/test_internalOO.cmi test/test_internalOO.cmj test/test_is_js.cmi test/test_is_js.cmj test/test_js_ffi.cmi test/test_js_ffi.cmj test/test_let.cmi test/test_let.cmj test/test_list.cmi test/test_list.cmj test/test_literal.cmi test/test_literal.cmj test/test_literals.cmi test/test_literals.cmj test/test_match_exception.cmi test/test_match_exception.cmj test/test_mutliple.cmi test/test_mutliple.cmj test/test_nat64.cmi test/test_nat64.cmj test/test_nested_let.cmi test/test_nested_let.cmj test/test_nested_print.cmi test/test_nested_print.cmj test/test_non_export.cmi test/test_non_export.cmj test/test_nullary.cmi test/test_nullary.cmj test/test_obj.cmi test/test_obj.cmj test/test_obj_simple_ffi.cmi test/test_obj_simple_ffi.cmj test/test_order.cmi test/test_order.cmj test/test_order_tailcall.cmi test/test_order_tailcall.cmj test/test_other_exn.cmi test/test_other_exn.cmj test/test_pack.cmi test/test_pack.cmj test/test_per.cmi test/test_per.cmj test/test_pervasive.cmi test/test_pervasive.cmj test/test_pervasives2.cmi test/test_pervasives2.cmj test/test_pervasives3.cmi test/test_pervasives3.cmj test/test_primitive.cmi test/test_primitive.cmj test/test_ramification.cmi test/test_ramification.cmj test/test_react.cmi test/test_react.cmj test/test_react_case.cmi test/test_react_case.cmj test/test_regex.cmi test/test_regex.cmj test/test_require.cmi test/test_require.cmj test/test_runtime_encoding.cmi test/test_runtime_encoding.cmj test/test_scope.cmi test/test_scope.cmj test/test_seq.cmi test/test_seq.cmj test/test_set.cmi test/test_set.cmj test/test_side_effect_functor.cmi test/test_side_effect_functor.cmj test/test_simple_include.cmi test/test_simple_include.cmj test/test_simple_pattern_match.cmi test/test_simple_pattern_match.cmj test/test_simple_ref.cmi test/test_simple_ref.cmj test/test_simple_tailcall.cmi test/test_simple_tailcall.cmj test/test_small.cmi test/test_small.cmj test/test_sprintf.cmi test/test_sprintf.cmj test/test_stack.cmi test/test_stack.cmj test/test_static_catch_ident.cmi test/test_static_catch_ident.cmj test/test_string.cmi test/test_string.cmj test/test_string_case.cmi test/test_string_case.cmj test/test_string_const.cmi test/test_string_const.cmj test/test_string_map.cmi test/test_string_map.cmj test/test_string_switch.cmi test/test_string_switch.cmj test/test_switch.cmi test/test_switch.cmj test/test_trywith.cmi test/test_trywith.cmj test/test_tuple.cmi test/test_tuple.cmj test/test_tuple_destructring.cmi test/test_tuple_destructring.cmj test/test_type_based_arity.cmi test/test_type_based_arity.cmj test/test_u.cmi test/test_u.cmj test/test_unknown.cmi test/test_unknown.cmj test/test_unsafe_cmp.cmi test/test_unsafe_cmp.cmj test/test_unsafe_obj_ffi.cmi test/test_unsafe_obj_ffi.cmj test/test_unsafe_obj_ffi_ppx.cmi test/test_unsafe_obj_ffi_ppx.cmj test/test_unsupported_primitive.cmi test/test_unsupported_primitive.cmj test/test_while_closure.cmi test/test_while_closure.cmj test/test_while_side_effect.cmi test/test_while_side_effect.cmj test/test_zero_nullable.cmi test/test_zero_nullable.cmj test/then_mangle_test.cmi test/then_mangle_test.cmj test/ticker.cmi test/ticker.cmj test/to_string_test.cmi test/to_string_test.cmj test/topsort_test.cmi test/topsort_test.cmj test/tramp_fib.cmi test/tramp_fib.cmj test/tuple_alloc.cmi test/tuple_alloc.cmj test/type_disambiguate.cmi test/type_disambiguate.cmj test/typeof_test.cmi test/typeof_test.cmj test/ui_defs.cmi test/unboxed_attribute.cmi test/unboxed_attribute.cmj test/unboxed_attribute_test.cmi test/unboxed_attribute_test.cmj test/unboxed_crash.cmi test/unboxed_crash.cmj test/unboxed_use_case.cmi test/unboxed_use_case.cmj test/uncurried_cast.cmi test/uncurried_cast.cmj test/uncurried_default.args.cmi test/uncurried_default.args.cmj test/uncurried_pipe.cmi test/uncurried_pipe.cmj test/uncurry_external_test.cmi test/uncurry_external_test.cmj test/uncurry_glob_test.cmi test/uncurry_glob_test.cmj test/uncurry_test.cmi test/uncurry_test.cmj test/undef_regression2_test.cmi test/undef_regression2_test.cmj test/undef_regression_test.cmi test/undef_regression_test.cmj test/undefine_conditional.cmi test/undefine_conditional.cmj test/unicode_type_error.cmi test/unicode_type_error.cmj test/unit_undefined_test.cmi test/unit_undefined_test.cmj test/unitest_string.cmi test/unitest_string.cmj test/unsafe_full_apply_primitive.cmi test/unsafe_full_apply_primitive.cmj test/unsafe_ppx_test.cmi test/unsafe_ppx_test.cmj test/unsafe_this.cmi test/unsafe_this.cmj test/update_record_test.cmi test/update_record_test.cmj test/utf8_decode_test.cmi test/utf8_decode_test.cmj test/variant.cmi test/variant.cmj test/variantsMatching.cmi test/variantsMatching.cmj test/watch_test.cmi test/watch_test.cmj test/webpack_config.cmi test/webpack_config.cmj diff --git a/jscomp/test/caml_compare_bigint_test.js b/jscomp/test/caml_compare_bigint_test.js new file mode 100644 index 0000000000..06bdf8c424 --- /dev/null +++ b/jscomp/test/caml_compare_bigint_test.js @@ -0,0 +1,337 @@ +'use strict'; + +var Mt = require("./mt.js"); +var Caml_obj = require("../../lib/js/caml_obj.js"); +var Pervasives = require("../../lib/js/pervasives.js"); + +function isLessThan(title, small, big) { + return { + hd: [ + "compare: " + title, + (function (param) { + return { + TAG: "Eq", + _0: true, + _1: Caml_obj.compare(big, small) > 0 + }; + }) + ], + tl: { + hd: [ + "compare: " + title, + (function (param) { + return { + TAG: "Eq", + _0: true, + _1: Caml_obj.compare(small, big) < 0 + }; + }) + ], + tl: { + hd: [ + "< operator: " + title, + (function (param) { + return { + TAG: "Eq", + _0: true, + _1: Caml_obj.lessthan(small, big) + }; + }) + ], + tl: { + hd: [ + "<= operator: " + title, + (function (param) { + return { + TAG: "Eq", + _0: true, + _1: Caml_obj.lessequal(small, big) + }; + }) + ], + tl: { + hd: [ + "> operator: " + title, + (function (param) { + return { + TAG: "Eq", + _0: true, + _1: Caml_obj.greaterthan(big, small) + }; + }) + ], + tl: { + hd: [ + ">= operator: " + title, + (function (param) { + return { + TAG: "Eq", + _0: true, + _1: Caml_obj.greaterequal(big, small) + }; + }) + ], + tl: { + hd: [ + "min: " + title, + (function (param) { + return { + TAG: "Eq", + _0: small, + _1: Caml_obj.min(big, small) + }; + }) + ], + tl: { + hd: [ + "min: " + title, + (function (param) { + return { + TAG: "Eq", + _0: small, + _1: Caml_obj.min(small, big) + }; + }) + ], + tl: { + hd: [ + "max: " + title, + (function (param) { + return { + TAG: "Eq", + _0: big, + _1: Caml_obj.max(big, small) + }; + }) + ], + tl: { + hd: [ + "max: " + title, + (function (param) { + return { + TAG: "Eq", + _0: big, + _1: Caml_obj.max(small, big) + }; + }) + ], + tl: { + hd: [ + "!= operator: " + title, + (function (param) { + return { + TAG: "Eq", + _0: true, + _1: big !== small + }; + }) + ], + tl: { + hd: [ + "!= operator: " + title, + (function (param) { + return { + TAG: "Eq", + _0: true, + _1: small !== big + }; + }) + ], + tl: { + hd: [ + "== operator: " + title, + (function (param) { + return { + TAG: "Eq", + _0: false, + _1: big === small + }; + }) + ], + tl: { + hd: [ + "== operator: " + title, + (function (param) { + return { + TAG: "Eq", + _0: false, + _1: small === big + }; + }) + ], + tl: /* [] */0 + } + } + } + } + } + } + } + } + } + } + } + } + } + }; +} + +function isEqual(title, num1, num2) { + return { + hd: [ + "< operator: " + title, + (function (param) { + return { + TAG: "Eq", + _0: false, + _1: Caml_obj.lessthan(num2, num1) + }; + }) + ], + tl: { + hd: [ + "<= operator: " + title, + (function (param) { + return { + TAG: "Eq", + _0: true, + _1: Caml_obj.lessequal(num2, num1) + }; + }) + ], + tl: { + hd: [ + "> operator: " + title, + (function (param) { + return { + TAG: "Eq", + _0: false, + _1: Caml_obj.greaterthan(num1, num2) + }; + }) + ], + tl: { + hd: [ + ">= operator: " + title, + (function (param) { + return { + TAG: "Eq", + _0: true, + _1: Caml_obj.greaterequal(num1, num2) + }; + }) + ], + tl: { + hd: [ + "min: " + title, + (function (param) { + return { + TAG: "Eq", + _0: num1, + _1: Caml_obj.min(num1, num2) + }; + }) + ], + tl: { + hd: [ + "max: " + title, + (function (param) { + return { + TAG: "Eq", + _0: num1, + _1: Caml_obj.max(num1, num2) + }; + }) + ], + tl: { + hd: [ + "compare: " + title, + (function (param) { + return { + TAG: "Eq", + _0: 0, + _1: Caml_obj.compare(num1, num2) + }; + }) + ], + tl: { + hd: [ + "compare: " + title, + (function (param) { + return { + TAG: "Eq", + _0: 0, + _1: Caml_obj.compare(num2, num1) + }; + }) + ], + tl: { + hd: [ + "!= operator: " + title, + (function (param) { + return { + TAG: "Eq", + _0: false, + _1: num1 !== num2 + }; + }) + ], + tl: { + hd: [ + "!= operator: " + title, + (function (param) { + return { + TAG: "Eq", + _0: false, + _1: num2 !== num1 + }; + }) + ], + tl: { + hd: [ + "== operator: " + title, + (function (param) { + return { + TAG: "Eq", + _0: true, + _1: num1 === num2 + }; + }) + ], + tl: { + hd: [ + "== operator: " + title, + (function (param) { + return { + TAG: "Eq", + _0: true, + _1: num2 === num1 + }; + }) + ], + tl: /* [] */0 + } + } + } + } + } + } + } + } + } + } + } + }; +} + +var five = BigInt("5"); + +var suites = Pervasives.$at(isLessThan("123 and 555555", BigInt("123"), BigInt("555555")), Pervasives.$at(isEqual("98765 and 98765", BigInt("98765"), BigInt("98765")), isEqual("same instance", five, five))); + +Mt.from_pair_suites("caml_compare_bigint_test.ml", suites); + +exports.isLessThan = isLessThan; +exports.isEqual = isEqual; +exports.five = five; +exports.suites = suites; +/* five Not a pure module */ diff --git a/jscomp/test/caml_compare_bigint_test.ml b/jscomp/test/caml_compare_bigint_test.ml index 94025b4174..b519335e79 100644 --- a/jscomp/test/caml_compare_bigint_test.ml +++ b/jscomp/test/caml_compare_bigint_test.ml @@ -1,21 +1,21 @@ -external big : string -> float = "BigInt" [@@bs.val] +external bigint : string -> float = "BigInt" [@@bs.val] -let isLessThan title smaller bigger = +let isLessThan title small big = [ - ("compare: " ^ title, fun _ -> Mt.Eq (true, compare bigger smaller > 0)); - ("compare: " ^ title, fun _ -> Mt.Eq (true, compare smaller bigger < 0)); - ("< operator: " ^ title, fun _ -> Mt.Eq (true, smaller < bigger)); - ("<= operator: " ^ title, fun _ -> Mt.Eq (true, smaller <= bigger)); - ("> operator: " ^ title, fun _ -> Mt.Eq (true, bigger > smaller)); - (">= operator: " ^ title, fun _ -> Mt.Eq (true, bigger >= smaller)); - ("min: " ^ title, fun _ -> Mt.Eq (smaller, min bigger smaller)); - ("min: " ^ title, fun _ -> Mt.Eq (smaller, min smaller bigger)); - ("max: " ^ title, fun _ -> Mt.Eq (bigger, max bigger smaller)); - ("max: " ^ title, fun _ -> Mt.Eq (bigger, max smaller bigger)); - ("!= operator: " ^ title, fun _ -> Mt.Eq (true, bigger != smaller)); - ("!= operator: " ^ title, fun _ -> Mt.Eq (true, smaller != bigger)); - ("== operator: " ^ title, fun _ -> Mt.Eq (false, bigger == smaller)); - ("== operator: " ^ title, fun _ -> Mt.Eq (false, smaller == bigger)); + ("compare: " ^ title, fun _ -> Mt.Eq (true, compare big small > 0)); + ("compare: " ^ title, fun _ -> Mt.Eq (true, compare small big < 0)); + ("< operator: " ^ title, fun _ -> Mt.Eq (true, small < big)); + ("<= operator: " ^ title, fun _ -> Mt.Eq (true, small <= big)); + ("> operator: " ^ title, fun _ -> Mt.Eq (true, big > small)); + (">= operator: " ^ title, fun _ -> Mt.Eq (true, big >= small)); + ("min: " ^ title, fun _ -> Mt.Eq (small, min big small)); + ("min: " ^ title, fun _ -> Mt.Eq (small, min small big)); + ("max: " ^ title, fun _ -> Mt.Eq (big, max big small)); + ("max: " ^ title, fun _ -> Mt.Eq (big, max small big)); + ("!= operator: " ^ title, fun _ -> Mt.Eq (true, big != small)); + ("!= operator: " ^ title, fun _ -> Mt.Eq (true, small != big)); + ("== operator: " ^ title, fun _ -> Mt.Eq (false, big == small)); + ("== operator: " ^ title, fun _ -> Mt.Eq (false, small == big)); ] let isEqual title num1 num2 = @@ -34,12 +34,12 @@ let isEqual title num1 num2 = ("== operator: " ^ title, fun _ -> Mt.Eq (true, num2 == num1)); ] -let fiveBigInt = big "5" +let five = bigint "5" (** Not comparing floats and Bigint; not sure this is correct since works in JavaScript*) let suites : Mt.pair_suites = - isLessThan "123 and 555555" (big "123") (big "555555") - @ isEqual "98765 and 98765" (big "98765") (big "98765") - @ isEqual "same instance" fiveBigInt fiveBigInt + isLessThan "123 and 555555" (bigint "123") (bigint "555555") + @ isEqual "98765 and 98765" (bigint "98765") (bigint "98765") + @ isEqual "same instance" five five let () = Mt.from_pair_suites __FILE__ suites diff --git a/lib/es6/caml_obj.js b/lib/es6/caml_obj.js index dc22ba2c90..bcb7245606 100644 --- a/lib/es6/caml_obj.js +++ b/lib/es6/caml_obj.js @@ -42,6 +42,7 @@ function compare(a, b) { } var a_type = typeof a; var b_type = typeof b; + var exit = 0; switch (a_type) { case "boolean" : if (b_type === "boolean") { @@ -57,10 +58,9 @@ function compare(a, b) { }; } break; + case "bigint" : case "number" : - if (b_type === "number") { - return Caml.float_compare(a, b); - } + exit = 2; break; case "string" : if (b_type === "string") { @@ -73,6 +73,15 @@ function compare(a, b) { default: } + if (exit === 2) { + switch (b_type) { + case "bigint" : + case "number" : + return Caml.float_compare(a, b); + default: + + } + } switch (b_type) { case "string" : return -1; @@ -258,7 +267,7 @@ function equal(a, b) { return true; } var a_type = typeof a; - if (a_type === "string" || a_type === "number" || a_type === "boolean" || a_type === "undefined" || a === null) { + if (a_type === "string" || a_type === "number" || a_type === "bigint" || a_type === "boolean" || a_type === "undefined" || a === null) { return false; } var b_type = typeof b; @@ -269,7 +278,7 @@ function equal(a, b) { Error: new Error() }; } - if (b_type === "number" || b_type === "undefined" || b === null) { + if (b_type === "number" || b_type === "bigint" || b_type === "undefined" || b === null) { return false; } var tag_a = a.TAG; @@ -358,8 +367,24 @@ function equal_nullable(x, y) { } } +function isNumberOrBigInt(a) { + if (typeof a === "number") { + return true; + } else { + return typeof a === "bigint"; + } +} + +function canNumericCompare(a, b) { + if (isNumberOrBigInt(a)) { + return isNumberOrBigInt(b); + } else { + return false; + } +} + function notequal(a, b) { - if (typeof a === "number" && typeof b === "number") { + if (canNumericCompare(a, b)) { return a !== b; } else { return !equal(a, b); @@ -367,7 +392,7 @@ function notequal(a, b) { } function greaterequal(a, b) { - if (typeof a === "number" && typeof b === "number") { + if (canNumericCompare(a, b)) { return a >= b; } else { return compare(a, b) >= 0; @@ -375,7 +400,7 @@ function greaterequal(a, b) { } function greaterthan(a, b) { - if (typeof a === "number" && typeof b === "number") { + if (canNumericCompare(a, b)) { return a > b; } else { return compare(a, b) > 0; @@ -383,7 +408,7 @@ function greaterthan(a, b) { } function lessequal(a, b) { - if (typeof a === "number" && typeof b === "number") { + if (canNumericCompare(a, b)) { return a <= b; } else { return compare(a, b) <= 0; @@ -391,7 +416,7 @@ function lessequal(a, b) { } function lessthan(a, b) { - if (typeof a === "number" && typeof b === "number") { + if (canNumericCompare(a, b)) { return a < b; } else { return compare(a, b) < 0; diff --git a/lib/js/caml_obj.js b/lib/js/caml_obj.js index 88248fc615..5c00357612 100644 --- a/lib/js/caml_obj.js +++ b/lib/js/caml_obj.js @@ -42,6 +42,7 @@ function compare(a, b) { } var a_type = typeof a; var b_type = typeof b; + var exit = 0; switch (a_type) { case "boolean" : if (b_type === "boolean") { @@ -57,10 +58,9 @@ function compare(a, b) { }; } break; + case "bigint" : case "number" : - if (b_type === "number") { - return Caml.float_compare(a, b); - } + exit = 2; break; case "string" : if (b_type === "string") { @@ -73,6 +73,15 @@ function compare(a, b) { default: } + if (exit === 2) { + switch (b_type) { + case "bigint" : + case "number" : + return Caml.float_compare(a, b); + default: + + } + } switch (b_type) { case "string" : return -1; @@ -258,7 +267,7 @@ function equal(a, b) { return true; } var a_type = typeof a; - if (a_type === "string" || a_type === "number" || a_type === "boolean" || a_type === "undefined" || a === null) { + if (a_type === "string" || a_type === "number" || a_type === "bigint" || a_type === "boolean" || a_type === "undefined" || a === null) { return false; } var b_type = typeof b; @@ -269,7 +278,7 @@ function equal(a, b) { Error: new Error() }; } - if (b_type === "number" || b_type === "undefined" || b === null) { + if (b_type === "number" || b_type === "bigint" || b_type === "undefined" || b === null) { return false; } var tag_a = a.TAG; @@ -358,8 +367,24 @@ function equal_nullable(x, y) { } } +function isNumberOrBigInt(a) { + if (typeof a === "number") { + return true; + } else { + return typeof a === "bigint"; + } +} + +function canNumericCompare(a, b) { + if (isNumberOrBigInt(a)) { + return isNumberOrBigInt(b); + } else { + return false; + } +} + function notequal(a, b) { - if (typeof a === "number" && typeof b === "number") { + if (canNumericCompare(a, b)) { return a !== b; } else { return !equal(a, b); @@ -367,7 +392,7 @@ function notequal(a, b) { } function greaterequal(a, b) { - if (typeof a === "number" && typeof b === "number") { + if (canNumericCompare(a, b)) { return a >= b; } else { return compare(a, b) >= 0; @@ -375,7 +400,7 @@ function greaterequal(a, b) { } function greaterthan(a, b) { - if (typeof a === "number" && typeof b === "number") { + if (canNumericCompare(a, b)) { return a > b; } else { return compare(a, b) > 0; @@ -383,7 +408,7 @@ function greaterthan(a, b) { } function lessequal(a, b) { - if (typeof a === "number" && typeof b === "number") { + if (canNumericCompare(a, b)) { return a <= b; } else { return compare(a, b) <= 0; @@ -391,7 +416,7 @@ function lessequal(a, b) { } function lessthan(a, b) { - if (typeof a === "number" && typeof b === "number") { + if (canNumericCompare(a, b)) { return a < b; } else { return compare(a, b) < 0; From 3b54efcb4b7f03dcdca59f725e6d5a7058fce0d9 Mon Sep 17 00:00:00 2001 From: jmagaram Date: Sat, 25 Mar 2023 20:43:19 -0700 Subject: [PATCH 06/16] add compare bigint to null ?? --- jscomp/runtime/caml_obj.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jscomp/runtime/caml_obj.ml b/jscomp/runtime/caml_obj.ml index 183036a631..b9e05b9db4 100644 --- a/jscomp/runtime/caml_obj.ml +++ b/jscomp/runtime/caml_obj.ml @@ -164,11 +164,11 @@ let rec compare (a : Obj.t) (b : Obj.t) : int = | "number", "bigint" | "bigint", "number" -> Pervasives.compare (Obj.magic a : float) (Obj.magic b : float) - | "number", _ -> + | "bigint", _ | "number", _ -> if b == Obj.repr Js.null || Caml_option.isNested b then 1 (* Some (Some ..) < x *) else -1 (* Integer < Block in OCaml runtime GPR #1195, except Some.. *) - | _, "number" -> + | _, "number" | _, "bigint" -> if a == Obj.repr Js.null || Caml_option.isNested a then -1 else 1 | _ -> if a == Obj.repr Js.null then From 3fc523b868ea65de8fe131636ae6ca9fecfe0ff4 Mon Sep 17 00:00:00 2001 From: jmagaram Date: Sat, 25 Mar 2023 21:33:13 -0700 Subject: [PATCH 07/16] ugh didn't realize about <> and = operators --- jscomp/test/caml_compare_bigint_test.js | 124 +++++++++++++++++++++--- jscomp/test/caml_compare_bigint_test.ml | 9 +- 2 files changed, 118 insertions(+), 15 deletions(-) diff --git a/jscomp/test/caml_compare_bigint_test.js b/jscomp/test/caml_compare_bigint_test.js index 06bdf8c424..bbb9b3e4f6 100644 --- a/jscomp/test/caml_compare_bigint_test.js +++ b/jscomp/test/caml_compare_bigint_test.js @@ -139,27 +139,75 @@ function isLessThan(title, small, big) { ], tl: { hd: [ - "== operator: " + title, + "<> operator: " + title, (function (param) { return { TAG: "Eq", - _0: false, - _1: big === small + _0: true, + _1: Caml_obj.notequal(big, small) }; }) ], tl: { hd: [ - "== operator: " + title, + "<> operator: " + title, (function (param) { return { TAG: "Eq", - _0: false, - _1: small === big + _0: true, + _1: Caml_obj.notequal(small, big) }; }) ], - tl: /* [] */0 + tl: { + hd: [ + "= operator: " + title, + (function (param) { + return { + TAG: "Eq", + _0: false, + _1: Caml_obj.equal(big, small) + }; + }) + ], + tl: { + hd: [ + "= operator: " + title, + (function (param) { + return { + TAG: "Eq", + _0: false, + _1: Caml_obj.equal(small, big) + }; + }) + ], + tl: { + hd: [ + "== operator: " + title, + (function (param) { + return { + TAG: "Eq", + _0: false, + _1: big === small + }; + }) + ], + tl: { + hd: [ + "== operator: " + title, + (function (param) { + return { + TAG: "Eq", + _0: false, + _1: small === big + }; + }) + ], + tl: /* [] */0 + } + } + } + } } } } @@ -289,27 +337,75 @@ function isEqual(title, num1, num2) { ], tl: { hd: [ - "== operator: " + title, + "<> operator: " + title, (function (param) { return { TAG: "Eq", - _0: true, - _1: num1 === num2 + _0: false, + _1: Caml_obj.notequal(num1, num2) }; }) ], tl: { hd: [ - "== operator: " + title, + "<> operator: " + title, (function (param) { return { TAG: "Eq", - _0: true, - _1: num2 === num1 + _0: false, + _1: Caml_obj.notequal(num2, num1) }; }) ], - tl: /* [] */0 + tl: { + hd: [ + "= operator: " + title, + (function (param) { + return { + TAG: "Eq", + _0: true, + _1: Caml_obj.equal(num1, num2) + }; + }) + ], + tl: { + hd: [ + "= operator: " + title, + (function (param) { + return { + TAG: "Eq", + _0: true, + _1: Caml_obj.equal(num2, num1) + }; + }) + ], + tl: { + hd: [ + "== operator: " + title, + (function (param) { + return { + TAG: "Eq", + _0: true, + _1: num1 === num2 + }; + }) + ], + tl: { + hd: [ + "== operator: " + title, + (function (param) { + return { + TAG: "Eq", + _0: true, + _1: num2 === num1 + }; + }) + ], + tl: /* [] */0 + } + } + } + } } } } diff --git a/jscomp/test/caml_compare_bigint_test.ml b/jscomp/test/caml_compare_bigint_test.ml index b519335e79..6028a2c818 100644 --- a/jscomp/test/caml_compare_bigint_test.ml +++ b/jscomp/test/caml_compare_bigint_test.ml @@ -1,5 +1,4 @@ external bigint : string -> float = "BigInt" [@@bs.val] - let isLessThan title small big = [ ("compare: " ^ title, fun _ -> Mt.Eq (true, compare big small > 0)); @@ -14,6 +13,10 @@ let isLessThan title small big = ("max: " ^ title, fun _ -> Mt.Eq (big, max small big)); ("!= operator: " ^ title, fun _ -> Mt.Eq (true, big != small)); ("!= operator: " ^ title, fun _ -> Mt.Eq (true, small != big)); + ("<> operator: " ^ title, fun _ -> Mt.Eq (true, big <> small)); + ("<> operator: " ^ title, fun _ -> Mt.Eq (true, small <> big)); + ("= operator: " ^ title, fun _ -> Mt.Eq (false, big = small)); + ("= operator: " ^ title, fun _ -> Mt.Eq (false, small = big)); ("== operator: " ^ title, fun _ -> Mt.Eq (false, big == small)); ("== operator: " ^ title, fun _ -> Mt.Eq (false, small == big)); ] @@ -30,6 +33,10 @@ let isEqual title num1 num2 = ("compare: " ^ title, fun _ -> Mt.Eq (0, compare num2 num1)); ("!= operator: " ^ title, fun _ -> Mt.Eq (false, num1 != num2)); ("!= operator: " ^ title, fun _ -> Mt.Eq (false, num2 != num1)); + ("<> operator: " ^ title, fun _ -> Mt.Eq (false, num1 <> num2)); + ("<> operator: " ^ title, fun _ -> Mt.Eq (false, num2 <> num1)); + ("= operator: " ^ title, fun _ -> Mt.Eq (true, num1 = num2)); + ("= operator: " ^ title, fun _ -> Mt.Eq (true, num2 = num1)); ("== operator: " ^ title, fun _ -> Mt.Eq (true, num1 == num2)); ("== operator: " ^ title, fun _ -> Mt.Eq (true, num2 == num1)); ] From 64f42bf25c31f564817c27ea04b9690122c0bc7c Mon Sep 17 00:00:00 2001 From: jmagaram Date: Sat, 25 Mar 2023 22:09:42 -0700 Subject: [PATCH 08/16] only compare similar types --- jscomp/runtime/caml_obj.ml | 9 +- lib/es6/caml_obj.js | 255 ++++++++++++++++++++----------------- lib/js/caml_obj.js | 255 ++++++++++++++++++++----------------- 3 files changed, 278 insertions(+), 241 deletions(-) diff --git a/jscomp/runtime/caml_obj.ml b/jscomp/runtime/caml_obj.ml index b9e05b9db4..ff8ac6751d 100644 --- a/jscomp/runtime/caml_obj.ml +++ b/jscomp/runtime/caml_obj.ml @@ -159,16 +159,15 @@ let rec compare (a : Obj.t) (b : Obj.t) : int = raise (Invalid_argument "compare: functional value") | "function", _ -> 1 | _, "function" -> -1 - | "bigint", "bigint" - | "number", "number" - | "number", "bigint" - | "bigint", "number" -> + | "bigint", "bigint" -> + Pervasives.compare (Obj.magic a : float) (Obj.magic b : float) + | "number", "number" -> Pervasives.compare (Obj.magic a : float) (Obj.magic b : float) | "bigint", _ | "number", _ -> if b == Obj.repr Js.null || Caml_option.isNested b then 1 (* Some (Some ..) < x *) else -1 (* Integer < Block in OCaml runtime GPR #1195, except Some.. *) - | _, "number" | _, "bigint" -> + | _, "bigint" | _, "number" -> if a == Obj.repr Js.null || Caml_option.isNested a then -1 else 1 | _ -> if a == Obj.repr Js.null then diff --git a/lib/es6/caml_obj.js b/lib/es6/caml_obj.js index bcb7245606..c6c0d97911 100644 --- a/lib/es6/caml_obj.js +++ b/lib/es6/caml_obj.js @@ -43,11 +43,19 @@ function compare(a, b) { var a_type = typeof a; var b_type = typeof b; var exit = 0; + var exit$1 = 0; switch (a_type) { + case "bigint" : + if (b_type === "bigint") { + return Caml.float_compare(a, b); + } + exit$1 = 3; + break; case "boolean" : if (b_type === "boolean") { return Caml.bool_compare(a, b); } + exit$1 = 3; break; case "function" : if (b_type === "function") { @@ -57,10 +65,13 @@ function compare(a, b) { Error: new Error() }; } + exit$1 = 3; break; - case "bigint" : case "number" : - exit = 2; + if (b_type === "number") { + return Caml.float_compare(a, b); + } + exit$1 = 3; break; case "string" : if (b_type === "string") { @@ -71,140 +82,148 @@ function compare(a, b) { case "undefined" : return -1; default: - + exit$1 = 3; } - if (exit === 2) { + if (exit$1 === 3) { switch (b_type) { - case "bigint" : - case "number" : - return Caml.float_compare(a, b); + case "string" : + return -1; + case "undefined" : + return 1; default: - - } - } - switch (b_type) { - case "string" : - return -1; - case "undefined" : - return 1; - default: - if (a_type === "boolean") { - return 1; - } - if (b_type === "boolean") { - return -1; - } - if (a_type === "function") { - return 1; - } - if (b_type === "function") { - return -1; - } - if (a_type === "number") { - if (b === null || b.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { + if (a_type === "boolean") { return 1; - } else { - return -1; } - } - if (b_type === "number") { - if (a === null || a.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { + if (b_type === "boolean") { return -1; - } else { - return 1; } - } - if (a === null) { - if (b.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { + if (a_type === "function") { return 1; - } else { - return -1; } - } - if (b === null) { - if (a.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { + if (b_type === "function") { return -1; - } else { - return 1; } - } - if (a.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { - if (b.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { - return aux_obj_compare(a, b); + switch (a_type) { + case "bigint" : + case "number" : + exit = 1; + break; + default: + switch (b_type) { + case "bigint" : + case "number" : + exit = 2; + break; + default: + if (a === null) { + if (b.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { + return 1; + } else { + return -1; + } + } + if (b === null) { + if (a.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { + return -1; + } else { + return 1; + } + } + if (a.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { + if (b.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { + return aux_obj_compare(a, b); + } else { + return -1; + } + } + var tag_a = a.TAG; + var tag_b = b.TAG; + if (tag_a === 248) { + return Caml.int_compare(a[1], b[1]); + } + if (tag_a === 251) { + throw { + RE_EXN_ID: "Invalid_argument", + _1: "equal: abstract value", + Error: new Error() + }; + } + if (tag_a !== tag_b) { + if (tag_a < tag_b) { + return -1; + } else { + return 1; + } + } + var len_a = a.length | 0; + var len_b = b.length | 0; + if (len_a === len_b) { + if (Array.isArray(a)) { + var _i = 0; + while(true) { + var i = _i; + if (i === len_a) { + return 0; + } + var res = compare(a[i], b[i]); + if (res !== 0) { + return res; + } + _i = i + 1 | 0; + continue ; + }; + } else if ((a instanceof Date && b instanceof Date)) { + return (a - b); + } else { + return aux_obj_compare(a, b); + } + } else if (len_a < len_b) { + var _i$1 = 0; + while(true) { + var i$1 = _i$1; + if (i$1 === len_a) { + return -1; + } + var res$1 = compare(a[i$1], b[i$1]); + if (res$1 !== 0) { + return res$1; + } + _i$1 = i$1 + 1 | 0; + continue ; + }; + } else { + var _i$2 = 0; + while(true) { + var i$2 = _i$2; + if (i$2 === len_b) { + return 1; + } + var res$2 = compare(a[i$2], b[i$2]); + if (res$2 !== 0) { + return res$2; + } + _i$2 = i$2 + 1 | 0; + continue ; + }; + } + } + } + } + } + switch (exit) { + case 1 : + if (b === null || b.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { + return 1; } else { return -1; } - } - var tag_a = a.TAG; - var tag_b = b.TAG; - if (tag_a === 248) { - return Caml.int_compare(a[1], b[1]); - } - if (tag_a === 251) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "equal: abstract value", - Error: new Error() - }; - } - if (tag_a !== tag_b) { - if (tag_a < tag_b) { + case 2 : + if (a === null || a.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { return -1; } else { return 1; } - } - var len_a = a.length | 0; - var len_b = b.length | 0; - if (len_a === len_b) { - if (Array.isArray(a)) { - var _i = 0; - while(true) { - var i = _i; - if (i === len_a) { - return 0; - } - var res = compare(a[i], b[i]); - if (res !== 0) { - return res; - } - _i = i + 1 | 0; - continue ; - }; - } else if ((a instanceof Date && b instanceof Date)) { - return (a - b); - } else { - return aux_obj_compare(a, b); - } - } else if (len_a < len_b) { - var _i$1 = 0; - while(true) { - var i$1 = _i$1; - if (i$1 === len_a) { - return -1; - } - var res$1 = compare(a[i$1], b[i$1]); - if (res$1 !== 0) { - return res$1; - } - _i$1 = i$1 + 1 | 0; - continue ; - }; - } else { - var _i$2 = 0; - while(true) { - var i$2 = _i$2; - if (i$2 === len_b) { - return 1; - } - var res$2 = compare(a[i$2], b[i$2]); - if (res$2 !== 0) { - return res$2; - } - _i$2 = i$2 + 1 | 0; - continue ; - }; - } + } } diff --git a/lib/js/caml_obj.js b/lib/js/caml_obj.js index 5c00357612..161a5bc821 100644 --- a/lib/js/caml_obj.js +++ b/lib/js/caml_obj.js @@ -43,11 +43,19 @@ function compare(a, b) { var a_type = typeof a; var b_type = typeof b; var exit = 0; + var exit$1 = 0; switch (a_type) { + case "bigint" : + if (b_type === "bigint") { + return Caml.float_compare(a, b); + } + exit$1 = 3; + break; case "boolean" : if (b_type === "boolean") { return Caml.bool_compare(a, b); } + exit$1 = 3; break; case "function" : if (b_type === "function") { @@ -57,10 +65,13 @@ function compare(a, b) { Error: new Error() }; } + exit$1 = 3; break; - case "bigint" : case "number" : - exit = 2; + if (b_type === "number") { + return Caml.float_compare(a, b); + } + exit$1 = 3; break; case "string" : if (b_type === "string") { @@ -71,140 +82,148 @@ function compare(a, b) { case "undefined" : return -1; default: - + exit$1 = 3; } - if (exit === 2) { + if (exit$1 === 3) { switch (b_type) { - case "bigint" : - case "number" : - return Caml.float_compare(a, b); + case "string" : + return -1; + case "undefined" : + return 1; default: - - } - } - switch (b_type) { - case "string" : - return -1; - case "undefined" : - return 1; - default: - if (a_type === "boolean") { - return 1; - } - if (b_type === "boolean") { - return -1; - } - if (a_type === "function") { - return 1; - } - if (b_type === "function") { - return -1; - } - if (a_type === "number") { - if (b === null || b.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { + if (a_type === "boolean") { return 1; - } else { - return -1; } - } - if (b_type === "number") { - if (a === null || a.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { + if (b_type === "boolean") { return -1; - } else { - return 1; } - } - if (a === null) { - if (b.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { + if (a_type === "function") { return 1; - } else { - return -1; } - } - if (b === null) { - if (a.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { + if (b_type === "function") { return -1; - } else { - return 1; } - } - if (a.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { - if (b.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { - return aux_obj_compare(a, b); + switch (a_type) { + case "bigint" : + case "number" : + exit = 1; + break; + default: + switch (b_type) { + case "bigint" : + case "number" : + exit = 2; + break; + default: + if (a === null) { + if (b.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { + return 1; + } else { + return -1; + } + } + if (b === null) { + if (a.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { + return -1; + } else { + return 1; + } + } + if (a.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { + if (b.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { + return aux_obj_compare(a, b); + } else { + return -1; + } + } + var tag_a = a.TAG; + var tag_b = b.TAG; + if (tag_a === 248) { + return Caml.int_compare(a[1], b[1]); + } + if (tag_a === 251) { + throw { + RE_EXN_ID: "Invalid_argument", + _1: "equal: abstract value", + Error: new Error() + }; + } + if (tag_a !== tag_b) { + if (tag_a < tag_b) { + return -1; + } else { + return 1; + } + } + var len_a = a.length | 0; + var len_b = b.length | 0; + if (len_a === len_b) { + if (Array.isArray(a)) { + var _i = 0; + while(true) { + var i = _i; + if (i === len_a) { + return 0; + } + var res = compare(a[i], b[i]); + if (res !== 0) { + return res; + } + _i = i + 1 | 0; + continue ; + }; + } else if ((a instanceof Date && b instanceof Date)) { + return (a - b); + } else { + return aux_obj_compare(a, b); + } + } else if (len_a < len_b) { + var _i$1 = 0; + while(true) { + var i$1 = _i$1; + if (i$1 === len_a) { + return -1; + } + var res$1 = compare(a[i$1], b[i$1]); + if (res$1 !== 0) { + return res$1; + } + _i$1 = i$1 + 1 | 0; + continue ; + }; + } else { + var _i$2 = 0; + while(true) { + var i$2 = _i$2; + if (i$2 === len_b) { + return 1; + } + var res$2 = compare(a[i$2], b[i$2]); + if (res$2 !== 0) { + return res$2; + } + _i$2 = i$2 + 1 | 0; + continue ; + }; + } + } + } + } + } + switch (exit) { + case 1 : + if (b === null || b.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { + return 1; } else { return -1; } - } - var tag_a = a.TAG; - var tag_b = b.TAG; - if (tag_a === 248) { - return Caml.int_compare(a[1], b[1]); - } - if (tag_a === 251) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "equal: abstract value", - Error: new Error() - }; - } - if (tag_a !== tag_b) { - if (tag_a < tag_b) { + case 2 : + if (a === null || a.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { return -1; } else { return 1; } - } - var len_a = a.length | 0; - var len_b = b.length | 0; - if (len_a === len_b) { - if (Array.isArray(a)) { - var _i = 0; - while(true) { - var i = _i; - if (i === len_a) { - return 0; - } - var res = compare(a[i], b[i]); - if (res !== 0) { - return res; - } - _i = i + 1 | 0; - continue ; - }; - } else if ((a instanceof Date && b instanceof Date)) { - return (a - b); - } else { - return aux_obj_compare(a, b); - } - } else if (len_a < len_b) { - var _i$1 = 0; - while(true) { - var i$1 = _i$1; - if (i$1 === len_a) { - return -1; - } - var res$1 = compare(a[i$1], b[i$1]); - if (res$1 !== 0) { - return res$1; - } - _i$1 = i$1 + 1 | 0; - continue ; - }; - } else { - var _i$2 = 0; - while(true) { - var i$2 = _i$2; - if (i$2 === len_b) { - return 1; - } - var res$2 = compare(a[i$2], b[i$2]); - if (res$2 !== 0) { - return res$2; - } - _i$2 = i$2 + 1 | 0; - continue ; - }; - } + } } From 0cc4020bb753aff9a5828db8a1c7f1d8c64e97a1 Mon Sep 17 00:00:00 2001 From: jmagaram Date: Sat, 25 Mar 2023 22:23:59 -0700 Subject: [PATCH 09/16] change log --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fcdea36bc..6bc7cc1695 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,7 @@ These are only breaking changes for unformatted code. - Fix issue where `foo(x,_)` in uncurried mode would generate a curried function https://github.com/rescript-lang/rescript-compiler/pull/6082 - Fix printing of uncurried application when the lhs is a function definition https://github.com/rescript-lang/rescript-compiler/pull/6084 - Fix parsing uncurried type starting with path https://github.com/rescript-lang/rescript-compiler/pull/6089 +- Fix bigInt comparison https://github.com/rescript-lang/rescript-compiler/pull/6097 #### :nail_care: Polish From 7edeea3d10d462b2678bfbfdbd64097591ff3b42 Mon Sep 17 00:00:00 2001 From: jmagaram Date: Sun, 26 Mar 2023 00:06:10 -0700 Subject: [PATCH 10/16] convert test and caml_obj to RES format --- jscomp/runtime/caml_obj.ml | 386 --------------- jscomp/runtime/caml_obj.res | 454 ++++++++++++++++++ .../runtime/{caml_obj.mli => caml_obj.resi} | 54 +-- jscomp/runtime/release.ninja | 4 +- jscomp/test/build.ninja | 2 +- jscomp/test/caml_compare_bigint_test.js | 30 +- jscomp/test/caml_compare_bigint_test.ml | 52 -- jscomp/test/caml_compare_bigint_test.res | 54 +++ 8 files changed, 545 insertions(+), 491 deletions(-) delete mode 100644 jscomp/runtime/caml_obj.ml create mode 100644 jscomp/runtime/caml_obj.res rename jscomp/runtime/{caml_obj.mli => caml_obj.resi} (68%) delete mode 100644 jscomp/test/caml_compare_bigint_test.ml create mode 100644 jscomp/test/caml_compare_bigint_test.res diff --git a/jscomp/runtime/caml_obj.ml b/jscomp/runtime/caml_obj.ml deleted file mode 100644 index ff8ac6751d..0000000000 --- a/jscomp/runtime/caml_obj.ml +++ /dev/null @@ -1,386 +0,0 @@ -(* Copyright (C) 2015-2016 Bloomberg Finance L.P. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * In addition to the permissions granted to you by the LGPL, you may combine - * or link a "work that uses the Library" with a publicly distributed version - * of this file to produce a combined library or application, then distribute - * that combined work under the terms of your choosing, with no requirement - * to comply with the obligations normally placed on you by section 4 of the - * LGPL version 3 (or the corresponding section of a later version of the LGPL - * should you choose to use a later version). - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) - -type t = Obj.t - -module O = struct - external isArray : 'a -> bool = "Array.isArray" [@@bs.val] - type key = string - let for_in : Obj.t -> (key -> unit) -> unit = - [%raw {|function(o,foo){ - for (var x in o) { foo(x) }} - |}] - - external hasOwnProperty : t -> key -> bool = "call" - [@@bs.scope "Object", "prototype", "hasOwnProperty"] [@@bs.val] - (** - JS objects are not guaranteed to have `Object` in their prototype - chain so calling `some_obj.hasOwnProperty(key)` can sometimes throw - an exception when dealing with JS interop. This mainly occurs when - objects are created via `Object.create(null)`. The only safe way - to call this function is directly, e.g. `Object.prototype.hasOwnProperty.call(some_obj, key)`. - *) - - external get_value : Obj.t -> key -> Obj.t = "" [@@bs.get_index] -end - -(** - Since now we change it back to use - Array representation - this function is higly dependent - on how objects are encoded in buckle. - - There are potentially some issues with wrong implementation of - `obj_dup`, for example, people call `Obj.dup` for a record, - and new record, since currently, `new record` will generate a - `slice` function (which assume the record is an array), and the - output is no longer an array. (it might be something like { 0 : x , 1 : y} ) - - {[ - let u : record = Obj.dup x in - let h = {u with x = 3} - ]} - - ==> - - {[ - var u = obj_dup (x) - var new_record = u.slice () - - ]} - `obj_dup` is a superset of `array_dup` -*) - -let obj_dup : Obj.t -> Obj.t = - [%raw - {|function(x){ - if(Array.isArray(x)){ - var len = x.length - var v = new Array(len) - for(var i = 0 ; i < len ; ++i){ - v[i] = x[i] - } - if(x.TAG !== undefined){ - v.TAG = x.TAG // TODO this can be removed eventually - } - return v - } - return Object.assign({},x) -}|}] - -(** - For the empty dummy object, whether it's - [[]] or [{}] depends on how - runtime encoding works, and will affect - js polymorphic comparison(Js.(=)) (fine with caml polymoprhic comparison (Pervasives.equal)) - In most cases, rec value comes from record/modules, - whose tag is 0, we optimize that case -*) -let update_dummy : _ -> _ -> unit = - [%raw - {|function(x,y){ - var k - if(Array.isArray(y)){ - for(k = 0; k < y.length ; ++k){ - x[k] = y[k] - } - if(y.TAG !== undefined){ - x.TAG = y.TAG - } - } else { - for (var k in y){ - x[k] = y[k] - } - } -} -|}] - -(** TODO: investigate total - [compare x y] returns [0] if [x] is equal to [y], - a negative integer if [x] is less than [y], - and a positive integer if [x] is greater than [y]. - The ordering implemented by compare is compatible with the comparison - predicates [=], [<] and [>] defined above, with one difference on the treatment of the float value - [nan]. - - Namely, the comparison predicates treat nan as different from any other float value, - including itself; while compare treats [nan] as equal to itself and less than any other float value. - This treatment of [nan] ensures that compare defines a total ordering relation. - compare applied to functional values may raise Invalid_argument. compare applied to cyclic structures - may not terminate. - - The compare function can be used as the comparison function required by the [Set.Make] and [Map.Make] functors, - as well as the [List.sort] and [Array.sort] functions. -*) -let rec compare (a : Obj.t) (b : Obj.t) : int = - if a == b then 0 - else - (*front and formoest, we do not compare function values*) - let a_type = Js.typeof a in - let b_type = Js.typeof b in - match (a_type, b_type) with - | "undefined", _ -> -1 - | _, "undefined" -> 1 - (* [a] is of type string, b can not be None, - [a] could be (Some (Some x)) in that case [b] could be [Some None] or [null] - so [b] has to be of type string or null *) - | "string", "string" -> - Pervasives.compare (Obj.magic a : string) (Obj.magic b) - | "string", _ -> - (* [b] could be [Some None] or [null] *) - 1 - | _, "string" -> -1 - | "boolean", "boolean" -> - Pervasives.compare (Obj.magic a : bool) (Obj.magic b) - | "boolean", _ -> 1 - | _, "boolean" -> -1 - | "function", "function" -> - raise (Invalid_argument "compare: functional value") - | "function", _ -> 1 - | _, "function" -> -1 - | "bigint", "bigint" -> - Pervasives.compare (Obj.magic a : float) (Obj.magic b : float) - | "number", "number" -> - Pervasives.compare (Obj.magic a : float) (Obj.magic b : float) - | "bigint", _ | "number", _ -> - if b == Obj.repr Js.null || Caml_option.isNested b then 1 - (* Some (Some ..) < x *) - else -1 (* Integer < Block in OCaml runtime GPR #1195, except Some.. *) - | _, "bigint" | _, "number" -> - if a == Obj.repr Js.null || Caml_option.isNested a then -1 else 1 - | _ -> - if a == Obj.repr Js.null then - (* [b] could not be null otherwise would equal *) - if Caml_option.isNested b then 1 else -1 - else if b == Obj.repr Js.null then - if Caml_option.isNested a then -1 else 1 - else if (* double_array_tag: 254 - *) - Caml_option.isNested a then - if Caml_option.isNested b then aux_obj_compare a b - (* Some None < Some (Some None)) *) - else - (* b could not be undefined/None *) - (* Some None < Some ..*) - -1 - else - let tag_a = Obj.tag a in - let tag_b = Obj.tag b in - if tag_a = 248 (* object/exception *) then - Pervasives.compare - (Obj.magic (Obj.field a 1) : int) - (Obj.magic (Obj.field b 1)) - else if tag_a = 251 (* abstract_tag *) then - raise (Invalid_argument "equal: abstract value") - else if tag_a <> tag_b then if tag_a < tag_b then -1 else 1 - else - let len_a = Obj.size a in - let len_b = Obj.size b in - if len_a = len_b then - if O.isArray a then - aux_same_length - (Obj.magic a : Obj.t array) - (Obj.magic b : Obj.t array) - 0 len_a - else if [%raw {|a instanceof Date && b instanceof Date|}] then - [%raw {|a - b|}] - else aux_obj_compare a b - else if len_a < len_b then - (* at least one is not zero, so it is an array block*) - aux_length_a_short - (Obj.magic a : Obj.t array) - (Obj.magic b : Obj.t array) - 0 len_a - else - aux_length_b_short - (Obj.magic a : Obj.t array) - (Obj.magic b : Obj.t array) - 0 len_b - -and aux_same_length (a : Obj.t array) (b : Obj.t array) i same_length = - if i = same_length then 0 - else - let res = - compare - (Caml_array_extern.unsafe_get a i) - (Caml_array_extern.unsafe_get b i) - in - if res <> 0 then res else aux_same_length a b (i + 1) same_length - -and aux_length_a_short (a : Obj.t array) (b : Obj.t array) i short_length = - if i = short_length then -1 - else - let res = - compare - (Caml_array_extern.unsafe_get a i) - (Caml_array_extern.unsafe_get b i) - in - if res <> 0 then res else aux_length_a_short a b (i + 1) short_length - -and aux_length_b_short (a : Obj.t array) (b : Obj.t array) i short_length = - if i = short_length then 1 - else - let res = - compare - (Caml_array_extern.unsafe_get a i) - (Caml_array_extern.unsafe_get b i) - in - if res <> 0 then res else aux_length_b_short a b (i + 1) short_length - -and aux_obj_compare (a : Obj.t) (b : Obj.t) = - let min_key_lhs = ref None in - let min_key_rhs = ref None in - let do_key (a, b, min_key) key = - if - (not (O.hasOwnProperty b key)) - || compare (O.get_value a key) (O.get_value b key) > 0 - then - match min_key.contents with - | None -> min_key.contents <- Some key - | Some mk -> if key < mk then min_key.contents <- Some key - in - let do_key_a = do_key (a, b, min_key_rhs) in - let do_key_b = do_key (b, a, min_key_lhs) in - O.for_in a do_key_a; - O.for_in b do_key_b; - let res = - match (min_key_lhs.contents, min_key_rhs.contents) with - | None, None -> 0 - | Some _, None -> -1 - | None, Some _ -> 1 - | Some x, Some y -> Pervasives.compare x y - in - res - -type eq = Obj.t -> Obj.t -> bool - -(** It is easier to do equality check than comparision, since as long as its - basic type is not the same, it will not equal -*) -let rec equal (a : Obj.t) (b : Obj.t) : bool = - (*front and formoest, we do not compare function values*) - if a == b then true - else - let a_type = Js.typeof a in - if - a_type = "string" || a_type = "number" || a_type = "bigint" - || a_type = "boolean" || a_type = "undefined" - || a == [%raw {|null|}] - then false - else - let b_type = Js.typeof b in - if a_type = "function" || b_type = "function" then - raise (Invalid_argument "equal: functional value") - (* first, check using reference equality *) - else if - (* a_type = "object" || "symbol" *) - b_type = "number" || b_type = "bigint" || b_type = "undefined" - || b == [%raw {|null|}] - then false - else - (* [a] [b] could not be null, so it can not raise *) - let tag_a = Obj.tag a in - let tag_b = Obj.tag b in - if tag_a = 248 (* object/exception *) then - Obj.magic (Obj.field a 1) == Obj.magic (Obj.field b 1) - else if tag_a = 251 (* abstract_tag *) then - raise (Invalid_argument "equal: abstract value") - else if tag_a <> tag_b then false - else - let len_a = Obj.size a in - let len_b = Obj.size b in - if len_a = len_b then - if O.isArray a then - aux_equal_length - (Obj.magic a : Obj.t array) - (Obj.magic b : Obj.t array) - 0 len_a - else if [%raw {|a instanceof Date && b instanceof Date|}] then - not (Js.unsafe_gt a b || Js.unsafe_lt a b) - else aux_obj_equal a b - else false - -and aux_equal_length (a : Obj.t array) (b : Obj.t array) i same_length = - if i = same_length then true - else - equal (Caml_array_extern.unsafe_get a i) (Caml_array_extern.unsafe_get b i) - && aux_equal_length a b (i + 1) same_length - -and aux_obj_equal (a : Obj.t) (b : Obj.t) = - let result = ref true in - let do_key_a key = - if not (O.hasOwnProperty b key) then result.contents <- false - in - let do_key_b key = - if - (not (O.hasOwnProperty a key)) - || not (equal (O.get_value b key) (O.get_value a key)) - then result.contents <- false - in - O.for_in a do_key_a; - if result.contents then O.for_in b do_key_b; - result.contents - -let equal_null (x : Obj.t) (y : Obj.t Js.null) = - match Js.nullToOption y with - | None -> x == Obj.magic y - | Some y -> equal x y - -let equal_undefined (x : Obj.t) (y : Obj.t Js.undefined) = - match Js.undefinedToOption y with - | None -> x == Obj.magic y - | Some y -> equal x y - -let equal_nullable (x : Obj.t) (y : Obj.t Js.nullable) = - match Js.toOption y with - | None -> x == Obj.magic y - | Some y -> equal x y - -let isNumberOrBigInt a = Js.typeof a = "number" || Js.typeof a = "bigint" - -let canNumericCompare a b = isNumberOrBigInt a && isNumberOrBigInt b - -let notequal a b = - if canNumericCompare a b then (Obj.magic a : float) <> (Obj.magic b : float) - else not (equal a b) - -let greaterequal a b = - if canNumericCompare a b then (Obj.magic a : float) >= (Obj.magic b : float) - else compare a b >= 0 - -let greaterthan a b = - if canNumericCompare a b then (Obj.magic a : float) > (Obj.magic b : float) - else compare a b > 0 - -let lessequal a b = - if canNumericCompare a b then (Obj.magic a : float) <= (Obj.magic b : float) - else compare a b <= 0 - -let lessthan a b = - if canNumericCompare a b then (Obj.magic a : float) < (Obj.magic b : float) - else compare a b < 0 - -let min (x : Obj.t) y = if compare x y <= 0 then x else y - -let max (x : Obj.t) y = if compare x y >= 0 then x else y diff --git a/jscomp/runtime/caml_obj.res b/jscomp/runtime/caml_obj.res new file mode 100644 index 0000000000..8d4f059f34 --- /dev/null +++ b/jscomp/runtime/caml_obj.res @@ -0,0 +1,454 @@ +/* Copyright (C) 2015-2016 Bloomberg Finance L.P. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * In addition to the permissions granted to you by the LGPL, you may combine + * or link a "work that uses the Library" with a publicly distributed version + * of this file to produce a combined library or application, then distribute + * that combined work under the terms of your choosing, with no requirement + * to comply with the obligations normally placed on you by section 4 of the + * LGPL version 3 (or the corresponding section of a later version of the LGPL + * should you choose to use a later version). + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +type t = Obj.t + +module O = { + @val external isArray: 'a => bool = "Array.isArray" + type key = string + let for_in: (Obj.t, key => unit) => unit = %raw(`function(o,foo){ + for (var x in o) { foo(x) }} + `) + + @scope(("Object", "prototype", "hasOwnProperty")) + @val + @ocaml.doc(" + JS objects are not guaranteed to have `Object` in their prototype + chain so calling `some_obj.hasOwnProperty(key)` can sometimes throw + an exception when dealing with JS interop. This mainly occurs when + objects are created via `Object.create(null)`. The only safe way + to call this function is directly, e.g. `Object.prototype.hasOwnProperty.call(some_obj, key)`. + ") + external hasOwnProperty: (t, key) => bool = "call" + + @get_index external get_value: (Obj.t, key) => Obj.t = "" +} + +@@ocaml.text(" + Since now we change it back to use + Array representation + this function is higly dependent + on how objects are encoded in buckle. + + There are potentially some issues with wrong implementation of + `obj_dup`, for example, people call `Obj.dup` for a record, + and new record, since currently, `new record` will generate a + `slice` function (which assume the record is an array), and the + output is no longer an array. (it might be something like { 0 : x , 1 : y} ) + + {[ + let u : record = Obj.dup x in + let h = {u with x = 3} + ]} + + ==> + + {[ + var u = obj_dup (x) + var new_record = u.slice () + + ]} + `obj_dup` is a superset of `array_dup` +") + +let obj_dup: Obj.t => Obj.t = %raw(`function(x){ + if(Array.isArray(x)){ + var len = x.length + var v = new Array(len) + for(var i = 0 ; i < len ; ++i){ + v[i] = x[i] + } + if(x.TAG !== undefined){ + v.TAG = x.TAG // TODO this can be removed eventually + } + return v + } + return Object.assign({},x) +}`) + +@ocaml.doc(" + For the empty dummy object, whether it's + [[]] or [{}] depends on how + runtime encoding works, and will affect + js polymorphic comparison(Js.(=)) (fine with caml polymoprhic comparison (Pervasives.equal)) + In most cases, rec value comes from record/modules, + whose tag is 0, we optimize that case +") +let update_dummy: (_, _) => unit = %raw(`function(x,y){ + var k + if(Array.isArray(y)){ + for(k = 0; k < y.length ; ++k){ + x[k] = y[k] + } + if(y.TAG !== undefined){ + x.TAG = y.TAG + } + } else { + for (var k in y){ + x[k] = y[k] + } + } +} +`) + +@ocaml.doc(" TODO: investigate total + [compare x y] returns [0] if [x] is equal to [y], + a negative integer if [x] is less than [y], + and a positive integer if [x] is greater than [y]. + The ordering implemented by compare is compatible with the comparison + predicates [=], [<] and [>] defined above, with one difference on the treatment of the float value + [nan]. + + Namely, the comparison predicates treat nan as different from any other float value, + including itself; while compare treats [nan] as equal to itself and less than any other float value. + This treatment of [nan] ensures that compare defines a total ordering relation. + compare applied to functional values may raise Invalid_argument. compare applied to cyclic structures + may not terminate. + + The compare function can be used as the comparison function required by the [Set.Make] and [Map.Make] functors, + as well as the [List.sort] and [Array.sort] functions. +") +let rec compare = (a: Obj.t, b: Obj.t): int => + if a === b { + 0 + } else { + /* front and formoest, we do not compare function values */ + let a_type = Js.typeof(a) + let b_type = Js.typeof(b) + switch (a_type, b_type) { + | ("undefined", _) => -1 + | (_, "undefined") => 1 + /* [a] is of type string, b can not be None, + [a] could be (Some (Some x)) in that case [b] could be [Some None] or [null] + so [b] has to be of type string or null */ + | ("string", "string") => Pervasives.compare((Obj.magic(a): string), Obj.magic(b)) + | ("string", _) => /* [b] could be [Some None] or [null] */ + 1 + | (_, "string") => -1 + | ("boolean", "boolean") => Pervasives.compare((Obj.magic(a): bool), Obj.magic(b)) + | ("boolean", _) => 1 + | (_, "boolean") => -1 + | ("function", "function") => raise(Invalid_argument("compare: functional value")) + | ("function", _) => 1 + | (_, "function") => -1 + | ("bigint", "bigint") => Pervasives.compare((Obj.magic(a): float), (Obj.magic(b): float)) + | ("number", "number") => Pervasives.compare((Obj.magic(a): float), (Obj.magic(b): float)) + | ("bigint", _) | ("number", _) => + if b === Obj.repr(Js.null) || Caml_option.isNested(b) { + 1 + } else { + /* Some (Some ..) < x */ + -1 + } /* Integer < Block in OCaml runtime GPR #1195, except Some.. */ + | (_, "bigint") | (_, "number") => + if a === Obj.repr(Js.null) || Caml_option.isNested(a) { + -1 + } else { + 1 + } + | _ => + if a === Obj.repr(Js.null) { + /* [b] could not be null otherwise would equal */ + if Caml_option.isNested(b) { + 1 + } else { + -1 + } + } else if b === Obj.repr(Js.null) { + if Caml_option.isNested(a) { + -1 + } else { + 1 + } + } else if ( + /* double_array_tag: 254 + */ + Caml_option.isNested(a) + ) { + if Caml_option.isNested(b) { + aux_obj_compare(a, b) + } else { + /* Some None < Some (Some None)) */ + + /* b could not be undefined/None */ + /* Some None < Some .. */ + -1 + } + } else { + let tag_a = Obj.tag(a) + let tag_b = Obj.tag(b) + if tag_a == 248 /* object/exception */ { + Pervasives.compare((Obj.magic(Obj.field(a, 1)): int), Obj.magic(Obj.field(b, 1))) + } else if tag_a == 251 /* abstract_tag */ { + raise(Invalid_argument("equal: abstract value")) + } else if tag_a != tag_b { + if tag_a < tag_b { + -1 + } else { + 1 + } + } else { + let len_a = Obj.size(a) + let len_b = Obj.size(b) + if len_a == len_b { + if O.isArray(a) { + aux_same_length((Obj.magic(a): array), (Obj.magic(b): array), 0, len_a) + } else if %raw(`a instanceof Date && b instanceof Date`) { + %raw(`a - b`) + } else { + aux_obj_compare(a, b) + } + } else if len_a < len_b { + /* at least one is not zero, so it is an array block */ + aux_length_a_short((Obj.magic(a): array), (Obj.magic(b): array), 0, len_a) + } else { + aux_length_b_short((Obj.magic(a): array), (Obj.magic(b): array), 0, len_b) + } + } + } + } + } + +and aux_same_length = (a: array, b: array, i, same_length) => + if i == same_length { + 0 + } else { + let res = compare(Caml_array_extern.unsafe_get(a, i), Caml_array_extern.unsafe_get(b, i)) + + if res != 0 { + res + } else { + aux_same_length(a, b, i + 1, same_length) + } + } + +and aux_length_a_short = (a: array, b: array, i, short_length) => + if i == short_length { + -1 + } else { + let res = compare(Caml_array_extern.unsafe_get(a, i), Caml_array_extern.unsafe_get(b, i)) + + if res != 0 { + res + } else { + aux_length_a_short(a, b, i + 1, short_length) + } + } + +and aux_length_b_short = (a: array, b: array, i, short_length) => + if i == short_length { + 1 + } else { + let res = compare(Caml_array_extern.unsafe_get(a, i), Caml_array_extern.unsafe_get(b, i)) + + if res != 0 { + res + } else { + aux_length_b_short(a, b, i + 1, short_length) + } + } + +and aux_obj_compare = (a: Obj.t, b: Obj.t) => { + let min_key_lhs = ref(None) + let min_key_rhs = ref(None) + let do_key = ((a, b, min_key), key) => + if !O.hasOwnProperty(b, key) || compare(O.get_value(a, key), O.get_value(b, key)) > 0 { + switch min_key.contents { + | None => min_key.contents = Some(key) + | Some(mk) => + if key < mk { + min_key.contents = Some(key) + } + } + } + + let do_key_a = do_key((a, b, min_key_rhs)) + let do_key_b = do_key((b, a, min_key_lhs)) + O.for_in(a, do_key_a) + O.for_in(b, do_key_b) + let res = switch (min_key_lhs.contents, min_key_rhs.contents) { + | (None, None) => 0 + | (Some(_), None) => -1 + | (None, Some(_)) => 1 + | (Some(x), Some(y)) => Pervasives.compare(x, y) + } + + res +} + +type eq = (Obj.t, Obj.t) => bool + +@ocaml.doc(" It is easier to do equality check than comparision, since as long as its + basic type is not the same, it will not equal +") +let rec equal = (a: Obj.t, b: Obj.t): bool => + /* front and formoest, we do not compare function values */ + if a === b { + true + } else { + let a_type = Js.typeof(a) + if ( + a_type == "string" || + (a_type == "number" || + (a_type == "bigint" || + (a_type == "boolean" || + (a_type == "undefined" || a === %raw(`null`))))) + ) { + false + } else { + let b_type = Js.typeof(b) + if a_type == "function" || b_type == "function" { + raise(Invalid_argument("equal: functional value")) + } /* first, check using reference equality */ + else if ( + /* a_type = "object" || "symbol" */ + b_type == "number" || (b_type == "bigint" || (b_type == "undefined" || b === %raw(`null`))) + ) { + false + } else { + /* [a] [b] could not be null, so it can not raise */ + let tag_a = Obj.tag(a) + let tag_b = Obj.tag(b) + if tag_a == 248 /* object/exception */ { + Obj.magic(Obj.field(a, 1)) === Obj.magic(Obj.field(b, 1)) + } else if tag_a == 251 /* abstract_tag */ { + raise(Invalid_argument("equal: abstract value")) + } else if tag_a != tag_b { + false + } else { + let len_a = Obj.size(a) + let len_b = Obj.size(b) + if len_a == len_b { + if O.isArray(a) { + aux_equal_length((Obj.magic(a): array), (Obj.magic(b): array), 0, len_a) + } else if %raw(`a instanceof Date && b instanceof Date`) { + !(Js.unsafe_gt(a, b) || Js.unsafe_lt(a, b)) + } else { + aux_obj_equal(a, b) + } + } else { + false + } + } + } + } + } + +and aux_equal_length = (a: array, b: array, i, same_length) => + if i == same_length { + true + } else { + equal(Caml_array_extern.unsafe_get(a, i), Caml_array_extern.unsafe_get(b, i)) && + aux_equal_length(a, b, i + 1, same_length) + } + +and aux_obj_equal = (a: Obj.t, b: Obj.t) => { + let result = ref(true) + let do_key_a = key => + if !O.hasOwnProperty(b, key) { + result.contents = false + } + + let do_key_b = key => + if !O.hasOwnProperty(a, key) || !equal(O.get_value(b, key), O.get_value(a, key)) { + result.contents = false + } + + O.for_in(a, do_key_a) + if result.contents { + O.for_in(b, do_key_b) + } + result.contents +} + +let equal_null = (x: Obj.t, y: Js.null) => + switch Js.nullToOption(y) { + | None => x === Obj.magic(y) + | Some(y) => equal(x, y) + } + +let equal_undefined = (x: Obj.t, y: Js.undefined) => + switch Js.undefinedToOption(y) { + | None => x === Obj.magic(y) + | Some(y) => equal(x, y) + } + +let equal_nullable = (x: Obj.t, y: Js.nullable) => + switch Js.toOption(y) { + | None => x === Obj.magic(y) + | Some(y) => equal(x, y) + } + +let isNumberOrBigInt = a => Js.typeof(a) == "number" || Js.typeof(a) == "bigint" + +let canNumericCompare = (a, b) => isNumberOrBigInt(a) && isNumberOrBigInt(b) + +let notequal = (a, b) => + if canNumericCompare(a, b) { + (Obj.magic(a): float) != (Obj.magic(b): float) + } else { + !equal(a, b) + } + +let greaterequal = (a, b) => + if canNumericCompare(a, b) { + (Obj.magic(a): float) >= (Obj.magic(b): float) + } else { + compare(a, b) >= 0 + } + +let greaterthan = (a, b) => + if canNumericCompare(a, b) { + (Obj.magic(a): float) > (Obj.magic(b): float) + } else { + compare(a, b) > 0 + } + +let lessequal = (a, b) => + if canNumericCompare(a, b) { + (Obj.magic(a): float) <= (Obj.magic(b): float) + } else { + compare(a, b) <= 0 + } + +let lessthan = (a, b) => + if canNumericCompare(a, b) { + (Obj.magic(a): float) < (Obj.magic(b): float) + } else { + compare(a, b) < 0 + } + +let min = (x: Obj.t, y) => + if compare(x, y) <= 0 { + x + } else { + y + } + +let max = (x: Obj.t, y) => + if compare(x, y) >= 0 { + x + } else { + y + } diff --git a/jscomp/runtime/caml_obj.mli b/jscomp/runtime/caml_obj.resi similarity index 68% rename from jscomp/runtime/caml_obj.mli rename to jscomp/runtime/caml_obj.resi index 812d688aae..d239655336 100644 --- a/jscomp/runtime/caml_obj.mli +++ b/jscomp/runtime/caml_obj.resi @@ -1,5 +1,5 @@ -(* Copyright (C) 2015-2016 Bloomberg Finance L.P. - * +/* Copyright (C) 2015-2016 Bloomberg Finance L.P. + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or @@ -17,46 +17,32 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) - - - - - -type t = Obj.t - - - -val obj_dup : Obj.t -> Obj.t - - -val update_dummy : Obj.t -> Obj.t -> unit - - -val compare : Obj.t -> Obj.t -> int + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -type eq = Obj.t -> Obj.t -> bool +type t = Obj.t -val equal : eq +let obj_dup: Obj.t => Obj.t -val equal_null : Obj.t -> Obj.t Js.null -> bool -val equal_undefined : Obj.t -> Obj.t Js.undefined -> bool -val equal_nullable : Obj.t -> Obj.t Js.nullable -> bool +let update_dummy: (Obj.t, Obj.t) => unit -val notequal : eq -val greaterequal : eq -val greaterthan : eq -val lessthan : eq -val lessequal : eq +let compare: (Obj.t, Obj.t) => int +type eq = (Obj.t, Obj.t) => bool +let equal: eq +let equal_null: (Obj.t, Js.null) => bool +let equal_undefined: (Obj.t, Js.undefined) => bool +let equal_nullable: (Obj.t, Js.nullable) => bool -val min : - t -> t -> t -val max : - t -> t -> t +let notequal: eq +let greaterequal: eq +let greaterthan: eq +let lessthan: eq +let lessequal: eq +let min: (t, t) => t +let max: (t, t) => t diff --git a/jscomp/runtime/release.ninja b/jscomp/runtime/release.ninja index 8798a72d19..da5360e78f 100644 --- a/jscomp/runtime/release.ninja +++ b/jscomp/runtime/release.ninja @@ -37,8 +37,6 @@ o runtime/caml_md5.cmj : cc_cmi runtime/caml_md5.ml | runtime/caml_array_extern. o runtime/caml_md5.cmi : cc runtime/caml_md5.mli | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_module.cmj : cc_cmi runtime/caml_module.ml | runtime/caml_array_extern.cmj runtime/caml_module.cmi runtime/caml_obj.cmj o runtime/caml_module.cmi : cc runtime/caml_module.mli | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj -o runtime/caml_obj.cmj : cc_cmi runtime/caml_obj.ml | runtime/caml.cmj runtime/caml_array_extern.cmj runtime/caml_obj.cmi runtime/caml_option.cmj runtime/js.cmj -o runtime/caml_obj.cmi : cc runtime/caml_obj.mli | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_option.cmj : cc_cmi runtime/caml_option.ml | runtime/caml_option.cmi runtime/caml_undefined_extern.cmj runtime/js.cmj o runtime/caml_option.cmi : cc runtime/caml_option.mli | runtime/bs_stdlib_mini.cmi runtime/caml_undefined_extern.cmj runtime/js.cmi runtime/js.cmj o runtime/caml_parser.cmj : cc_cmi runtime/caml_parser.ml | runtime/caml_parser.cmi @@ -59,4 +57,4 @@ o runtime/caml_nativeint_extern.cmi runtime/caml_nativeint_extern.cmj : cc runti o runtime/caml_string_extern.cmi runtime/caml_string_extern.cmj : cc runtime/caml_string_extern.ml | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_undefined_extern.cmi runtime/caml_undefined_extern.cmj : cc runtime/caml_undefined_extern.ml | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/curry.cmi runtime/curry.cmj : cc runtime/curry.ml | runtime/bs_stdlib_mini.cmi runtime/caml_array.cmj runtime/caml_array_extern.cmj runtime/js.cmi runtime/js.cmj -o runtime : phony runtime/bs_stdlib_mini.cmi runtime/js.cmj runtime/js.cmi runtime/caml.cmi runtime/caml.cmj runtime/caml_array.cmi runtime/caml_array.cmj runtime/caml_bytes.cmi runtime/caml_bytes.cmj runtime/caml_float.cmi runtime/caml_float.cmj runtime/caml_format.cmi runtime/caml_format.cmj runtime/caml_hash.cmi runtime/caml_hash.cmj runtime/caml_hash_primitive.cmi runtime/caml_hash_primitive.cmj runtime/caml_int32.cmi runtime/caml_int32.cmj runtime/caml_int64.cmi runtime/caml_int64.cmj runtime/caml_lexer.cmi runtime/caml_lexer.cmj runtime/caml_md5.cmi runtime/caml_md5.cmj runtime/caml_module.cmi runtime/caml_module.cmj runtime/caml_obj.cmi runtime/caml_obj.cmj runtime/caml_option.cmi runtime/caml_option.cmj runtime/caml_parser.cmi runtime/caml_parser.cmj runtime/caml_splice_call.cmi runtime/caml_splice_call.cmj runtime/caml_string.cmi runtime/caml_string.cmj runtime/caml_sys.cmi runtime/caml_sys.cmj runtime/caml_array_extern.cmi runtime/caml_array_extern.cmj runtime/caml_exceptions.cmi runtime/caml_exceptions.cmj runtime/caml_external_polyfill.cmi runtime/caml_external_polyfill.cmj runtime/caml_float_extern.cmi runtime/caml_float_extern.cmj runtime/caml_int64_extern.cmi runtime/caml_int64_extern.cmj runtime/caml_js_exceptions.cmi runtime/caml_js_exceptions.cmj runtime/caml_nativeint_extern.cmi runtime/caml_nativeint_extern.cmj runtime/caml_string_extern.cmi runtime/caml_string_extern.cmj runtime/caml_undefined_extern.cmi runtime/caml_undefined_extern.cmj runtime/curry.cmi runtime/curry.cmj +o runtime : phony runtime/bs_stdlib_mini.cmi runtime/js.cmj runtime/js.cmi runtime/caml.cmi runtime/caml.cmj runtime/caml_array.cmi runtime/caml_array.cmj runtime/caml_bytes.cmi runtime/caml_bytes.cmj runtime/caml_float.cmi runtime/caml_float.cmj runtime/caml_format.cmi runtime/caml_format.cmj runtime/caml_hash.cmi runtime/caml_hash.cmj runtime/caml_hash_primitive.cmi runtime/caml_hash_primitive.cmj runtime/caml_int32.cmi runtime/caml_int32.cmj runtime/caml_int64.cmi runtime/caml_int64.cmj runtime/caml_lexer.cmi runtime/caml_lexer.cmj runtime/caml_md5.cmi runtime/caml_md5.cmj runtime/caml_module.cmi runtime/caml_module.cmj runtime/caml_option.cmi runtime/caml_option.cmj runtime/caml_parser.cmi runtime/caml_parser.cmj runtime/caml_splice_call.cmi runtime/caml_splice_call.cmj runtime/caml_string.cmi runtime/caml_string.cmj runtime/caml_sys.cmi runtime/caml_sys.cmj runtime/caml_array_extern.cmi runtime/caml_array_extern.cmj runtime/caml_exceptions.cmi runtime/caml_exceptions.cmj runtime/caml_external_polyfill.cmi runtime/caml_external_polyfill.cmj runtime/caml_float_extern.cmi runtime/caml_float_extern.cmj runtime/caml_int64_extern.cmi runtime/caml_int64_extern.cmj runtime/caml_js_exceptions.cmi runtime/caml_js_exceptions.cmj runtime/caml_nativeint_extern.cmi runtime/caml_nativeint_extern.cmj runtime/caml_string_extern.cmi runtime/caml_string_extern.cmj runtime/caml_undefined_extern.cmi runtime/caml_undefined_extern.cmj runtime/curry.cmi runtime/curry.cmj diff --git a/jscomp/test/build.ninja b/jscomp/test/build.ninja index a09ac8d6c2..adaf1ab2fe 100644 --- a/jscomp/test/build.ninja +++ b/jscomp/test/build.ninja @@ -109,7 +109,7 @@ o test/bs_string_test.cmi test/bs_string_test.cmj : cc test/bs_string_test.ml | o test/bs_unwrap_test.cmi test/bs_unwrap_test.cmj : cc test/bs_unwrap_test.ml | $bsc $stdlib runtime o test/buffer_test.cmi test/buffer_test.cmj : cc test/buffer_test.ml | test/mt.cmj $bsc $stdlib runtime o test/bytes_split_gpr_743_test.cmi test/bytes_split_gpr_743_test.cmj : cc test/bytes_split_gpr_743_test.ml | test/mt.cmj $bsc $stdlib runtime -o test/caml_compare_bigint_test.cmi test/caml_compare_bigint_test.cmj : cc test/caml_compare_bigint_test.ml | test/mt.cmj $bsc $stdlib runtime +o test/caml_compare_bigint_test.cmi test/caml_compare_bigint_test.cmj : cc test/caml_compare_bigint_test.res | test/mt.cmj $bsc $stdlib runtime o test/caml_compare_test.cmi test/caml_compare_test.cmj : cc test/caml_compare_test.ml | test/mt.cmj $bsc $stdlib runtime o test/caml_format_test.cmi test/caml_format_test.cmj : cc test/caml_format_test.res | test/mt.cmj $bsc $stdlib runtime o test/caml_sys_poly_fill_test.cmi test/caml_sys_poly_fill_test.cmj : cc test/caml_sys_poly_fill_test.ml | test/mt.cmj $bsc $stdlib runtime diff --git a/jscomp/test/caml_compare_bigint_test.js b/jscomp/test/caml_compare_bigint_test.js index bbb9b3e4f6..133014ec20 100644 --- a/jscomp/test/caml_compare_bigint_test.js +++ b/jscomp/test/caml_compare_bigint_test.js @@ -117,7 +117,7 @@ function isLessThan(title, small, big) { ], tl: { hd: [ - "!= operator: " + title, + "!== operator: " + title, (function (param) { return { TAG: "Eq", @@ -128,7 +128,7 @@ function isLessThan(title, small, big) { ], tl: { hd: [ - "!= operator: " + title, + "!== operator: " + title, (function (param) { return { TAG: "Eq", @@ -139,7 +139,7 @@ function isLessThan(title, small, big) { ], tl: { hd: [ - "<> operator: " + title, + "!= operator: " + title, (function (param) { return { TAG: "Eq", @@ -150,7 +150,7 @@ function isLessThan(title, small, big) { ], tl: { hd: [ - "<> operator: " + title, + "!= operator: " + title, (function (param) { return { TAG: "Eq", @@ -161,7 +161,7 @@ function isLessThan(title, small, big) { ], tl: { hd: [ - "= operator: " + title, + "== operator: " + title, (function (param) { return { TAG: "Eq", @@ -172,7 +172,7 @@ function isLessThan(title, small, big) { ], tl: { hd: [ - "= operator: " + title, + "== operator: " + title, (function (param) { return { TAG: "Eq", @@ -183,7 +183,7 @@ function isLessThan(title, small, big) { ], tl: { hd: [ - "== operator: " + title, + "=== operator: " + title, (function (param) { return { TAG: "Eq", @@ -194,7 +194,7 @@ function isLessThan(title, small, big) { ], tl: { hd: [ - "== operator: " + title, + "=== operator: " + title, (function (param) { return { TAG: "Eq", @@ -337,7 +337,7 @@ function isEqual(title, num1, num2) { ], tl: { hd: [ - "<> operator: " + title, + "!= operator: " + title, (function (param) { return { TAG: "Eq", @@ -348,7 +348,7 @@ function isEqual(title, num1, num2) { ], tl: { hd: [ - "<> operator: " + title, + "!= operator: " + title, (function (param) { return { TAG: "Eq", @@ -359,7 +359,7 @@ function isEqual(title, num1, num2) { ], tl: { hd: [ - "= operator: " + title, + "== operator: " + title, (function (param) { return { TAG: "Eq", @@ -370,7 +370,7 @@ function isEqual(title, num1, num2) { ], tl: { hd: [ - "= operator: " + title, + "== operator: " + title, (function (param) { return { TAG: "Eq", @@ -381,7 +381,7 @@ function isEqual(title, num1, num2) { ], tl: { hd: [ - "== operator: " + title, + "=== operator: " + title, (function (param) { return { TAG: "Eq", @@ -392,7 +392,7 @@ function isEqual(title, num1, num2) { ], tl: { hd: [ - "== operator: " + title, + "=== operator: " + title, (function (param) { return { TAG: "Eq", @@ -424,7 +424,7 @@ var five = BigInt("5"); var suites = Pervasives.$at(isLessThan("123 and 555555", BigInt("123"), BigInt("555555")), Pervasives.$at(isEqual("98765 and 98765", BigInt("98765"), BigInt("98765")), isEqual("same instance", five, five))); -Mt.from_pair_suites("caml_compare_bigint_test.ml", suites); +Mt.from_pair_suites("caml_compare_bigint_test.res", suites); exports.isLessThan = isLessThan; exports.isEqual = isEqual; diff --git a/jscomp/test/caml_compare_bigint_test.ml b/jscomp/test/caml_compare_bigint_test.ml deleted file mode 100644 index 6028a2c818..0000000000 --- a/jscomp/test/caml_compare_bigint_test.ml +++ /dev/null @@ -1,52 +0,0 @@ -external bigint : string -> float = "BigInt" [@@bs.val] -let isLessThan title small big = - [ - ("compare: " ^ title, fun _ -> Mt.Eq (true, compare big small > 0)); - ("compare: " ^ title, fun _ -> Mt.Eq (true, compare small big < 0)); - ("< operator: " ^ title, fun _ -> Mt.Eq (true, small < big)); - ("<= operator: " ^ title, fun _ -> Mt.Eq (true, small <= big)); - ("> operator: " ^ title, fun _ -> Mt.Eq (true, big > small)); - (">= operator: " ^ title, fun _ -> Mt.Eq (true, big >= small)); - ("min: " ^ title, fun _ -> Mt.Eq (small, min big small)); - ("min: " ^ title, fun _ -> Mt.Eq (small, min small big)); - ("max: " ^ title, fun _ -> Mt.Eq (big, max big small)); - ("max: " ^ title, fun _ -> Mt.Eq (big, max small big)); - ("!= operator: " ^ title, fun _ -> Mt.Eq (true, big != small)); - ("!= operator: " ^ title, fun _ -> Mt.Eq (true, small != big)); - ("<> operator: " ^ title, fun _ -> Mt.Eq (true, big <> small)); - ("<> operator: " ^ title, fun _ -> Mt.Eq (true, small <> big)); - ("= operator: " ^ title, fun _ -> Mt.Eq (false, big = small)); - ("= operator: " ^ title, fun _ -> Mt.Eq (false, small = big)); - ("== operator: " ^ title, fun _ -> Mt.Eq (false, big == small)); - ("== operator: " ^ title, fun _ -> Mt.Eq (false, small == big)); - ] - -let isEqual title num1 num2 = - [ - ("< operator: " ^ title, fun _ -> Mt.Eq (false, num2 < num1)); - ("<= operator: " ^ title, fun _ -> Mt.Eq (true, num2 <= num1)); - ("> operator: " ^ title, fun _ -> Mt.Eq (false, num1 > num2)); - (">= operator: " ^ title, fun _ -> Mt.Eq (true, num1 >= num2)); - ("min: " ^ title, fun _ -> Mt.Eq (num1, min num1 num2)); - ("max: " ^ title, fun _ -> Mt.Eq (num1, max num1 num2)); - ("compare: " ^ title, fun _ -> Mt.Eq (0, compare num1 num2)); - ("compare: " ^ title, fun _ -> Mt.Eq (0, compare num2 num1)); - ("!= operator: " ^ title, fun _ -> Mt.Eq (false, num1 != num2)); - ("!= operator: " ^ title, fun _ -> Mt.Eq (false, num2 != num1)); - ("<> operator: " ^ title, fun _ -> Mt.Eq (false, num1 <> num2)); - ("<> operator: " ^ title, fun _ -> Mt.Eq (false, num2 <> num1)); - ("= operator: " ^ title, fun _ -> Mt.Eq (true, num1 = num2)); - ("= operator: " ^ title, fun _ -> Mt.Eq (true, num2 = num1)); - ("== operator: " ^ title, fun _ -> Mt.Eq (true, num1 == num2)); - ("== operator: " ^ title, fun _ -> Mt.Eq (true, num2 == num1)); - ] - -let five = bigint "5" - -(** Not comparing floats and Bigint; not sure this is correct since works in JavaScript*) -let suites : Mt.pair_suites = - isLessThan "123 and 555555" (bigint "123") (bigint "555555") - @ isEqual "98765 and 98765" (bigint "98765") (bigint "98765") - @ isEqual "same instance" five five - -let () = Mt.from_pair_suites __FILE__ suites diff --git a/jscomp/test/caml_compare_bigint_test.res b/jscomp/test/caml_compare_bigint_test.res new file mode 100644 index 0000000000..35ce340d43 --- /dev/null +++ b/jscomp/test/caml_compare_bigint_test.res @@ -0,0 +1,54 @@ +@val external bigint: string => float = "BigInt" + +let isLessThan = (title, small, big) => list{ + ("compare: " ++ title, _ => Mt.Eq(true, compare(big, small) > 0)), + ("compare: " ++ title, _ => Mt.Eq(true, compare(small, big) < 0)), + ("< operator: " ++ title, _ => Mt.Eq(true, small < big)), + ("<= operator: " ++ title, _ => Mt.Eq(true, small <= big)), + ("> operator: " ++ title, _ => Mt.Eq(true, big > small)), + (">= operator: " ++ title, _ => Mt.Eq(true, big >= small)), + ("min: " ++ title, _ => Mt.Eq(small, min(big, small))), + ("min: " ++ title, _ => Mt.Eq(small, min(small, big))), + ("max: " ++ title, _ => Mt.Eq(big, max(big, small))), + ("max: " ++ title, _ => Mt.Eq(big, max(small, big))), + ("!== operator: " ++ title, _ => Mt.Eq(true, big !== small)), + ("!== operator: " ++ title, _ => Mt.Eq(true, small !== big)), + ("!= operator: " ++ title, _ => Mt.Eq(true, big != small)), + ("!= operator: " ++ title, _ => Mt.Eq(true, small != big)), + ("== operator: " ++ title, _ => Mt.Eq(false, big == small)), + ("== operator: " ++ title, _ => Mt.Eq(false, small == big)), + ("=== operator: " ++ title, _ => Mt.Eq(false, big === small)), + ("=== operator: " ++ title, _ => Mt.Eq(false, small === big)), +} + +let isEqual = (title, num1, num2) => list{ + ("< operator: " ++ title, _ => Mt.Eq(false, num2 < num1)), + ("<= operator: " ++ title, _ => Mt.Eq(true, num2 <= num1)), + ("> operator: " ++ title, _ => Mt.Eq(false, num1 > num2)), + (">= operator: " ++ title, _ => Mt.Eq(true, num1 >= num2)), + ("min: " ++ title, _ => Mt.Eq(num1, min(num1, num2))), + ("max: " ++ title, _ => Mt.Eq(num1, max(num1, num2))), + ("compare: " ++ title, _ => Mt.Eq(0, compare(num1, num2))), + ("compare: " ++ title, _ => Mt.Eq(0, compare(num2, num1))), + ("!= operator: " ++ title, _ => Mt.Eq(false, num1 !== num2)), + ("!= operator: " ++ title, _ => Mt.Eq(false, num2 !== num1)), + ("!= operator: " ++ title, _ => Mt.Eq(false, num1 != num2)), + ("!= operator: " ++ title, _ => Mt.Eq(false, num2 != num1)), + ("== operator: " ++ title, _ => Mt.Eq(true, num1 == num2)), + ("== operator: " ++ title, _ => Mt.Eq(true, num2 == num1)), + ("=== operator: " ++ title, _ => Mt.Eq(true, num1 === num2)), + ("=== operator: " ++ title, _ => Mt.Eq(true, num2 === num1)), +} + +let five = bigint("5") + +@ocaml.doc(" Not comparing floats and Bigint; not sure this is correct since works in JavaScript") +let suites: Mt.pair_suites = \"@"( + isLessThan("123 and 555555", bigint("123"), bigint("555555")), + \"@"( + isEqual("98765 and 98765", bigint("98765"), bigint("98765")), + isEqual("same instance", five, five), + ), +) + +let () = Mt.from_pair_suites(__FILE__, suites) From 9bc88f1802edbc9acb040495d84410ac1fe6cc29 Mon Sep 17 00:00:00 2001 From: jmagaram Date: Sun, 26 Mar 2023 00:13:07 -0700 Subject: [PATCH 11/16] remove duplication in switch --- jscomp/runtime/caml_obj.res | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jscomp/runtime/caml_obj.res b/jscomp/runtime/caml_obj.res index 8d4f059f34..4509cad589 100644 --- a/jscomp/runtime/caml_obj.res +++ b/jscomp/runtime/caml_obj.res @@ -152,8 +152,9 @@ let rec compare = (a: Obj.t, b: Obj.t): int => | ("function", "function") => raise(Invalid_argument("compare: functional value")) | ("function", _) => 1 | (_, "function") => -1 - | ("bigint", "bigint") => Pervasives.compare((Obj.magic(a): float), (Obj.magic(b): float)) - | ("number", "number") => Pervasives.compare((Obj.magic(a): float), (Obj.magic(b): float)) + | ("bigint", "bigint") + | ("number", "number") => + Pervasives.compare((Obj.magic(a): float), (Obj.magic(b): float)) | ("bigint", _) | ("number", _) => if b === Obj.repr(Js.null) || Caml_option.isNested(b) { 1 From 7af0ef4bbdba530365d3d3f36a622103c3c3bf85 Mon Sep 17 00:00:00 2001 From: jmagaram Date: Sun, 26 Mar 2023 00:29:19 -0700 Subject: [PATCH 12/16] rename to @res.doc --- jscomp/runtime/caml_obj.res | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jscomp/runtime/caml_obj.res b/jscomp/runtime/caml_obj.res index 4509cad589..3207902648 100644 --- a/jscomp/runtime/caml_obj.res +++ b/jscomp/runtime/caml_obj.res @@ -87,7 +87,7 @@ let obj_dup: Obj.t => Obj.t = %raw(`function(x){ return Object.assign({},x) }`) -@ocaml.doc(" +@res.doc(" For the empty dummy object, whether it's [[]] or [{}] depends on how runtime encoding works, and will affect From 7d2dacc7a0aea95a799fccff8abaf944f01a417a Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Sun, 26 Mar 2023 09:35:05 +0200 Subject: [PATCH 13/16] Teach the custom command for ninja to build .res files The lib is built in a custom way because of... historical reasons and complications left in there. --- jscomp/runtime/release.ninja | 4 +++- scripts/ninja.js | 10 ++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/jscomp/runtime/release.ninja b/jscomp/runtime/release.ninja index da5360e78f..36ec0ef5aa 100644 --- a/jscomp/runtime/release.ninja +++ b/jscomp/runtime/release.ninja @@ -37,6 +37,8 @@ o runtime/caml_md5.cmj : cc_cmi runtime/caml_md5.ml | runtime/caml_array_extern. o runtime/caml_md5.cmi : cc runtime/caml_md5.mli | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_module.cmj : cc_cmi runtime/caml_module.ml | runtime/caml_array_extern.cmj runtime/caml_module.cmi runtime/caml_obj.cmj o runtime/caml_module.cmi : cc runtime/caml_module.mli | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj +o runtime/caml_obj.cmj : cc_cmi runtime/caml_obj.res | runtime/caml.cmj runtime/caml_array_extern.cmj runtime/caml_obj.cmi runtime/caml_option.cmj runtime/js.cmj +o runtime/caml_obj.cmi : cc runtime/caml_obj.resi | runtime/js.cmj o runtime/caml_option.cmj : cc_cmi runtime/caml_option.ml | runtime/caml_option.cmi runtime/caml_undefined_extern.cmj runtime/js.cmj o runtime/caml_option.cmi : cc runtime/caml_option.mli | runtime/bs_stdlib_mini.cmi runtime/caml_undefined_extern.cmj runtime/js.cmi runtime/js.cmj o runtime/caml_parser.cmj : cc_cmi runtime/caml_parser.ml | runtime/caml_parser.cmi @@ -57,4 +59,4 @@ o runtime/caml_nativeint_extern.cmi runtime/caml_nativeint_extern.cmj : cc runti o runtime/caml_string_extern.cmi runtime/caml_string_extern.cmj : cc runtime/caml_string_extern.ml | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_undefined_extern.cmi runtime/caml_undefined_extern.cmj : cc runtime/caml_undefined_extern.ml | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/curry.cmi runtime/curry.cmj : cc runtime/curry.ml | runtime/bs_stdlib_mini.cmi runtime/caml_array.cmj runtime/caml_array_extern.cmj runtime/js.cmi runtime/js.cmj -o runtime : phony runtime/bs_stdlib_mini.cmi runtime/js.cmj runtime/js.cmi runtime/caml.cmi runtime/caml.cmj runtime/caml_array.cmi runtime/caml_array.cmj runtime/caml_bytes.cmi runtime/caml_bytes.cmj runtime/caml_float.cmi runtime/caml_float.cmj runtime/caml_format.cmi runtime/caml_format.cmj runtime/caml_hash.cmi runtime/caml_hash.cmj runtime/caml_hash_primitive.cmi runtime/caml_hash_primitive.cmj runtime/caml_int32.cmi runtime/caml_int32.cmj runtime/caml_int64.cmi runtime/caml_int64.cmj runtime/caml_lexer.cmi runtime/caml_lexer.cmj runtime/caml_md5.cmi runtime/caml_md5.cmj runtime/caml_module.cmi runtime/caml_module.cmj runtime/caml_option.cmi runtime/caml_option.cmj runtime/caml_parser.cmi runtime/caml_parser.cmj runtime/caml_splice_call.cmi runtime/caml_splice_call.cmj runtime/caml_string.cmi runtime/caml_string.cmj runtime/caml_sys.cmi runtime/caml_sys.cmj runtime/caml_array_extern.cmi runtime/caml_array_extern.cmj runtime/caml_exceptions.cmi runtime/caml_exceptions.cmj runtime/caml_external_polyfill.cmi runtime/caml_external_polyfill.cmj runtime/caml_float_extern.cmi runtime/caml_float_extern.cmj runtime/caml_int64_extern.cmi runtime/caml_int64_extern.cmj runtime/caml_js_exceptions.cmi runtime/caml_js_exceptions.cmj runtime/caml_nativeint_extern.cmi runtime/caml_nativeint_extern.cmj runtime/caml_string_extern.cmi runtime/caml_string_extern.cmj runtime/caml_undefined_extern.cmi runtime/caml_undefined_extern.cmj runtime/curry.cmi runtime/curry.cmj +o runtime : phony runtime/bs_stdlib_mini.cmi runtime/js.cmj runtime/js.cmi runtime/caml.cmi runtime/caml.cmj runtime/caml_array.cmi runtime/caml_array.cmj runtime/caml_bytes.cmi runtime/caml_bytes.cmj runtime/caml_float.cmi runtime/caml_float.cmj runtime/caml_format.cmi runtime/caml_format.cmj runtime/caml_hash.cmi runtime/caml_hash.cmj runtime/caml_hash_primitive.cmi runtime/caml_hash_primitive.cmj runtime/caml_int32.cmi runtime/caml_int32.cmj runtime/caml_int64.cmi runtime/caml_int64.cmj runtime/caml_lexer.cmi runtime/caml_lexer.cmj runtime/caml_md5.cmi runtime/caml_md5.cmj runtime/caml_module.cmi runtime/caml_module.cmj runtime/caml_obj.cmi runtime/caml_obj.cmj runtime/caml_option.cmi runtime/caml_option.cmj runtime/caml_parser.cmi runtime/caml_parser.cmj runtime/caml_splice_call.cmi runtime/caml_splice_call.cmj runtime/caml_string.cmi runtime/caml_string.cmj runtime/caml_sys.cmi runtime/caml_sys.cmj runtime/caml_array_extern.cmi runtime/caml_array_extern.cmj runtime/caml_exceptions.cmi runtime/caml_exceptions.cmj runtime/caml_external_polyfill.cmi runtime/caml_external_polyfill.cmj runtime/caml_float_extern.cmi runtime/caml_float_extern.cmj runtime/caml_int64_extern.cmi runtime/caml_int64_extern.cmj runtime/caml_js_exceptions.cmi runtime/caml_js_exceptions.cmj runtime/caml_nativeint_extern.cmi runtime/caml_nativeint_extern.cmj runtime/caml_string_extern.cmi runtime/caml_string_extern.cmj runtime/caml_undefined_extern.cmi runtime/caml_undefined_extern.cmj runtime/curry.cmi runtime/curry.cmj diff --git a/scripts/ninja.js b/scripts/ninja.js index c51965b26a..656d3a9bd0 100755 --- a/scripts/ninja.js +++ b/scripts/ninja.js @@ -17,10 +17,16 @@ var duneBinDir = require("./dune").duneBinDir; var runtimeFiles = fs.readdirSync(runtimeDir, "ascii"); var runtimeMlFiles = runtimeFiles.filter( - x => !x.startsWith("bs_stdlib_mini") && x.endsWith(".ml") && x !== "js.ml" + x => + !x.startsWith("bs_stdlib_mini") && + (x.endsWith(".ml") || x.endsWith(".res")) && + x !== "js.ml" ); var runtimeMliFiles = runtimeFiles.filter( - x => !x.startsWith("bs_stdlib_mini") && x.endsWith(".mli") && x !== "js.mli" + x => + !x.startsWith("bs_stdlib_mini") && + (x.endsWith(".mli") || x.endsWith(".resi")) && + x !== "js.mli" ); var runtimeSourceFiles = runtimeMlFiles.concat(runtimeMliFiles); var runtimeJsFiles = [...new Set(runtimeSourceFiles.map(baseName))]; From e1c630895e687c636deb8c466e60dae677b3b567 Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Sun, 26 Mar 2023 09:37:40 +0200 Subject: [PATCH 14/16] remove big change --- jscomp/runtime/caml_obj.res | 4 +- lib/es6/caml_obj.js | 241 ++++++++++++++++-------------------- lib/js/caml_obj.js | 241 ++++++++++++++++-------------------- 3 files changed, 220 insertions(+), 266 deletions(-) diff --git a/jscomp/runtime/caml_obj.res b/jscomp/runtime/caml_obj.res index 3207902648..706042a35c 100644 --- a/jscomp/runtime/caml_obj.res +++ b/jscomp/runtime/caml_obj.res @@ -155,14 +155,14 @@ let rec compare = (a: Obj.t, b: Obj.t): int => | ("bigint", "bigint") | ("number", "number") => Pervasives.compare((Obj.magic(a): float), (Obj.magic(b): float)) - | ("bigint", _) | ("number", _) => + | ("number", _) => if b === Obj.repr(Js.null) || Caml_option.isNested(b) { 1 } else { /* Some (Some ..) < x */ -1 } /* Integer < Block in OCaml runtime GPR #1195, except Some.. */ - | (_, "bigint") | (_, "number") => + | (_, "number") => if a === Obj.repr(Js.null) || Caml_option.isNested(a) { -1 } else { diff --git a/lib/es6/caml_obj.js b/lib/es6/caml_obj.js index c6c0d97911..57e5265b02 100644 --- a/lib/es6/caml_obj.js +++ b/lib/es6/caml_obj.js @@ -42,20 +42,16 @@ function compare(a, b) { } var a_type = typeof a; var b_type = typeof b; - var exit = 0; - var exit$1 = 0; switch (a_type) { case "bigint" : if (b_type === "bigint") { return Caml.float_compare(a, b); } - exit$1 = 3; break; case "boolean" : if (b_type === "boolean") { return Caml.bool_compare(a, b); } - exit$1 = 3; break; case "function" : if (b_type === "function") { @@ -65,13 +61,11 @@ function compare(a, b) { Error: new Error() }; } - exit$1 = 3; break; case "number" : if (b_type === "number") { return Caml.float_compare(a, b); } - exit$1 = 3; break; case "string" : if (b_type === "string") { @@ -82,148 +76,131 @@ function compare(a, b) { case "undefined" : return -1; default: - exit$1 = 3; + } - if (exit$1 === 3) { - switch (b_type) { - case "string" : - return -1; - case "undefined" : - return 1; - default: - if (a_type === "boolean") { + switch (b_type) { + case "string" : + return -1; + case "undefined" : + return 1; + default: + if (a_type === "boolean") { + return 1; + } + if (b_type === "boolean") { + return -1; + } + if (a_type === "function") { + return 1; + } + if (b_type === "function") { + return -1; + } + if (a_type === "number") { + if (b === null || b.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { return 1; - } - if (b_type === "boolean") { + } else { return -1; } - if (a_type === "function") { + } + if (b_type === "number") { + if (a === null || a.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { + return -1; + } else { return 1; } - if (b_type === "function") { + } + if (a === null) { + if (b.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { + return 1; + } else { return -1; } - switch (a_type) { - case "bigint" : - case "number" : - exit = 1; - break; - default: - switch (b_type) { - case "bigint" : - case "number" : - exit = 2; - break; - default: - if (a === null) { - if (b.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { - return 1; - } else { - return -1; - } - } - if (b === null) { - if (a.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { - return -1; - } else { - return 1; - } - } - if (a.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { - if (b.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { - return aux_obj_compare(a, b); - } else { - return -1; - } - } - var tag_a = a.TAG; - var tag_b = b.TAG; - if (tag_a === 248) { - return Caml.int_compare(a[1], b[1]); - } - if (tag_a === 251) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "equal: abstract value", - Error: new Error() - }; - } - if (tag_a !== tag_b) { - if (tag_a < tag_b) { - return -1; - } else { - return 1; - } - } - var len_a = a.length | 0; - var len_b = b.length | 0; - if (len_a === len_b) { - if (Array.isArray(a)) { - var _i = 0; - while(true) { - var i = _i; - if (i === len_a) { - return 0; - } - var res = compare(a[i], b[i]); - if (res !== 0) { - return res; - } - _i = i + 1 | 0; - continue ; - }; - } else if ((a instanceof Date && b instanceof Date)) { - return (a - b); - } else { - return aux_obj_compare(a, b); - } - } else if (len_a < len_b) { - var _i$1 = 0; - while(true) { - var i$1 = _i$1; - if (i$1 === len_a) { - return -1; - } - var res$1 = compare(a[i$1], b[i$1]); - if (res$1 !== 0) { - return res$1; - } - _i$1 = i$1 + 1 | 0; - continue ; - }; - } else { - var _i$2 = 0; - while(true) { - var i$2 = _i$2; - if (i$2 === len_b) { - return 1; - } - var res$2 = compare(a[i$2], b[i$2]); - if (res$2 !== 0) { - return res$2; - } - _i$2 = i$2 + 1 | 0; - continue ; - }; - } - } - } - } - } - switch (exit) { - case 1 : - if (b === null || b.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { + } + if (b === null) { + if (a.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { + return -1; + } else { return 1; + } + } + if (a.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { + if (b.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { + return aux_obj_compare(a, b); } else { return -1; } - case 2 : - if (a === null || a.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { + } + var tag_a = a.TAG; + var tag_b = b.TAG; + if (tag_a === 248) { + return Caml.int_compare(a[1], b[1]); + } + if (tag_a === 251) { + throw { + RE_EXN_ID: "Invalid_argument", + _1: "equal: abstract value", + Error: new Error() + }; + } + if (tag_a !== tag_b) { + if (tag_a < tag_b) { return -1; } else { return 1; } - + } + var len_a = a.length | 0; + var len_b = b.length | 0; + if (len_a === len_b) { + if (Array.isArray(a)) { + var _i = 0; + while(true) { + var i = _i; + if (i === len_a) { + return 0; + } + var res = compare(a[i], b[i]); + if (res !== 0) { + return res; + } + _i = i + 1 | 0; + continue ; + }; + } else if ((a instanceof Date && b instanceof Date)) { + return (a - b); + } else { + return aux_obj_compare(a, b); + } + } else if (len_a < len_b) { + var _i$1 = 0; + while(true) { + var i$1 = _i$1; + if (i$1 === len_a) { + return -1; + } + var res$1 = compare(a[i$1], b[i$1]); + if (res$1 !== 0) { + return res$1; + } + _i$1 = i$1 + 1 | 0; + continue ; + }; + } else { + var _i$2 = 0; + while(true) { + var i$2 = _i$2; + if (i$2 === len_b) { + return 1; + } + var res$2 = compare(a[i$2], b[i$2]); + if (res$2 !== 0) { + return res$2; + } + _i$2 = i$2 + 1 | 0; + continue ; + }; + } } } diff --git a/lib/js/caml_obj.js b/lib/js/caml_obj.js index 161a5bc821..163c700872 100644 --- a/lib/js/caml_obj.js +++ b/lib/js/caml_obj.js @@ -42,20 +42,16 @@ function compare(a, b) { } var a_type = typeof a; var b_type = typeof b; - var exit = 0; - var exit$1 = 0; switch (a_type) { case "bigint" : if (b_type === "bigint") { return Caml.float_compare(a, b); } - exit$1 = 3; break; case "boolean" : if (b_type === "boolean") { return Caml.bool_compare(a, b); } - exit$1 = 3; break; case "function" : if (b_type === "function") { @@ -65,13 +61,11 @@ function compare(a, b) { Error: new Error() }; } - exit$1 = 3; break; case "number" : if (b_type === "number") { return Caml.float_compare(a, b); } - exit$1 = 3; break; case "string" : if (b_type === "string") { @@ -82,148 +76,131 @@ function compare(a, b) { case "undefined" : return -1; default: - exit$1 = 3; + } - if (exit$1 === 3) { - switch (b_type) { - case "string" : - return -1; - case "undefined" : - return 1; - default: - if (a_type === "boolean") { + switch (b_type) { + case "string" : + return -1; + case "undefined" : + return 1; + default: + if (a_type === "boolean") { + return 1; + } + if (b_type === "boolean") { + return -1; + } + if (a_type === "function") { + return 1; + } + if (b_type === "function") { + return -1; + } + if (a_type === "number") { + if (b === null || b.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { return 1; - } - if (b_type === "boolean") { + } else { return -1; } - if (a_type === "function") { + } + if (b_type === "number") { + if (a === null || a.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { + return -1; + } else { return 1; } - if (b_type === "function") { + } + if (a === null) { + if (b.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { + return 1; + } else { return -1; } - switch (a_type) { - case "bigint" : - case "number" : - exit = 1; - break; - default: - switch (b_type) { - case "bigint" : - case "number" : - exit = 2; - break; - default: - if (a === null) { - if (b.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { - return 1; - } else { - return -1; - } - } - if (b === null) { - if (a.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { - return -1; - } else { - return 1; - } - } - if (a.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { - if (b.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { - return aux_obj_compare(a, b); - } else { - return -1; - } - } - var tag_a = a.TAG; - var tag_b = b.TAG; - if (tag_a === 248) { - return Caml.int_compare(a[1], b[1]); - } - if (tag_a === 251) { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "equal: abstract value", - Error: new Error() - }; - } - if (tag_a !== tag_b) { - if (tag_a < tag_b) { - return -1; - } else { - return 1; - } - } - var len_a = a.length | 0; - var len_b = b.length | 0; - if (len_a === len_b) { - if (Array.isArray(a)) { - var _i = 0; - while(true) { - var i = _i; - if (i === len_a) { - return 0; - } - var res = compare(a[i], b[i]); - if (res !== 0) { - return res; - } - _i = i + 1 | 0; - continue ; - }; - } else if ((a instanceof Date && b instanceof Date)) { - return (a - b); - } else { - return aux_obj_compare(a, b); - } - } else if (len_a < len_b) { - var _i$1 = 0; - while(true) { - var i$1 = _i$1; - if (i$1 === len_a) { - return -1; - } - var res$1 = compare(a[i$1], b[i$1]); - if (res$1 !== 0) { - return res$1; - } - _i$1 = i$1 + 1 | 0; - continue ; - }; - } else { - var _i$2 = 0; - while(true) { - var i$2 = _i$2; - if (i$2 === len_b) { - return 1; - } - var res$2 = compare(a[i$2], b[i$2]); - if (res$2 !== 0) { - return res$2; - } - _i$2 = i$2 + 1 | 0; - continue ; - }; - } - } - } - } - } - switch (exit) { - case 1 : - if (b === null || b.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { + } + if (b === null) { + if (a.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { + return -1; + } else { return 1; + } + } + if (a.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { + if (b.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { + return aux_obj_compare(a, b); } else { return -1; } - case 2 : - if (a === null || a.BS_PRIVATE_NESTED_SOME_NONE !== undefined) { + } + var tag_a = a.TAG; + var tag_b = b.TAG; + if (tag_a === 248) { + return Caml.int_compare(a[1], b[1]); + } + if (tag_a === 251) { + throw { + RE_EXN_ID: "Invalid_argument", + _1: "equal: abstract value", + Error: new Error() + }; + } + if (tag_a !== tag_b) { + if (tag_a < tag_b) { return -1; } else { return 1; } - + } + var len_a = a.length | 0; + var len_b = b.length | 0; + if (len_a === len_b) { + if (Array.isArray(a)) { + var _i = 0; + while(true) { + var i = _i; + if (i === len_a) { + return 0; + } + var res = compare(a[i], b[i]); + if (res !== 0) { + return res; + } + _i = i + 1 | 0; + continue ; + }; + } else if ((a instanceof Date && b instanceof Date)) { + return (a - b); + } else { + return aux_obj_compare(a, b); + } + } else if (len_a < len_b) { + var _i$1 = 0; + while(true) { + var i$1 = _i$1; + if (i$1 === len_a) { + return -1; + } + var res$1 = compare(a[i$1], b[i$1]); + if (res$1 !== 0) { + return res$1; + } + _i$1 = i$1 + 1 | 0; + continue ; + }; + } else { + var _i$2 = 0; + while(true) { + var i$2 = _i$2; + if (i$2 === len_b) { + return 1; + } + var res$2 = compare(a[i$2], b[i$2]); + if (res$2 !== 0) { + return res$2; + } + _i$2 = i$2 + 1 | 0; + continue ; + }; + } } } From 2676f21d49f6e7567e585c00f3e1c3a7efc0107b Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Sun, 26 Mar 2023 09:41:36 +0200 Subject: [PATCH 15/16] inline --- jscomp/runtime/caml_obj.res | 6 ++++-- lib/es6/caml_obj.js | 26 +++++--------------------- lib/js/caml_obj.js | 26 +++++--------------------- 3 files changed, 14 insertions(+), 44 deletions(-) diff --git a/jscomp/runtime/caml_obj.res b/jscomp/runtime/caml_obj.res index 706042a35c..0064d4da2f 100644 --- a/jscomp/runtime/caml_obj.res +++ b/jscomp/runtime/caml_obj.res @@ -87,14 +87,14 @@ let obj_dup: Obj.t => Obj.t = %raw(`function(x){ return Object.assign({},x) }`) -@res.doc(" +/** For the empty dummy object, whether it's [[]] or [{}] depends on how runtime encoding works, and will affect js polymorphic comparison(Js.(=)) (fine with caml polymoprhic comparison (Pervasives.equal)) In most cases, rec value comes from record/modules, whose tag is 0, we optimize that case -") +*/ let update_dummy: (_, _) => unit = %raw(`function(x,y){ var k if(Array.isArray(y)){ @@ -401,8 +401,10 @@ let equal_nullable = (x: Obj.t, y: Js.nullable) => | Some(y) => equal(x, y) } +@inline let isNumberOrBigInt = a => Js.typeof(a) == "number" || Js.typeof(a) == "bigint" +@inline let canNumericCompare = (a, b) => isNumberOrBigInt(a) && isNumberOrBigInt(b) let notequal = (a, b) => diff --git a/lib/es6/caml_obj.js b/lib/es6/caml_obj.js index 57e5265b02..786e24a71a 100644 --- a/lib/es6/caml_obj.js +++ b/lib/es6/caml_obj.js @@ -363,24 +363,8 @@ function equal_nullable(x, y) { } } -function isNumberOrBigInt(a) { - if (typeof a === "number") { - return true; - } else { - return typeof a === "bigint"; - } -} - -function canNumericCompare(a, b) { - if (isNumberOrBigInt(a)) { - return isNumberOrBigInt(b); - } else { - return false; - } -} - function notequal(a, b) { - if (canNumericCompare(a, b)) { + if ((typeof a === "number" || typeof a === "bigint") && (typeof b === "number" || typeof b === "bigint")) { return a !== b; } else { return !equal(a, b); @@ -388,7 +372,7 @@ function notequal(a, b) { } function greaterequal(a, b) { - if (canNumericCompare(a, b)) { + if ((typeof a === "number" || typeof a === "bigint") && (typeof b === "number" || typeof b === "bigint")) { return a >= b; } else { return compare(a, b) >= 0; @@ -396,7 +380,7 @@ function greaterequal(a, b) { } function greaterthan(a, b) { - if (canNumericCompare(a, b)) { + if ((typeof a === "number" || typeof a === "bigint") && (typeof b === "number" || typeof b === "bigint")) { return a > b; } else { return compare(a, b) > 0; @@ -404,7 +388,7 @@ function greaterthan(a, b) { } function lessequal(a, b) { - if (canNumericCompare(a, b)) { + if ((typeof a === "number" || typeof a === "bigint") && (typeof b === "number" || typeof b === "bigint")) { return a <= b; } else { return compare(a, b) <= 0; @@ -412,7 +396,7 @@ function lessequal(a, b) { } function lessthan(a, b) { - if (canNumericCompare(a, b)) { + if ((typeof a === "number" || typeof a === "bigint") && (typeof b === "number" || typeof b === "bigint")) { return a < b; } else { return compare(a, b) < 0; diff --git a/lib/js/caml_obj.js b/lib/js/caml_obj.js index 163c700872..c429ee8578 100644 --- a/lib/js/caml_obj.js +++ b/lib/js/caml_obj.js @@ -363,24 +363,8 @@ function equal_nullable(x, y) { } } -function isNumberOrBigInt(a) { - if (typeof a === "number") { - return true; - } else { - return typeof a === "bigint"; - } -} - -function canNumericCompare(a, b) { - if (isNumberOrBigInt(a)) { - return isNumberOrBigInt(b); - } else { - return false; - } -} - function notequal(a, b) { - if (canNumericCompare(a, b)) { + if ((typeof a === "number" || typeof a === "bigint") && (typeof b === "number" || typeof b === "bigint")) { return a !== b; } else { return !equal(a, b); @@ -388,7 +372,7 @@ function notequal(a, b) { } function greaterequal(a, b) { - if (canNumericCompare(a, b)) { + if ((typeof a === "number" || typeof a === "bigint") && (typeof b === "number" || typeof b === "bigint")) { return a >= b; } else { return compare(a, b) >= 0; @@ -396,7 +380,7 @@ function greaterequal(a, b) { } function greaterthan(a, b) { - if (canNumericCompare(a, b)) { + if ((typeof a === "number" || typeof a === "bigint") && (typeof b === "number" || typeof b === "bigint")) { return a > b; } else { return compare(a, b) > 0; @@ -404,7 +388,7 @@ function greaterthan(a, b) { } function lessequal(a, b) { - if (canNumericCompare(a, b)) { + if ((typeof a === "number" || typeof a === "bigint") && (typeof b === "number" || typeof b === "bigint")) { return a <= b; } else { return compare(a, b) <= 0; @@ -412,7 +396,7 @@ function lessequal(a, b) { } function lessthan(a, b) { - if (canNumericCompare(a, b)) { + if ((typeof a === "number" || typeof a === "bigint") && (typeof b === "number" || typeof b === "bigint")) { return a < b; } else { return compare(a, b) < 0; From 653e7aa359628a4b81e141b512dfcf3c9462a70b Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Sun, 26 Mar 2023 09:45:40 +0200 Subject: [PATCH 16/16] Convert the old test too. --- jscomp/test/build.ninja | 2 +- jscomp/test/caml_compare_test.js | 48 ++++++------ jscomp/test/caml_compare_test.ml | 118 ------------------------------ jscomp/test/caml_compare_test.res | 93 +++++++++++++++++++++++ 4 files changed, 118 insertions(+), 143 deletions(-) delete mode 100644 jscomp/test/caml_compare_test.ml create mode 100644 jscomp/test/caml_compare_test.res diff --git a/jscomp/test/build.ninja b/jscomp/test/build.ninja index adaf1ab2fe..81575a238e 100644 --- a/jscomp/test/build.ninja +++ b/jscomp/test/build.ninja @@ -110,7 +110,7 @@ o test/bs_unwrap_test.cmi test/bs_unwrap_test.cmj : cc test/bs_unwrap_test.ml | o test/buffer_test.cmi test/buffer_test.cmj : cc test/buffer_test.ml | test/mt.cmj $bsc $stdlib runtime o test/bytes_split_gpr_743_test.cmi test/bytes_split_gpr_743_test.cmj : cc test/bytes_split_gpr_743_test.ml | test/mt.cmj $bsc $stdlib runtime o test/caml_compare_bigint_test.cmi test/caml_compare_bigint_test.cmj : cc test/caml_compare_bigint_test.res | test/mt.cmj $bsc $stdlib runtime -o test/caml_compare_test.cmi test/caml_compare_test.cmj : cc test/caml_compare_test.ml | test/mt.cmj $bsc $stdlib runtime +o test/caml_compare_test.cmi test/caml_compare_test.cmj : cc test/caml_compare_test.res | test/mt.cmj $bsc $stdlib runtime o test/caml_format_test.cmi test/caml_format_test.cmj : cc test/caml_format_test.res | test/mt.cmj $bsc $stdlib runtime o test/caml_sys_poly_fill_test.cmi test/caml_sys_poly_fill_test.cmj : cc test/caml_sys_poly_fill_test.ml | test/mt.cmj $bsc $stdlib runtime o test/chain_code_test.cmi test/chain_code_test.cmj : cc test/chain_code_test.ml | test/mt.cmj $bsc $stdlib runtime diff --git a/jscomp/test/caml_compare_test.js b/jscomp/test/caml_compare_test.js index 8ab709c534..dfb7e9ac7a 100644 --- a/jscomp/test/caml_compare_test.js +++ b/jscomp/test/caml_compare_test.js @@ -21,7 +21,7 @@ catch (raw_exn){ var suites = { contents: { hd: [ - "File \"caml_compare_test.ml\", line 9, characters 4-11", + "File \"caml_compare_test.res\", line 12, characters 5-12", (function (param) { return { TAG: "Eq", @@ -43,7 +43,7 @@ var suites = { ], tl: { hd: [ - "File \"caml_compare_test.ml\", line 11, characters 4-11", + "File \"caml_compare_test.res\", line 14, characters 5-12", (function (param) { return { TAG: "Eq", @@ -204,7 +204,7 @@ var suites = { ], tl: { hd: [ - "File \"caml_compare_test.ml\", line 17, characters 4-11", + "File \"caml_compare_test.res\", line 20, characters 5-12", (function (param) { return { TAG: "Eq", @@ -215,7 +215,7 @@ var suites = { ], tl: { hd: [ - "File \"caml_compare_test.ml\", line 28, characters 4-11", + "File \"caml_compare_test.res\", line 21, characters 5-12", (function (param) { return { TAG: "Eq", @@ -229,7 +229,7 @@ var suites = { ], tl: { hd: [ - "File \"caml_compare_test.ml\", line 31, characters 4-11", + "File \"caml_compare_test.res\", line 22, characters 5-12", (function (param) { return { TAG: "Eq", @@ -243,7 +243,7 @@ var suites = { ], tl: { hd: [ - "File \"caml_compare_test.ml\", line 34, characters 4-11", + "File \"caml_compare_test.res\", line 24, characters 6-13", (function (param) { return { TAG: "Eq", @@ -311,7 +311,7 @@ var suites = { ], tl: { hd: [ - "File \"caml_compare_test.ml\", line 37, characters 4-11", + "File \"caml_compare_test.res\", line 27, characters 5-12", (function (param) { return { TAG: "Eq", @@ -331,7 +331,7 @@ var suites = { ], tl: { hd: [ - "File \"caml_compare_test.ml\", line 40, characters 4-11", + "File \"caml_compare_test.res\", line 28, characters 5-12", (function (param) { return { TAG: "Eq", @@ -345,7 +345,7 @@ var suites = { ], tl: { hd: [ - "File \"caml_compare_test.ml\", line 43, characters 4-11", + "File \"caml_compare_test.res\", line 30, characters 6-13", (function (param) { return { TAG: "Eq", @@ -413,7 +413,7 @@ var suites = { ], tl: { hd: [ - "File \"caml_compare_test.ml\", line 47, characters 4-11", + "File \"caml_compare_test.res\", line 33, characters 5-12", (function (param) { return { TAG: "Eq", @@ -424,7 +424,7 @@ var suites = { ], tl: { hd: [ - "File \"caml_compare_test.ml\", line 50, characters 4-11", + "File \"caml_compare_test.res\", line 34, characters 5-12", (function (param) { return { TAG: "Eq", @@ -435,7 +435,7 @@ var suites = { ], tl: { hd: [ - "File \"caml_compare_test.ml\", line 53, characters 4-11", + "File \"caml_compare_test.res\", line 36, characters 6-13", (function (param) { return { TAG: "Eq", @@ -503,7 +503,7 @@ var suites = { ], tl: { hd: [ - "File \"caml_compare_test.ml\", line 56, characters 4-11", + "File \"caml_compare_test.res\", line 40, characters 6-13", (function (param) { return { TAG: "Eq", @@ -998,7 +998,7 @@ var suites = { ], tl: { hd: [ - "File \"caml_compare_test.ml\", line 88, characters 4-11", + "File \"caml_compare_test.res\", line 76, characters 5-12", (function (param) { return { TAG: "Eq", @@ -1012,7 +1012,7 @@ var suites = { ], tl: { hd: [ - "File \"caml_compare_test.ml\", line 91, characters 4-11", + "File \"caml_compare_test.res\", line 77, characters 5-12", (function (param) { return { TAG: "Eq", @@ -1026,7 +1026,7 @@ var suites = { ], tl: { hd: [ - "File \"caml_compare_test.ml\", line 94, characters 4-11", + "File \"caml_compare_test.res\", line 78, characters 5-12", (function (param) { return { TAG: "Eq", @@ -1037,7 +1037,7 @@ var suites = { ], tl: { hd: [ - "File \"caml_compare_test.ml\", line 97, characters 4-11", + "File \"caml_compare_test.res\", line 79, characters 5-12", (function (param) { return { TAG: "Eq", @@ -1048,7 +1048,7 @@ var suites = { ], tl: { hd: [ - "File \"caml_compare_test.ml\", line 100, characters 4-11", + "File \"caml_compare_test.res\", line 80, characters 5-12", (function (param) { return { TAG: "Eq", @@ -1059,7 +1059,7 @@ var suites = { ], tl: { hd: [ - "File \"caml_compare_test.ml\", line 103, characters 4-11", + "File \"caml_compare_test.res\", line 81, characters 5-12", (function (param) { return { TAG: "Eq", @@ -1131,21 +1131,21 @@ function eq(loc, x, y) { Mt.eq_suites(test_id, suites, loc, x, y); } -eq("File \"caml_compare_test.ml\", line 113, characters 6-13", true, Caml_obj.greaterthan(1, undefined)); +eq("File \"caml_compare_test.res\", line 88, characters 3-10", true, Caml_obj.greaterthan(1, undefined)); -eq("File \"caml_compare_test.ml\", line 114, characters 6-13", true, Caml_obj.lessthan(/* [] */0, { +eq("File \"caml_compare_test.res\", line 89, characters 3-10", true, Caml_obj.lessthan(/* [] */0, { hd: 1, tl: /* [] */0 })); -eq("File \"caml_compare_test.ml\", line 115, characters 6-13", false, Caml_obj.greaterthan(undefined, 1)); +eq("File \"caml_compare_test.res\", line 90, characters 3-10", false, Caml_obj.greaterthan(undefined, 1)); -eq("File \"caml_compare_test.ml\", line 116, characters 6-13", false, Caml_obj.greaterthan(undefined, [ +eq("File \"caml_compare_test.res\", line 91, characters 3-10", false, Caml_obj.greaterthan(undefined, [ 1, 30 ])); -eq("File \"caml_compare_test.ml\", line 117, characters 6-13", false, Caml_obj.lessthan([ +eq("File \"caml_compare_test.res\", line 92, characters 3-10", false, Caml_obj.lessthan([ 1, 30 ], undefined)); diff --git a/jscomp/test/caml_compare_test.ml b/jscomp/test/caml_compare_test.ml deleted file mode 100644 index 7ce33a37a7..0000000000 --- a/jscomp/test/caml_compare_test.ml +++ /dev/null @@ -1,118 +0,0 @@ -[@@@warning "-45"] -type u = A of int | B of int * bool | C of int - -let function_equal_test = try ((fun x -> x + 1) = (fun x -> x + 2)) with - | Invalid_argument "equal: functional value" -> true - | _ -> false - -let suites = ref Mt.[ - __LOC__ , (fun _ -> Eq(true, None < Some 1)); - "option2", (fun _ -> Eq(true, Some 1 < Some 2)); - __LOC__, (fun _ -> Eq(true, [1] > [])); - "listeq", (fun _ -> Eq(true, [1;2;3] = [1;2;3])); - "listneq", (fun _ -> Eq(true, [1;2;3] > [1;2;2])); - "custom_u", (fun _ -> Eq(true, ( A 3 , B (2,false) , C 1) > ( A 3, B (2,false) , C 0 ))); - "custom_u2", (fun _ -> Eq(true, ( A 3 , B (2,false) , C 1) = ( A 3, B (2,false) , C 1 ))); - "function", (fun _ -> Eq(true, function_equal_test)); - __LOC__ , begin fun _ -> - Eq(true, None < Some 1) - end; - (*JS WAT - {[ - 0 < [1] - true - 0 < [1,30] - false - ]} - *) - __LOC__, begin fun _ -> - Eq(true, None < Some [|1;30|] ) - end; - __LOC__, begin fun _ -> - Eq(true, Some [|1;30|] > None ) - end; - __LOC__ , begin fun _ -> - Eq(true, [2;6;1;1;2;1;4;2;1] < [2;6;1;1;2;1;4;2;1;409]) - end; - __LOC__ , begin fun _ -> - Eq(true, [1] < [1;409]) - end; - __LOC__ , begin fun _ -> - Eq(true, [] < [409]) - end; - __LOC__ , begin fun _ -> - Eq(true, [2;6;1;1;2;1;4;2;1;409] > [2;6;1;1;2;1;4;2;1]) - end; - - __LOC__, begin fun _ -> - Eq(false, None = Some [|1;30|] ) - end; - __LOC__, begin fun _ -> - Eq(false, Some [|1;30|] = None ) - end; - __LOC__ , begin fun _ -> - Eq(false, [2;6;1;1;2;1;4;2;1] = [2;6;1;1;2;1;4;2;1;409]) - end; - __LOC__ , begin fun _ -> - Eq(false, [2;6;1;1;2;1;4;2;1;409] = [2;6;1;1;2;1;4;2;1]) - end; - - "cmp_id", (fun _ -> Eq (compare [%bs.obj {x=1; y=2}] [%bs.obj {x=1; y=2}], 0)); - "cmp_val", (fun _ -> Eq (compare [%bs.obj {x=1}] [%bs.obj {x=2}], -1)); - "cmp_val2", (fun _ -> Eq (compare [%bs.obj {x=2}] [%bs.obj {x=1}], 1)); - "cmp_empty", (fun _ -> Eq (compare [%bs.raw "{}"] [%bs.raw "{}"], 0)); - "cmp_empty2", (fun _ -> Eq (compare [%bs.raw "{}"] [%bs.raw "{x:1}"], -1)); - "cmp_swap", (fun _ -> Eq (compare [%bs.obj {x=1; y=2}] [%bs.obj {y=2; x=1}], 0)); - "cmp_size", (fun _ -> Eq (compare [%bs.raw "{x:1}"] [%bs.raw "{x:1, y:2}"], -1)); - "cmp_size2", (fun _ -> Eq (compare [%bs.raw "{x:1, y:2}"] [%bs.raw "{x:1}"], 1)); - "cmp_order", (fun _ -> Eq (compare [%bs.obj {x=0; y=1}] [%bs.obj {x=1; y=0}], -1)); - "cmp_order2", (fun _ -> Eq (compare [%bs.obj {x=1; y=0}] [%bs.obj {x=0; y=1}], 1)); - "cmp_in_list", (fun _ -> Eq (compare [[%bs.obj {x=1}]] [[%bs.obj {x=2}]], -1)); - "cmp_in_list2", (fun _ -> Eq (compare [[%bs.obj {x=2}]] [[%bs.obj {x=1}]], 1)); - "cmp_with_list", (fun _ -> Eq (compare [%bs.obj {x=[0]}] [%bs.obj {x=[1]}], -1)); - "cmp_with_list2", (fun _ -> Eq (compare [%bs.obj {x=[1]}] [%bs.obj {x=[0]}], 1)); - "eq_id", (fun _ -> Ok ([%bs.obj {x=1; y=2}] = [%bs.obj {x=1; y=2}])); - "eq_val", (fun _ -> Eq ([%bs.obj {x=1}] = [%bs.obj {x=2}], false)); - "eq_val2", (fun _ -> Eq ([%bs.obj {x=2}] = [%bs.obj {x=1}], false)); - "eq_empty", (fun _ -> Eq ([%bs.raw "{}"] = [%bs.raw "{}"], true)); - "eq_empty2", (fun _ -> Eq ([%bs.raw "{}"] = [%bs.raw "{x:1}"], false)); - "eq_swap", (fun _ -> Ok ([%bs.obj {x=1; y=2}] = [%bs.obj {y=2; x=1}])); - "eq_size", (fun _ -> Eq ([%bs.raw "{x:1}"] = [%bs.raw "{x:1, y:2}"], false)); - "eq_size2", (fun _ -> Eq ([%bs.raw "{x:1, y:2}"] = [%bs.raw "{x:1}"], false)); - "eq_in_list", (fun _ -> Eq ([[%bs.obj {x=1}]] = [[%bs.obj {x=2}]], false)); - "eq_in_list2", (fun _ -> Eq ([[%bs.obj {x=2}]] = [[%bs.obj {x=2}]], true)); - "eq_with_list", (fun _ -> Eq ([%bs.obj {x=[0]}] = [%bs.obj {x=[0]}], true)); - "eq_with_list2", (fun _ -> Eq ([%bs.obj {x=[0]}] = [%bs.obj {x=[1]}], false)); - "eq_no_prototype", (fun _ -> Eq ([%bs.raw "{x:1}"] = [%bs.raw "(function(){let o = Object.create(null);o.x = 1;return o;})()"], true)); - - __LOC__ , begin fun _ -> - Eq(compare Js.null (Js.Null.return [3]), -1) - end; - __LOC__ , begin fun _ -> - Eq(compare (Js.Null.return [3]) Js.null, 1) - end; - __LOC__ , begin fun _ -> - Eq(compare Js.null (Js.Null.return 0), -1) - end; - __LOC__ , begin fun _ -> - Eq(compare (Js.Null.return 0) Js.null, 1) - end; - __LOC__ , begin fun _ -> - Eq(compare Js.Nullable.undefined (Js.Nullable.return 0), -1) - end; - __LOC__ , begin fun _ -> - Eq(compare (Js.Nullable.return 0) Js.Nullable.undefined, 1) - end; -] -;; - - -let test_id = ref 0 -let eq loc x y = Mt.eq_suites ~test_id ~suites loc x y - -;; eq __LOC__ true (Some 1 > None) -;; eq __LOC__ true ([] < [1]) -;; eq __LOC__ false (None > Some 1) -;; eq __LOC__ false (None > Some [|1;30|]) -;; eq __LOC__ false (Some [|1;30|] < None) -let () = Mt.from_pair_suites __MODULE__ !suites diff --git a/jscomp/test/caml_compare_test.res b/jscomp/test/caml_compare_test.res new file mode 100644 index 0000000000..4dc811e82c --- /dev/null +++ b/jscomp/test/caml_compare_test.res @@ -0,0 +1,93 @@ +@@warning("-45") +type u = A(int) | B(int, bool) | C(int) + +let function_equal_test = try (x => x + 1) == (x => x + 2) catch { +| Invalid_argument("equal: functional value") => true +| _ => false +} + +let suites = ref({ + open Mt + list{ + (__LOC__, _ => Eq(true, None < Some(1))), + ("option2", _ => Eq(true, Some(1) < Some(2))), + (__LOC__, _ => Eq(true, list{1} > list{})), + ("listeq", _ => Eq(true, list{1, 2, 3} == list{1, 2, 3})), + ("listneq", _ => Eq(true, list{1, 2, 3} > list{1, 2, 2})), + ("custom_u", _ => Eq(true, (A(3), B(2, false), C(1)) > (A(3), B(2, false), C(0)))), + ("custom_u2", _ => Eq(true, (A(3), B(2, false), C(1)) == (A(3), B(2, false), C(1)))), + ("function", _ => Eq(true, function_equal_test)), + (__LOC__, _ => Eq(true, None < Some(1))), + (__LOC__, _ => Eq(true, None < Some([1, 30]))), + (__LOC__, _ => Eq(true, Some([1, 30]) > None)), + ( + __LOC__, + _ => Eq(true, list{2, 6, 1, 1, 2, 1, 4, 2, 1} < list{2, 6, 1, 1, 2, 1, 4, 2, 1, 409}), + ), + (__LOC__, _ => Eq(true, list{1} < list{1, 409})), + (__LOC__, _ => Eq(true, list{} < list{409})), + ( + __LOC__, + _ => Eq(true, list{2, 6, 1, 1, 2, 1, 4, 2, 1, 409} > list{2, 6, 1, 1, 2, 1, 4, 2, 1}), + ), + (__LOC__, _ => Eq(false, None == Some([1, 30]))), + (__LOC__, _ => Eq(false, Some([1, 30]) == None)), + ( + __LOC__, + _ => Eq(false, list{2, 6, 1, 1, 2, 1, 4, 2, 1} == list{2, 6, 1, 1, 2, 1, 4, 2, 1, 409}), + ), + ( + __LOC__, + _ => Eq(false, list{2, 6, 1, 1, 2, 1, 4, 2, 1, 409} == list{2, 6, 1, 1, 2, 1, 4, 2, 1}), + ), + ("cmp_id", _ => Eq(compare({"x": 1, "y": 2}, {"x": 1, "y": 2}), 0)), + ("cmp_val", _ => Eq(compare({"x": 1}, {"x": 2}), -1)), + ("cmp_val2", _ => Eq(compare({"x": 2}, {"x": 1}), 1)), + ("cmp_empty", _ => Eq(compare(%raw("{}"), %raw("{}")), 0)), + ("cmp_empty2", _ => Eq(compare(%raw("{}"), %raw("{x:1}")), -1)), + ("cmp_swap", _ => Eq(compare({"x": 1, "y": 2}, {"y": 2, "x": 1}), 0)), + ("cmp_size", _ => Eq(compare(%raw("{x:1}"), %raw("{x:1, y:2}")), -1)), + ("cmp_size2", _ => Eq(compare(%raw("{x:1, y:2}"), %raw("{x:1}")), 1)), + ("cmp_order", _ => Eq(compare({"x": 0, "y": 1}, {"x": 1, "y": 0}), -1)), + ("cmp_order2", _ => Eq(compare({"x": 1, "y": 0}, {"x": 0, "y": 1}), 1)), + ("cmp_in_list", _ => Eq(compare(list{{"x": 1}}, list{{"x": 2}}), -1)), + ("cmp_in_list2", _ => Eq(compare(list{{"x": 2}}, list{{"x": 1}}), 1)), + ("cmp_with_list", _ => Eq(compare({"x": list{0}}, {"x": list{1}}), -1)), + ("cmp_with_list2", _ => Eq(compare({"x": list{1}}, {"x": list{0}}), 1)), + ("eq_id", _ => Ok({"x": 1, "y": 2} == {"x": 1, "y": 2})), + ("eq_val", _ => Eq({"x": 1} == {"x": 2}, false)), + ("eq_val2", _ => Eq({"x": 2} == {"x": 1}, false)), + ("eq_empty", _ => Eq(%raw("{}") == %raw("{}"), true)), + ("eq_empty2", _ => Eq(%raw("{}") == %raw("{x:1}"), false)), + ("eq_swap", _ => Ok({"x": 1, "y": 2} == {"y": 2, "x": 1})), + ("eq_size", _ => Eq(%raw("{x:1}") == %raw("{x:1, y:2}"), false)), + ("eq_size2", _ => Eq(%raw("{x:1, y:2}") == %raw("{x:1}"), false)), + ("eq_in_list", _ => Eq(list{{"x": 1}} == list{{"x": 2}}, false)), + ("eq_in_list2", _ => Eq(list{{"x": 2}} == list{{"x": 2}}, true)), + ("eq_with_list", _ => Eq({"x": list{0}} == {"x": list{0}}, true)), + ("eq_with_list2", _ => Eq({"x": list{0}} == {"x": list{1}}, false)), + ( + "eq_no_prototype", + _ => Eq( + %raw("{x:1}") == %raw("(function(){let o = Object.create(null);o.x = 1;return o;})()"), + true, + ), + ), + (__LOC__, _ => Eq(compare(Js.null, Js.Null.return(list{3})), -1)), + (__LOC__, _ => Eq(compare(Js.Null.return(list{3}), Js.null), 1)), + (__LOC__, _ => Eq(compare(Js.null, Js.Null.return(0)), -1)), + (__LOC__, _ => Eq(compare(Js.Null.return(0), Js.null), 1)), + (__LOC__, _ => Eq(compare(Js.Nullable.undefined, Js.Nullable.return(0)), -1)), + (__LOC__, _ => Eq(compare(Js.Nullable.return(0), Js.Nullable.undefined), 1)), + } +}) + +let test_id = ref(0) +let eq = (loc, x, y) => Mt.eq_suites(~test_id, ~suites, loc, x, y) + +eq(__LOC__, true, Some(1) > None) +eq(__LOC__, true, list{} < list{1}) +eq(__LOC__, false, None > Some(1)) +eq(__LOC__, false, None > Some([1, 30])) +eq(__LOC__, false, Some([1, 30]) < None) +let () = Mt.from_pair_suites(__MODULE__, suites.contents)