diff --git a/CHANGELOG.md b/CHANGELOG.md index 14d9eaa0537..e61eb1acda2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,13 +12,15 @@ # 12.0.0-alpha.1 (Unreleased) -#### :house: Internal - -- Build with OCaml 5.1.1. https://github.com/rescript-lang/rescript-compiler/pull/6641 - #### :boom: Breaking Change - `lazy` syntax is no longer supported. If you're using it, use `Lazy` module or `React.lazy_` instead. https://github.com/rescript-lang/rescript-compiler/pull/6342 +- Remove handling of attributes with `bs.` prefix (`@bs.as` -> `@as` etc.). https://github.com/rescript-lang/rescript-compiler/pull/6643 +- Remove obsolete `@bs.open` feature. https://github.com/rescript-lang/rescript-compiler/pull/6629 + +#### :house: Internal + +- Build with OCaml 5.1.1. https://github.com/rescript-lang/rescript-compiler/pull/6641 # 11.1.0-rc.2 diff --git a/jscomp/bsc/rescript_compiler_main.ml b/jscomp/bsc/rescript_compiler_main.ml index b59f22f6617..9173948f471 100644 --- a/jscomp/bsc/rescript_compiler_main.ml +++ b/jscomp/bsc/rescript_compiler_main.ml @@ -457,7 +457,7 @@ let buckle_script_flags : (string * Bsc_args.spec * string) array = -(** parse flags in bs.config *) +(** parse flags in config *) let file_level_flags_handler (e : Parsetree.expression option) = match e with | None -> () diff --git a/jscomp/build_tests/cmd/input.js b/jscomp/build_tests/cmd/input.js index e90ae47441a..cbec80a60cd 100644 --- a/jscomp/build_tests/cmd/input.js +++ b/jscomp/build_tests/cmd/input.js @@ -21,7 +21,7 @@ type bla external foo : bla = "foo.react" [@@module] -external bar : unit -> bla = "bar" [@@bs.val] [@@module "foo.react"] +external bar : unit -> bla = "bar" [@@val] [@@module "foo.react"] let c = foo diff --git a/jscomp/build_tests/react_ppx/src/recursive_component_test.res b/jscomp/build_tests/react_ppx/src/recursive_component_test.res index cdd39ebc097..70682b0c698 100644 --- a/jscomp/build_tests/react_ppx/src/recursive_component_test.res +++ b/jscomp/build_tests/react_ppx/src/recursive_component_test.res @@ -1,7 +1,7 @@ @@warning("-39") // https://github.com/rescript-lang/rescript-compiler/issues/4511 /* -[@bs.config { +[@config { flags : [|"-dsource"|] }]; */ diff --git a/jscomp/core/design.md b/jscomp/core/design.md index 2455180bb9c..50ab484a135 100644 --- a/jscomp/core/design.md +++ b/jscomp/core/design.md @@ -98,7 +98,7 @@ Curry.__N o ]} Another use case: {[ - external f : ('a -> 'b [@bs.uncurry]) -> unit + external f : ('a -> 'b [@uncurry]) -> unit f g (* The compiler will do such converison internally*) ]} @@ -173,12 +173,12 @@ We can simply do inlining, it may have side efffect in `b0`, `b1`, our optimizer Maybe in the future, we should lift the restriction about `variadic` (delegate to `slow` mode when we can not resolve it statically, my personal expereince is that people will complain about why it fails to compile more than why it is slow in some corner cases) -Note this also interacts with `[@bs.uncurry]` +Note this also interacts with `[@uncurry]` for example ```ocaml -external filter : 'a array -> ('a -> bool [@bs.uncurry]) -> 'a array = "filter" +external filter : 'a array -> ('a -> bool [@uncurry]) -> 'a array = "filter" [@@send] let f xs = @@ -211,7 +211,7 @@ if (typeof x === "undefined"){ ```ocaml external of_char : char -> string = "String.fromCharCode" -[@@bs.val] +[@@val] ``` We introduced `#` so that we can do some optimizations. diff --git a/jscomp/core/lam_compile.ml b/jscomp/core/lam_compile.ml index 7361a1e22db..ed5a704cef6 100644 --- a/jscomp/core/lam_compile.ml +++ b/jscomp/core/lam_compile.ml @@ -1514,7 +1514,7 @@ and compile_prim (prim_info : Lam.prim_info) compile_sequand l r lambda_cxt | { primitive = Psequor; args = [ l; r ] } -> compile_sequor l r lambda_cxt | { primitive = Pdebugger; _ } -> - (* [%bs.debugger] guarantees that the expression does not matter + (* [%debugger] guarantees that the expression does not matter TODO: make it even safer *) Js_output.output_of_block_and_expression lambda_cxt.continuation S.debugger_block E.unit diff --git a/jscomp/frontend/ast_attributes.ml b/jscomp/frontend/ast_attributes.ml index e998f0e4161..6cffbed669d 100644 --- a/jscomp/frontend/ast_attributes.ml +++ b/jscomp/frontend/ast_attributes.ml @@ -86,11 +86,9 @@ let process_attributes_rev (attrs : t) : attr_kind * t = match (txt, st) with | "bs", (Nothing | Uncurry _) -> (Uncurry attr, acc) (* TODO: warn unused/duplicated attribute *) - | ("bs.this" | "this"), (Nothing | Meth_callback _) -> - (Meth_callback attr, acc) + | "this", (Nothing | Meth_callback _) -> (Meth_callback attr, acc) | "meth", (Nothing | Method _) -> (Method attr, acc) - | ("bs" | "bs.this" | "this"), _ -> - Bs_syntaxerr.err loc Conflict_bs_bs_this_bs_meth + | ("bs" | "this"), _ -> Bs_syntaxerr.err loc Conflict_bs_bs_this_bs_meth | _, _ -> (st, attr :: acc)) let process_bs (attrs : t) = @@ -150,8 +148,7 @@ let rs_externals (attrs : t) pval_prim = prims_to_be_encoded pval_prim | _, _ -> Ext_list.exists_fst attrs (fun ({txt} : string Asttypes.loc) -> - Ext_string.starts_with txt "bs." - || Ext_array.exists external_attrs (fun (x : string) -> txt = x)) + Ext_array.exists external_attrs (fun (x : string) -> txt = x)) || prims_to_be_encoded pval_prim let is_inline : attr -> bool = fun ({txt}, _) -> txt = "inline" @@ -221,12 +218,11 @@ let iter_process_bs_string_int_unwrap_uncurry (attrs : t) = in Ext_list.iter attrs (fun (({txt; loc = _}, (payload : _)) as attr) -> match txt with - | "bs.string" | "string" -> assign `String attr + | "string" -> assign `String attr | "int" -> assign `Int attr | "ignore" -> assign `Ignore attr - | "bs.unwrap" | "unwrap" -> assign `Unwrap attr - | "bs.uncurry" | "uncurry" -> - assign (`Uncurry (Ast_payload.is_single_int payload)) attr + | "unwrap" -> assign `Unwrap attr + | "uncurry" -> assign (`Uncurry (Ast_payload.is_single_int payload)) attr | _ -> ()); !st diff --git a/jscomp/frontend/ast_config.ml b/jscomp/frontend/ast_config.ml index 9f7eb7e3112..c45c04c367c 100644 --- a/jscomp/frontend/ast_config.ml +++ b/jscomp/frontend/ast_config.ml @@ -57,11 +57,8 @@ let process_directives str = let rec iter_on_bs_config_str (x : Parsetree.structure) = match x with | [] -> () - | { - pstr_desc = - Pstr_attribute (({txt = "bs.config" | "config"; loc}, payload) as attr); - } - :: _ -> + | {pstr_desc = Pstr_attribute (({txt = "config"; loc}, payload) as attr)} :: _ + -> Bs_ast_invariant.mark_used_bs_attribute attr; Ext_list.iter (Ast_payload.ident_or_record_as_config loc payload) @@ -76,11 +73,8 @@ let process_str str = let rec iter_on_bs_config_sig (x : Parsetree.signature) = match x with | [] -> () - | { - psig_desc = - Psig_attribute (({txt = "bs.config" | "config"; loc}, payload) as attr); - } - :: _ -> + | {psig_desc = Psig_attribute (({txt = "config"; loc}, payload) as attr)} :: _ + -> Bs_ast_invariant.mark_used_bs_attribute attr; Ext_list.iter (Ast_payload.ident_or_record_as_config loc payload) diff --git a/jscomp/frontend/ast_exp_extension.ml b/jscomp/frontend/ast_exp_extension.ml index ccd6fe4bbac..8cd6bf75fcc 100644 --- a/jscomp/frontend/ast_exp_extension.ml +++ b/jscomp/frontend/ast_exp_extension.ml @@ -27,13 +27,12 @@ let handle_extension e (self : Bs_ast_mapper.mapper) (({txt; loc}, payload) : Parsetree.extension) = match txt with | "ffi" -> Ast_exp_handle_external.handle_ffi ~loc ~payload - | "bs.raw" | "raw" -> - Ast_exp_handle_external.handle_raw ~kind:Raw_exp loc payload - | "bs.re" | "re" -> + | "raw" -> Ast_exp_handle_external.handle_raw ~kind:Raw_exp loc payload + | "re" -> Exp.constraint_ ~loc (Ast_exp_handle_external.handle_raw ~kind:Raw_re loc payload) (Ast_comb.to_js_re_type loc) - | "bs.external" | "external" -> ( + | "external" -> ( match Ast_payload.as_ident payload with | Some {txt = Lident x} -> Ast_exp_handle_external.handle_external loc x @@ -43,7 +42,7 @@ let handle_extension e (self : Bs_ast_mapper.mapper) *) | None | Some _ -> Location.raise_errorf ~loc "external expects a single identifier") - | "bs.time" | "time" -> ( + | "time" -> ( match payload with | PStr [{pstr_desc = Pstr_eval (e, _)}] -> let locString = @@ -69,7 +68,7 @@ let handle_extension e (self : Bs_ast_mapper.mapper) (Exp.ident ~loc {loc; txt = Lident "timed"}))) | _ -> Location.raise_errorf ~loc "expect a boolean expression in the payload") - | "bs.debugger" | "debugger" -> + | "debugger" -> {e with pexp_desc = Ast_exp_handle_external.handle_debugger loc payload} | "obj" -> ( match payload with diff --git a/jscomp/frontend/ast_external_process.ml b/jscomp/frontend/ast_external_process.ml index 9b6833a37d5..880572a4422 100644 --- a/jscomp/frontend/ast_external_process.ml +++ b/jscomp/frontend/ast_external_process.ml @@ -258,7 +258,7 @@ let parse_external_attributes (no_arguments : bool) (prim_name_check : string) else let action () = match txt with - | "bs.val" | "val" -> + | "val" -> if no_arguments then {st with val_name = Some (name_from_payload_or_prim ~loc payload)} else @@ -418,8 +418,7 @@ let parse_external_attributes (no_arguments : bool) (prim_name_check : string) with Not_handled_external_attribute -> (attr :: attrs, st)) let has_bs_uncurry (attrs : Ast_attributes.t) = - Ext_list.exists_fst attrs (fun {txt; loc = _} -> - txt = "bs.uncurry" || txt = "uncurry") + Ext_list.exists_fst attrs (fun {txt; loc = _} -> txt = "uncurry") let check_return_wrapper loc (wrapper : External_ffi_types.return_wrapper) result_type = diff --git a/jscomp/frontend/ast_typ_uncurry.mli b/jscomp/frontend/ast_typ_uncurry.mli index afb1bc521eb..ebd95e1bbdb 100644 --- a/jscomp/frontend/ast_typ_uncurry.mli +++ b/jscomp/frontend/ast_typ_uncurry.mli @@ -56,5 +56,5 @@ val to_uncurry_type : uncurry_type_gen val to_method_callback_type : uncurry_type_gen (** syntax: - {[ 'obj -> int -> int [@bs.this] ]} + {[ 'obj -> int -> int [@this] ]} *) diff --git a/jscomp/frontend/ast_uncurry_gen.mli b/jscomp/frontend/ast_uncurry_gen.mli index 047c2b16a06..00a757583ce 100644 --- a/jscomp/frontend/ast_uncurry_gen.mli +++ b/jscomp/frontend/ast_uncurry_gen.mli @@ -47,5 +47,5 @@ val to_method_callback : Parsetree.expression -> Parsetree.expression_desc (** syntax: - {[fun [@bs.this] obj pat pat1 -> body]} + {[fun [@this] obj pat pat1 -> body]} *) diff --git a/jscomp/frontend/bs_ast_invariant.ml b/jscomp/frontend/bs_ast_invariant.ml index 36d420098f6..5be055870d2 100644 --- a/jscomp/frontend/bs_ast_invariant.ml +++ b/jscomp/frontend/bs_ast_invariant.ml @@ -27,12 +27,11 @@ it may fail third party ppxes *) let is_bs_attribute txt = - let len = String.length txt in - len >= 2 - (*TODO: check the stringing padding rule, this preciate may not be needed *) - && String.unsafe_get txt 0 = 'b' - && String.unsafe_get txt 1 = 's' - && (len = 2 || String.unsafe_get txt 2 = '.') + match txt with + (* TODO #6636: | "as "| "int" *) + | "bs" | "config" | "ignore" | "optional" | "string" | "uncurry" | "unwrap" -> + true + | _ -> false let used_attributes : string Asttypes.loc Hash_set_poly.t = Hash_set_poly.create 16 diff --git a/jscomp/frontend/bs_builtin_ppx.ml b/jscomp/frontend/bs_builtin_ppx.ml index 69644b9d1b8..ea0be00e1fd 100644 --- a/jscomp/frontend/bs_builtin_ppx.ml +++ b/jscomp/frontend/bs_builtin_ppx.ml @@ -28,7 +28,7 @@ (** 1. extension point {[ - [%bs.raw{| blabla |}] + [%raw{| blabla |}] ]} will be desugared into {[ @@ -467,7 +467,7 @@ let structure_item_mapper (self : mapper) (str : Parsetree.structure_item) : Pstr_value (Nonrecursive, [{pvb_pat; pvb_expr; pvb_attributes; pvb_loc}]); }) - | Pstr_attribute ({txt = "bs.config" | "config"}, _) -> str + | Pstr_attribute ({txt = "config"}, _) -> str | _ -> default_mapper.structure_item self str let local_module_name = @@ -514,7 +514,7 @@ let rec structure_mapper ~await_context (self : mapper) (stru : Ast_structure.t) | [] -> [] | item :: rest -> ( match item.pstr_desc with - | Pstr_extension (({txt = "bs.raw" | "raw"; loc}, payload), _attrs) -> + | Pstr_extension (({txt = "raw"; loc}, payload), _attrs) -> Ast_exp_handle_external.handle_raw_structure loc payload :: structure_mapper ~await_context self rest (* | Pstr_extension (({txt = "i"}, _),_) diff --git a/jscomp/frontend/external_arg_spec.mli b/jscomp/frontend/external_arg_spec.mli index 8f679d961a3..62a56da38a0 100644 --- a/jscomp/frontend/external_arg_spec.mli +++ b/jscomp/frontend/external_arg_spec.mli @@ -31,8 +31,7 @@ type attr = | Poly_var of {descr: (string * string) list option} | Int of (string * int) list (* ([`a | `b ] [@int])*) | Arg_cst of cst - | Fn_uncurry_arity of - int (* annotated with [@bs.uncurry ] or [@bs.uncurry 2]*) + | Fn_uncurry_arity of int (* annotated with [@uncurry ] or [@uncurry 2]*) (* maybe we can improve it as a combination of {!Asttypes.constant} and tuple *) | Extern_unit | Nothing diff --git a/jscomp/gentype/Annotation.ml b/jscomp/gentype/Annotation.ml index 1ed02dd846a..e6836690cbe 100644 --- a/jscomp/gentype/Annotation.ml +++ b/jscomp/gentype/Annotation.ml @@ -21,7 +21,7 @@ let tagIsGenType s = s = "genType" || s = "gentype" let tagIsGenTypeAs s = s = "genType.as" || s = "gentype.as" let tagIsAs s = s = "as" let tagIsInt s = s = "int" -let tagIsString s = s = "bs.string" || s = "string" +let tagIsString s = s = "string" let tagIsTag s = s = "tag" diff --git a/jscomp/ml/ast_payload.mli b/jscomp/ml/ast_payload.mli index addd8f9116c..ef9964b8e2d 100644 --- a/jscomp/ml/ast_payload.mli +++ b/jscomp/ml/ast_payload.mli @@ -63,11 +63,11 @@ val assert_strings : Location.t -> t -> string list (** as a record or empty it will accept - {[ [@@@bs.config ]]} + {[ [@@@config ]]} or - {[ [@@@bs.config no_export ] ]} + {[ [@@@config no_export ] ]} or - {[ [@@@bs.config { property .. } ]]} + {[ [@@@config { property .. } ]]} Note that we only {[ { flat_property} diff --git a/jscomp/ml/oprint.ml b/jscomp/ml/oprint.ml index 293795a2404..a4ee54dd182 100644 --- a/jscomp/ml/oprint.ml +++ b/jscomp/ml/oprint.ml @@ -292,7 +292,7 @@ and print_simple_out_type ppf = | Otyp_constr (Oide_dot (Oide_dot (Oide_ident "Js_OO", "Callback" ), _), [tyl]) -> - fprintf ppf "@[<0>(%a@ [@bs.this])@]" print_out_type_1 tyl + fprintf ppf "@[<0>(%a@ [@this])@]" print_out_type_1 tyl | Otyp_constr (id, tyl) -> pp_open_box ppf 0; print_typargs ppf tyl; diff --git a/jscomp/others/belt_List.res b/jscomp/others/belt_List.res index e3f73fd71b7..e96d69986ce 100644 --- a/jscomp/others/belt_List.res +++ b/jscomp/others/belt_List.res @@ -59,7 +59,7 @@ ``` */ -@@bs.config({flags: ["-bs-noassertfalse"]}) +@@config({flags: ["-bs-noassertfalse"]}) type t<'a> = list<'a> diff --git a/jscomp/others/belt_internalAVLset.res b/jscomp/others/belt_internalAVLset.res index 1fedc4ff4c6..e8cec936f0f 100644 --- a/jscomp/others/belt_internalAVLset.res +++ b/jscomp/others/belt_internalAVLset.res @@ -21,7 +21,7 @@ * 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. */ -@@bs.config({flags: ["-bs-noassertfalse"]}) +@@config({flags: ["-bs-noassertfalse"]}) type rec node<'value> = { @as("v") mutable value: 'value, @as("h") mutable height: int, diff --git a/jscomp/others/belt_internalAVLtree.res b/jscomp/others/belt_internalAVLtree.res index ff557badf96..1ff41c72561 100644 --- a/jscomp/others/belt_internalAVLtree.res +++ b/jscomp/others/belt_internalAVLtree.res @@ -13,7 +13,7 @@ /* Almost rewritten by authors of ReScript */ -@@bs.config({flags: ["-bs-noassertfalse"]}) +@@config({flags: ["-bs-noassertfalse"]}) type rec node<'k, 'v> = { @as("k") mutable key: 'k, @as("v") mutable value: 'v, diff --git a/jscomp/others/belt_internalMapInt.res b/jscomp/others/belt_internalMapInt.res index 86d18f7beab..36d292842b5 100644 --- a/jscomp/others/belt_internalMapInt.res +++ b/jscomp/others/belt_internalMapInt.res @@ -1,4 +1,4 @@ -@@bs.config({flags: ["-bs-noassertfalse"]}) +@@config({flags: ["-bs-noassertfalse"]}) type key = int diff --git a/jscomp/others/belt_internalMapString.res b/jscomp/others/belt_internalMapString.res index e088f697811..cf8ab58f99e 100644 --- a/jscomp/others/belt_internalMapString.res +++ b/jscomp/others/belt_internalMapString.res @@ -1,4 +1,4 @@ -@@bs.config({flags: ["-bs-noassertfalse"]}) +@@config({flags: ["-bs-noassertfalse"]}) type key = string diff --git a/jscomp/others/internal_map.cppo.res b/jscomp/others/internal_map.cppo.res index 0afe893c6a1..bea7b724814 100644 --- a/jscomp/others/internal_map.cppo.res +++ b/jscomp/others/internal_map.cppo.res @@ -1,4 +1,4 @@ -@@bs.config({flags: ["-bs-noassertfalse"]}) +@@config({flags: ["-bs-noassertfalse"]}) #ifdef TYPE_STRING type key = string diff --git a/jscomp/others/js.ml b/jscomp/others/js.ml index c99eb1e77aa..621871c4c37 100644 --- a/jscomp/others/js.ml +++ b/jscomp/others/js.ml @@ -22,7 +22,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -[@@@bs.config {flags = [|"-unboxed-types"; "-w"; "-49"|]}] +[@@@config {flags = [|"-unboxed-types"; "-w"; "-49"|]}] (* DESIGN: - It does not have any code, all its code will be inlined so that there will never be @@ -141,14 +141,13 @@ external log : 'a -> unit = "log" [@@val] [@@scope "console"] (** Equivalent to console.log any value. *) -external log2 : 'a -> 'b -> unit = "log" [@@bs.val] [@@scope "console"] -external log3 : 'a -> 'b -> 'c -> unit = "log" [@@bs.val] [@@scope "console"] +external log2 : 'a -> 'b -> unit = "log" [@@val] [@@scope "console"] +external log3 : 'a -> 'b -> 'c -> unit = "log" [@@val] [@@scope "console"] -external log4 : 'a -> 'b -> 'c -> 'd -> unit = "log" -[@@bs.val] [@@scope "console"] +external log4 : 'a -> 'b -> 'c -> 'd -> unit = "log" [@@val] [@@scope "console"] external logMany : 'a array -> unit = "log" -[@@bs.val] [@@scope "console"] [@@variadic] +[@@val] [@@scope "console"] [@@variadic] (** A convenience function to console.log more than 4 arguments *) external eqNull : 'a -> 'a null -> bool = "%bs_equal_null" diff --git a/jscomp/others/js_OO.res b/jscomp/others/js_OO.res index e568c950660..033ab69b602 100644 --- a/jscomp/others/js_OO.res +++ b/jscomp/others/js_OO.res @@ -22,7 +22,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -@@bs.config({flags: ["-unboxed-types"]}) +@@config({flags: ["-unboxed-types"]}) external unsafe_to_method: 'a => 'a = "#fn_method" diff --git a/jscomp/others/js_dict.res b/jscomp/others/js_dict.res index 5daef592fd8..cd07c15ee1b 100644 --- a/jscomp/others/js_dict.res +++ b/jscomp/others/js_dict.res @@ -66,7 +66,7 @@ let unsafeDeleteKey: (. t, string) => unit = %raw(` function (dict,key){ `) @new external unsafeCreate: int => array<'a> = "Array" -/* external entries : 'a t -> (key * 'a) array = "Object.entries" [@@bs.val] (* ES2017 *) */ +/* external entries : 'a t -> (key * 'a) array = "Object.entries" [@@val] (* ES2017 *) */ let entries = dict => { let keys = keys(dict) let l = Js_array2.length(keys) @@ -78,7 +78,7 @@ let entries = dict => { values } -/* external values : 'a t -> 'a array = "Object.values" [@@bs.val] (* ES2017 *) */ +/* external values : 'a t -> 'a array = "Object.values" [@@val] (* ES2017 *) */ let values = dict => { let keys = keys(dict) let l = Js_array2.length(keys) diff --git a/jscomp/others/js_json.res b/jscomp/others/js_json.res index 03bb5783ace..47ea235e606 100644 --- a/jscomp/others/js_json.res +++ b/jscomp/others/js_json.res @@ -131,7 +131,7 @@ let decodeNull = (json): option> => } /* external parse : string -> t = "parse" - [@@bs.val][@@scope "JSON"] */ + [@@val][@@scope "JSON"] */ @val @scope("JSON") external parseExn: string => t = "parse" diff --git a/jscomp/others/js_math.ml b/jscomp/others/js_math.ml index 5801c614930..977af91f9eb 100644 --- a/jscomp/others/js_math.ml +++ b/jscomp/others/js_math.ml @@ -30,7 +30,7 @@ names begin with upper case.) *) external _E : float = "E" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Euler's number; ≈ 2.718281828459045. See [`Math.E`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/E) @@ -38,7 +38,7 @@ on MDN. *) external _LN2 : float = "LN2" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Natural logarithm of 2; ≈ 0.6931471805599453. See [`Math.LN2`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/LN2) @@ -46,7 +46,7 @@ on MDN. *) external _LN10 : float = "LN10" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Natural logarithm of 10; ≈ 2.302585092994046. See [`Math.LN10`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/LN10) @@ -54,7 +54,7 @@ on MDN. *) external _LOG2E : float = "LOG2E" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Base 2 logarithm of E; ≈ 1.4426950408889634. See [`Math.LOG2E`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/LOG2E) @@ -62,7 +62,7 @@ on MDN. *) external _LOG10E : float = "LOG10E" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Base 10 logarithm of E; ≈ 0.4342944819032518. See [`Math.LOG10E`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/LOG10E) @@ -70,7 +70,7 @@ on MDN. *) external _PI : float = "PI" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Pi - ratio of the circumference to the diameter of a circle; ≈ 3.141592653589793. See [`Math.PI`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/PI) @@ -78,7 +78,7 @@ on MDN. *) external _SQRT1_2 : float = "SQRT1_2" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Square root of 1/2; ≈ 0.7071067811865476. See [`Math.SQRT1_2`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/SQRT1_2) @@ -86,7 +86,7 @@ on MDN. *) external _SQRT2 : float = "SQRT2" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Square root of 2; ≈ 1.4142135623730951. See [`Math.SQRT2`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/SQRT2) @@ -94,7 +94,7 @@ on MDN. *) external abs_int : int -> int = "abs" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Absolute value for integer argument. See [`Math.abs`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/abs) @@ -102,7 +102,7 @@ on MDN. *) external abs_float : float -> float = "abs" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Absolute value for float argument. See [`Math.abs`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/abs) @@ -110,7 +110,7 @@ on MDN. *) external acos : float -> float = "acos" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Arccosine (in radians) of argument; returns `NaN` if the argument is outside the range [-1.0, 1.0]. See @@ -119,7 +119,7 @@ on MDN. *) external acosh : float -> float = "acosh" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Hyperbolic arccosine (in radians) of argument; returns `NaN` if the argument is less than 1.0. See @@ -128,7 +128,7 @@ on MDN. *) external asin : float -> float = "asin" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Arcsine (in radians) of argument; returns `NaN` if the argument is outside the range [-1.0, 1.0]. See @@ -137,7 +137,7 @@ on MDN. *) external asinh : float -> float = "asinh" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Hyperbolic arcsine (in radians) of argument. See [`Math.asinh`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/asinh) @@ -145,7 +145,7 @@ on MDN. *) external atan : float -> float = "atan" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Arctangent (in radians) of argument. See [`Math.atan`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/atan) @@ -153,7 +153,7 @@ on MDN. *) external atanh : float -> float = "atanh" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Hyperbolic arctangent (in radians) of argument; returns `NaN` if the argument is is outside the range [-1.0, 1.0]. Returns `-Infinity` and `Infinity` for @@ -163,7 +163,7 @@ on MDN. *) external atan2 : y:float -> x:float -> unit -> float = "atan2" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Returns the angle (in radians) of the quotient `y /. x`. It is also the angle between the *x*-axis and point (*x*, *y*). See @@ -182,7 +182,7 @@ Js.Math.atan2(~x=-0.0, ~y=-5.0, ()) == -.Js.Math._PI /. 2.0 *) external cbrt : float -> float = "cbrt" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Cube root. See [`Math.cbrt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/cbrt) @@ -190,7 +190,7 @@ on MDN *) external unsafe_ceil_int : float -> int = "ceil" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Returns the smallest integer greater than or equal to the argument. This function may return values not representable by `int`, whose range is @@ -237,7 +237,7 @@ let ceil_int (f : float) : int = let ceil = ceil_int [@@deprecated "Please use `ceil_int` instead"] external ceil_float : float -> float = "ceil" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Returns the smallest integral value greater than or equal to the argument. The result is a `float` and is not restricted to the `int` data type range. @@ -256,7 +256,7 @@ Js.Math.ceil_float(2_150_000_000.3) == 2_150_000_001.0 *) external clz32 : int -> int = "clz32" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Number of leading zero bits of the argument's 32 bit int representation. See [`Math.clz32`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32) @@ -272,7 +272,7 @@ Js.Math.clz32(255) == 24 *) external cos : float -> float = "cos" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Cosine of argument, which must be specified in radians. See [`Math.cos`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/cos) @@ -280,7 +280,7 @@ on MDN. *) external cosh : float -> float = "cosh" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Hyperbolic cosine of argument, which must be specified in radians. See [`Math.cosh`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/cosh) @@ -288,7 +288,7 @@ on MDN. *) external exp : float -> float = "exp" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Natural exponentional; returns *e* (the base of natural logarithms) to the power of the given argument. See @@ -297,7 +297,7 @@ on MDN. *) external expm1 : float -> float = "expm1" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Returns *e* (the base of natural logarithms) to the power of the given argument minus 1. See @@ -306,7 +306,7 @@ on MDN. *) external unsafe_floor_int : float -> int = "floor" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Returns the largest integer less than or equal to the argument. This function may return values not representable by `int`, whose range is -2147483648 to @@ -353,7 +353,7 @@ let floor_int f = let floor = floor_int [@@deprecated "Please use `floor_int` instead"] external floor_float : float -> float = "floor" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Returns the largest integral value less than or equal to the argument. The result is a `float` and is not restricted to the `int` data type range. See @@ -371,7 +371,7 @@ Js.Math.floor_float(2_150_000_000.3) == 2_150_000_000.0 *) external fround : float -> float = "fround" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Round to nearest single precision float. See [`Math.fround`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/fround) @@ -386,7 +386,7 @@ Js.Math.fround(5.05) == 5.050000190734863 *) external hypot : float -> float -> float = "hypot" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Returns the square root of the sum of squares of its two arguments (the Pythagorean formula). See @@ -395,7 +395,7 @@ on MDN. *) external hypotMany : float array -> float = "hypot" -[@@bs.val] [@@variadic] [@@scope "Math"] +[@@val] [@@variadic] [@@scope "Math"] (** Returns the square root of the sum of squares of the numbers in the array argument (generalized Pythagorean equation). Using an array allows you to @@ -411,7 +411,7 @@ Js.Math.hypotMany([3.0, 4.0, 12.0]) == 13.0 *) external imul : int -> int -> int = "imul" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** 32-bit integer multiplication. Use this only when you need to optimize performance of multiplication of numbers stored as 32-bit integers. See @@ -420,7 +420,7 @@ on MDN. *) external log : float -> float = "log" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Returns the natural logarithm of its argument; this is the number *x* such that *e**x* equals the argument. Returns `NaN` for negative @@ -437,7 +437,7 @@ Js.Math.log(100.0) == 4.605170185988092 *) external log1p : float -> float = "log1p" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Returns the natural logarithm of one plus the argument. Returns `NaN` for arguments less than -1. See @@ -453,7 +453,7 @@ Js.Math.log1p(99.0) == 4.605170185988092 *) external log10 : float -> float = "log10" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Returns the base 10 logarithm of its argument. Returns `NaN` for negative arguments. See @@ -470,7 +470,7 @@ Js.Math.log10(Js.Math.sqrt(10.0)) == 0.5 *) external log2 : float -> float = "log2" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Returns the base 2 logarithm of its argument. Returns `NaN` for negative arguments. See @@ -487,7 +487,7 @@ Js.Math.log2(Js.Math._SQRT2) == 0.5000000000000001 // due to precision *) external max_int : int -> int -> int = "max" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Returns the maximum of its two integer arguments. See [`Math.max`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max) @@ -495,7 +495,7 @@ on MDN. *) external maxMany_int : int array -> int = "max" -[@@bs.val] [@@variadic] [@@scope "Math"] +[@@val] [@@variadic] [@@scope "Math"] (** Returns the maximum of the integers in the given array. See [`Math.max`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max) @@ -503,7 +503,7 @@ on MDN. *) external max_float : float -> float -> float = "max" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Returns the maximum of its two floating point arguments. See [`Math.max`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max) @@ -511,7 +511,7 @@ on MDN. *) external maxMany_float : float array -> float = "max" -[@@bs.val] [@@variadic] [@@scope "Math"] +[@@val] [@@variadic] [@@scope "Math"] (** Returns the maximum of the floating point values in the given array. See [`Math.max`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max) @@ -519,7 +519,7 @@ on MDN. *) external min_int : int -> int -> int = "min" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Returns the minimum of its two integer arguments. See [`Math.min`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/min) @@ -527,7 +527,7 @@ on MDN. *) external minMany_int : int array -> int = "min" -[@@bs.val] [@@variadic] [@@scope "Math"] +[@@val] [@@variadic] [@@scope "Math"] (** Returns the minimum of the integers in the given array. See [`Math.min`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/min) @@ -535,7 +535,7 @@ on MDN. *) external min_float : float -> float -> float = "min" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Returns the minimum of its two floating point arguments. See [`Math.min`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/min) @@ -543,7 +543,7 @@ on MDN. *) external minMany_float : float array -> float = "min" -[@@bs.val] [@@variadic] [@@scope "Math"] +[@@val] [@@variadic] [@@scope "Math"] (** Returns the minimum of the floating point values in the given array. See [`Math.min`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/min) @@ -551,7 +551,7 @@ on MDN. *) external pow_int : base:int -> exp:int -> int = "pow" -[@@bs.val] +[@@val] [@@scope "Math"] [@@deprecated "use `pow_float` instead, the return type may be not int"] (** @@ -568,7 +568,7 @@ Js.Math.pow_int(~base=3, ~exp=4) == 81 *) external pow_float : base:float -> exp:float -> float = "pow" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Raises the given base to the given exponent. (Arguments and result are floats.) Returns `NaN` if the result would be imaginary. See @@ -587,7 +587,7 @@ Js.Float.isNaN(Js.Math.pow_float(~base=-2.0, ~exp=0.5)) == true *) external random : unit -> float = "random" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Returns a random number in the half-closed interval [0,1). See [`Math.random`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random) @@ -603,7 +603,7 @@ on MDN. let random_int min max = floor (random () *. Js_int.toFloat (max - min)) + min external unsafe_round : float -> int = "round" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Rounds its argument to nearest integer. For numbers with a fractional portion of exactly 0.5, the argument is rounded to the next integer in the direction @@ -624,7 +624,7 @@ Js.Math.unsafe_round(2_150_000_000_000.3) // out of range for int *) external round : float -> float = "round" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Rounds to nearest integral value (expressed as a float). See [`Math.round`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round) @@ -632,7 +632,7 @@ on MDN. *) external sign_int : int -> int = "sign" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Returns the sign of its integer argument: -1 if negative, 0 if zero, 1 if positive. See @@ -641,7 +641,7 @@ on MDN. *) external sign_float : float -> float = "sign" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Returns the sign of its float argument: -1.0 if negative, 0.0 if zero, 1.0 if positive. See @@ -650,7 +650,7 @@ on MDN. *) external sin : float -> float = "sin" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Sine of argument, which must be specified in radians. See [`Math.sin`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sin) @@ -658,7 +658,7 @@ on MDN. *) external sinh : float -> float = "sinh" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Hyperbolic sine of argument, which must be specified in radians. See [`Math.sinh`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sinh) @@ -666,7 +666,7 @@ on MDN. *) external sqrt : float -> float = "sqrt" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Square root. If the argument is negative, this function returns `NaN`. See [`Math.sqrt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sqrt) @@ -674,7 +674,7 @@ on MDN. *) external tan : float -> float = "tan" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Tangent of argument, which must be specified in radians. Returns `NaN` if the argument is positive infinity or negative infinity. See @@ -683,7 +683,7 @@ on MDN. *) external tanh : float -> float = "tanh" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Hyperbolic tangent of argument, which must be specified in radians. See [`Math.tanh`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/tanh) @@ -691,7 +691,7 @@ on MDN. *) external unsafe_trunc : float -> int = "trunc" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Truncates its argument; i.e., removes fractional digits. This function may return values not representable by `int`, whose range is -2147483648 to @@ -703,7 +703,7 @@ on MDN. *) external trunc : float -> float = "trunc" -[@@bs.val] [@@scope "Math"] +[@@val] [@@scope "Math"] (** Truncates its argument; i.e., removes fractional digits. See [`Math.trunc`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc) diff --git a/jscomp/others/js_string2.res b/jscomp/others/js_string2.res index 998b60c6bc0..7dd51fd2853 100644 --- a/jscomp/others/js_string2.res +++ b/jscomp/others/js_string2.res @@ -983,7 +983,7 @@ Js.String2.link("Go to page two", "page2.html") == "Go to p external link: (t, t) => t = "link" /* FIXME: we should not encourage people to use [%identity], better - to provide something using [@@bs.val] so that we can track such + to provide something using [@@val] so that we can track such casting */ /** diff --git a/jscomp/others/js_typed_array.res b/jscomp/others/js_typed_array.res index 21b010b1a0b..bd0728fb685 100644 --- a/jscomp/others/js_typed_array.res +++ b/jscomp/others/js_typed_array.res @@ -50,8 +50,8 @@ module ArrayBuffer = { /* ArrayBuffer.isView: seems pointless with a type system */ /* experimental - external transfer : array_buffer -> t = "ArrayBuffer.transfer" [@@bs.val] - external transferWithLength : array_buffer -> int -> t = "ArrayBuffer.transfer" [@@bs.val] + external transfer : array_buffer -> t = "ArrayBuffer.transfer" [@@val] + external transferWithLength : array_buffer -> int -> t = "ArrayBuffer.transfer" [@@val] */ @get external byteLength: t => int = "byteLength" diff --git a/jscomp/others/js_typed_array2.res b/jscomp/others/js_typed_array2.res index c31f20b8292..71eee7316c0 100644 --- a/jscomp/others/js_typed_array2.res +++ b/jscomp/others/js_typed_array2.res @@ -45,8 +45,8 @@ module ArrayBuffer = { /* ArrayBuffer.isView: seems pointless with a type system */ /* experimental - external transfer : array_buffer -> t = "ArrayBuffer.transfer" [@@bs.val] - external transferWithLength : array_buffer -> int -> t = "ArrayBuffer.transfer" [@@bs.val] + external transfer : array_buffer -> t = "ArrayBuffer.transfer" [@@val] + external transferWithLength : array_buffer -> int -> t = "ArrayBuffer.transfer" [@@val] */ @get external byteLength: t => int = "byteLength" diff --git a/jscomp/ounit_tests/ounit_cmd_tests.ml b/jscomp/ounit_tests/ounit_cmd_tests.ml index b7ce4602462..22b5471cdfb 100644 --- a/jscomp/ounit_tests/ounit_cmd_tests.ml +++ b/jscomp/ounit_tests/ounit_cmd_tests.ml @@ -64,7 +64,7 @@ let suites = __LOC__ >:: begin fun _ -> let should_be_warning = - bsc_check_eval {| external mk : int -> ([`a|`b [@bs.string]]) = "mk" [@@bs.val] |} in + bsc_check_eval {| external mk : int -> ([`a|`b [@string]]) = "mk" [@@val] |} in OUnit.assert_bool __LOC__ (Ext_string.contain_substring should_be_warning.stderr "Unused") @@ -88,21 +88,21 @@ external ff : *) let should_err = bsc_check_eval {| external v3 : - int -> int -> (int -> int -> int [@bs.uncurry]) - = "v3"[@@bs.val] + int -> int -> (int -> int -> int [@uncurry]) + = "v3"[@@val] |} in (* Ounit_cmd_util.debug_output should_err;*) OUnit.assert_bool __LOC__ (Ext_string.contain_substring - should_err.stderr "bs.uncurry") + should_err.stderr "uncurry") end ; __LOC__ >:: begin fun _ -> let should_err = bsc_check_eval {| external v4 : - (int -> int -> int [@bs.uncurry]) = "" - [@@bs.val] + (int -> int -> int [@uncurry]) = "" + [@@val] |} in (* Ounit_cmd_util.debug_output should_err ; *) @@ -120,18 +120,18 @@ external ff : __LOC__ >:: begin fun _ -> let should_err = bsc_check_eval {| - external mk : int -> ([`a|`b] [@bs.string]) = "" [@@bs.val] + external mk : int -> ([`a|`b] [@string]) = "" [@@val] |} in OUnit.assert_bool __LOC__ (not @@ Ext_string.is_empty should_err.stderr) end; __LOC__ >:: begin fun _ -> let should_err = bsc_check_eval {| - external mk : int -> ([`a|`b] ) = "mk" [@@bs.val] + external mk : int -> ([`a|`b] ) = "mk" [@@val] |} in OUnit.assert_bool __LOC__ ( Ext_string.is_empty should_err.stderr) (* give a warning or ? - ( [`a | `b ] [@bs.string] ) + ( [`a | `b ] [@string] ) (* auto-convert to ocaml poly-variant *) *) end; @@ -139,7 +139,7 @@ external ff : __LOC__ >:: begin fun _ -> let should_err = bsc_check_eval {| type t - external mk : int -> (_ [@as {json| { x : 3 } |json}]) -> t = "mk" [@@bs.val] + external mk : int -> (_ [@as {json| { x : 3 } |json}]) -> t = "mk" [@@val] |} in OUnit.assert_bool __LOC__ (Ext_string.is_empty should_err.stderr) end @@ -147,7 +147,7 @@ external ff : __LOC__ >:: begin fun _ -> let should_err = bsc_check_eval {| type t - external mk : int -> (_ [@as {json| { "x" : 3 } |json}]) -> t = "mk" [@@bs.val] + external mk : int -> (_ [@as {json| { "x" : 3 } |json}]) -> t = "mk" [@@val] |} in OUnit.assert_bool __LOC__ (Ext_string.is_empty should_err.stderr) end @@ -155,7 +155,7 @@ external ff : (* #1510 *) __LOC__ >:: begin fun _ -> let should_err = bsc_check_eval {| - let should_fail = fun [@bs.this] (Some x) y u -> y + u + let should_fail = fun [@this] (Some x) y u -> y + u |} in OUnit.assert_bool __LOC__ (Ext_string.contain_substring should_err.stderr "simple") @@ -163,7 +163,7 @@ external ff : __LOC__ >:: begin fun _ -> let should_err = bsc_check_eval {| - let should_fail = fun [@bs.this] (Some x as v) y u -> y + u + let should_fail = fun [@this] (Some x as v) y u -> y + u |} in (* Ounit_cmd_util.debug_output should_err; *) OUnit.assert_bool __LOC__ @@ -261,8 +261,8 @@ let rec y = A y;; external mk : int -> ( [`a|`b] - [@bs.string] - ) = "mk" [@@bs.val] + [@string] + ) = "mk" [@@val] |} in (* Ounit_cmd_util.debug_output should_err ; *) OUnit.assert_bool __LOC__ diff --git a/jscomp/ounit_tests/ounit_ffi_error_debug_test.ml b/jscomp/ounit_tests/ounit_ffi_error_debug_test.ml index 340720e0913..a8b5db5d21c 100644 --- a/jscomp/ounit_tests/ounit_ffi_error_debug_test.ml +++ b/jscomp/ounit_tests/ounit_ffi_error_debug_test.ml @@ -22,7 +22,7 @@ let suites = __LOC__ >:: begin fun _ -> let output = bsc_eval {| external err : - hi_should_error:([`a of int | `b of string ] [@bs.string]) -> + hi_should_error:([`a of int | `b of string ] [@string]) -> unit -> _ = "" [@@obj] |} in OUnit.assert_bool __LOC__ @@ -31,7 +31,7 @@ external err : __LOC__ >:: begin fun _ -> let output = bsc_eval {| external err : - ?hi_should_error:([`a of int | `b of string ] [@bs.string]) -> + ?hi_should_error:([`a of int | `b of string ] [@string]) -> unit -> _ = "" [@@obj] |} in OUnit.assert_bool __LOC__ @@ -40,8 +40,8 @@ let output = bsc_eval {| __LOC__ >:: begin fun _ -> let output = bsc_eval {| external err : - ?hi_should_error:([`a of int | `b of string ] [@bs.string]) -> - unit -> unit = "err" [@@bs.val] + ?hi_should_error:([`a of int | `b of string ] [@string]) -> + unit -> unit = "err" [@@val] |} in OUnit.assert_bool __LOC__ (Ext_string.contain_substring output.stderr "hi_should_error") @@ -49,12 +49,12 @@ let output = bsc_eval {| __LOC__ >:: begin fun _ -> (* - Each [@bs.unwrap] variant constructor requires an argument + Each [@unwrap] variant constructor requires an argument *) let output = bsc_eval {| external err : - ?hi_should_error:([`a of int | `b] [@bs.unwrap]) -> unit -> unit = "err" [@@bs.val] + ?hi_should_error:([`a of int | `b] [@unwrap]) -> unit -> unit = "err" [@@val] |} in OUnit.assert_bool __LOC__ @@ -63,12 +63,12 @@ let output = bsc_eval {| __LOC__ >:: begin fun _ -> (* - [@bs.unwrap] args are not supported in [@@obj] functions + [@unwrap] args are not supported in [@@obj] functions *) let output = bsc_eval {| external err : - ?hi_should_error:([`a of int] [@bs.unwrap]) -> unit -> _ = "" [@@obj] + ?hi_should_error:([`a of int] [@unwrap]) -> unit -> _ = "" [@@obj] |} in OUnit.assert_bool __LOC__ diff --git a/jscomp/runtime/caml_format.ml b/jscomp/runtime/caml_format.ml index 6a4a5a84637..c36929a2c31 100644 --- a/jscomp/runtime/caml_format.ml +++ b/jscomp/runtime/caml_format.ml @@ -103,7 +103,7 @@ let int_of_string (s : string) : int = let () = if d < 0 || d >= base then failwith "int_of_string" in - (* let () = [%bs.debugger] in *) + (* let () = [%debugger] in *) let rec aux acc k = if k = len then acc else diff --git a/jscomp/runtime/caml_hash.res b/jscomp/runtime/caml_hash.res index 60542c5d698..b33bedb049c 100644 --- a/jscomp/runtime/caml_hash.res +++ b/jscomp/runtime/caml_hash.res @@ -21,7 +21,7 @@ * 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. */ -@@bs.config({flags: ["-bs-noassertfalse"]}) +@@config({flags: ["-bs-noassertfalse"]}) type rec cell<'a> = { content: 'a, mutable next: option>, diff --git a/jscomp/runtime/caml_int64.res b/jscomp/runtime/caml_int64.res index 7958282981b..d079cdc4af7 100644 --- a/jscomp/runtime/caml_int64.res +++ b/jscomp/runtime/caml_int64.res @@ -320,7 +320,7 @@ let rec of_float = (x: float): t => @val @scope("Math") external log: float => float = "log" @val @scope("Math") external ceil: float => float = "ceil" @val @scope("Math") external floor: float => float = "floor" -/* external maxFloat : float -> float -> float = "Math.max" [@@bs.val] */ +/* external maxFloat : float -> float -> float = "Math.max" [@@val] */ /* either top 11 bits are all 0 or all 1 when it is all 1, we need exclude -2^53 diff --git a/jscomp/runtime/js.ml b/jscomp/runtime/js.ml index 6e280c60deb..e816b2dd59a 100644 --- a/jscomp/runtime/js.ml +++ b/jscomp/runtime/js.ml @@ -22,7 +22,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -[@@@bs.config {flags = [|"-unboxed-types"; "-w"; "-49"|]}] +[@@@config {flags = [|"-unboxed-types"; "-w"; "-49"|]}] (* DESIGN: - It does not have any code, all its code will be inlined so that there will never be @@ -104,13 +104,12 @@ external log : 'a -> unit = "log" [@@val] [@@scope "console"] (** A convenience function to log everything *) -external log2 : 'a -> 'b -> unit = "log" [@@bs.val] [@@scope "console"] -external log3 : 'a -> 'b -> 'c -> unit = "log" [@@bs.val] [@@scope "console"] -external log4 : 'a -> 'b -> 'c -> 'd -> unit = "log" -[@@bs.val] [@@scope "console"] +external log2 : 'a -> 'b -> unit = "log" [@@val] [@@scope "console"] +external log3 : 'a -> 'b -> 'c -> unit = "log" [@@val] [@@scope "console"] +external log4 : 'a -> 'b -> 'c -> 'd -> unit = "log" [@@val] [@@scope "console"] external logMany : 'a array -> unit = "log" -[@@bs.val] [@@scope "console"] [@@variadic] +[@@val] [@@scope "console"] [@@variadic] (** A convenience function to log more than 4 arguments *) external eqNull : 'a -> 'a null -> bool = "%bs_equal_null" diff --git a/jscomp/stdlib-406/callback.res b/jscomp/stdlib-406/callback.res index 66378892f09..89d44b6368e 100644 --- a/jscomp/stdlib-406/callback.res +++ b/jscomp/stdlib-406/callback.res @@ -12,7 +12,7 @@ /* special exception on linking described in the file LICENSE. */ /* */ /* ************************************************************************ */ -@@bs.config({flags: ["-bs-no-cross-module-opt"]}) +@@config({flags: ["-bs-no-cross-module-opt"]}) /* Registering OCaml values with the C runtime for later callbacks */ let register = (_, _) => () diff --git a/jscomp/stdlib-406/camlinternalLazy.res b/jscomp/stdlib-406/camlinternalLazy.res index 4db5dddacce..f93ce9058a9 100644 --- a/jscomp/stdlib-406/camlinternalLazy.res +++ b/jscomp/stdlib-406/camlinternalLazy.res @@ -22,7 +22,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -@@bs.config({flags: ["-bs-no-cross-module-opt"]}) +@@config({flags: ["-bs-no-cross-module-opt"]}) /* Internals of forcing lazy values. */ type t<'a> = { diff --git a/jscomp/stdlib-406/sys.res b/jscomp/stdlib-406/sys.res index bffe3aaf293..947c892f612 100644 --- a/jscomp/stdlib-406/sys.res +++ b/jscomp/stdlib-406/sys.res @@ -1,4 +1,4 @@ -@@bs.config({flags: ["-bs-no-cross-module-opt"]}) +@@config({flags: ["-bs-no-cross-module-opt"]}) /* ************************************************************************ */ /* */ /* OCaml */ diff --git a/jscomp/syntax/benchmarks/data/HeroGraphic.ml b/jscomp/syntax/benchmarks/data/HeroGraphic.ml index 08feb30e3d9..e33360dbd53 100644 --- a/jscomp/syntax/benchmarks/data/HeroGraphic.ml +++ b/jscomp/syntax/benchmarks/data/HeroGraphic.ml @@ -1,4 +1,4 @@ -;;[%bs.raw {|require('./HeroGraphic.css')|}] +;;[%raw {|require('./HeroGraphic.css')|}] let make ?(width= "760") ?(height= "380") = ((svg ~width:((width)) ~height:((height)) ~viewBox:(("0 0 758 381")) ~fill:(("none") diff --git a/jscomp/syntax/benchmarks/data/HeroGraphic.res b/jscomp/syntax/benchmarks/data/HeroGraphic.res index 53decfa8a0f..22927a7fd10 100644 --- a/jscomp/syntax/benchmarks/data/HeroGraphic.res +++ b/jscomp/syntax/benchmarks/data/HeroGraphic.res @@ -1,4 +1,4 @@ -%bs.raw(`require('./HeroGraphic.css')`) +%raw(`require('./HeroGraphic.css')`) @react.component let make = (~width="760", ~height="380") => diff --git a/jscomp/syntax/benchmarks/data/Napkinscript.ml b/jscomp/syntax/benchmarks/data/Napkinscript.ml index 2ade45da319..37512e4fcdc 100644 --- a/jscomp/syntax/benchmarks/data/Napkinscript.ml +++ b/jscomp/syntax/benchmarks/data/Napkinscript.ml @@ -6714,7 +6714,7 @@ module Printer = struct and printJsFfiImport (valueDescription: Parsetree.value_description) cmtTbl = let attrs = List.filter (fun attr -> match attr with - | ({Location.txt = "bs.val" | "genType.import" | "scope" }, _) -> false + | ({Location.txt = "val" | "genType.import" | "scope" }, _) -> false | _ -> true ) valueDescription.pval_attributes in let (ident, alias) = match valueDescription.pval_prim with @@ -11514,7 +11514,7 @@ module JsFfi = struct } let toParsetree importDescr = - let bsVal = (Location.mknoloc "bs.val", Parsetree.PStr []) in + let bsVal = (Location.mknoloc "val", Parsetree.PStr []) in let attrs = match importDescr.jid_scope with | Global -> [bsVal] (* @genType.import("./MyMath"), diff --git a/jscomp/syntax/benchmarks/data/Napkinscript.res b/jscomp/syntax/benchmarks/data/Napkinscript.res index 01ccbaea935..710590ed3ad 100644 --- a/jscomp/syntax/benchmarks/data/Napkinscript.res +++ b/jscomp/syntax/benchmarks/data/Napkinscript.res @@ -6906,7 +6906,7 @@ module Printer = { and printJsFfiImport = (valueDescription: Parsetree.value_description, cmtTbl) => { let attrs = List.filter(attr => switch attr { - | ({Location.txt: "bs.val" | "genType.import" | "scope"}, _) => false + | ({Location.txt: "val" | "genType.import" | "scope"}, _) => false | _ => true } , valueDescription.pval_attributes) @@ -11881,7 +11881,7 @@ module JsFfi = { } let toParsetree = importDescr => { - let bsVal = (Location.mknoloc("bs.val"), Parsetree.PStr(list{})) + let bsVal = (Location.mknoloc("val"), Parsetree.PStr(list{})) let attrs = switch importDescr.jid_scope { | Global => list{bsVal} /* @genType.import("./MyMath"), diff --git a/jscomp/syntax/benchmarks/data/RedBlackTree.ml b/jscomp/syntax/benchmarks/data/RedBlackTree.ml index 6e2551caa7c..b2a0b42e7ce 100644 --- a/jscomp/syntax/benchmarks/data/RedBlackTree.ml +++ b/jscomp/syntax/benchmarks/data/RedBlackTree.ml @@ -193,7 +193,7 @@ let removeNode rbt node = let (successor, isLeaf) = match successor with | None -> - let leaf = createNode ~value:([%bs.raw "0"]) ~color:Black ~height:0. in + let leaf = createNode ~value:([%raw "0"]) ~color:Black ~height:0. in let isLeaf = ((fun x -> x == leaf)[@bs ]) in (leaf, isLeaf) | Some successor -> (successor, (((fun _ -> false))[@bs ])) in let nodeParent = nodeToRemove.parent in diff --git a/jscomp/syntax/benchmarks/data/RedBlackTree.res b/jscomp/syntax/benchmarks/data/RedBlackTree.res index fbf68c266e5..409c4feb32f 100644 --- a/jscomp/syntax/benchmarks/data/RedBlackTree.res +++ b/jscomp/syntax/benchmarks/data/RedBlackTree.res @@ -334,7 +334,7 @@ let removeNode = (rbt, node) => { } let (successor, isLeaf) = switch successor { | None => - let leaf = createNode(~value=%bs.raw("0"), ~color=Black, ~height=0.) + let leaf = createNode(~value=%raw("0"), ~color=Black, ~height=0.) let isLeaf = (. x) => x === leaf; (leaf, isLeaf) | Some(successor) => diff --git a/jscomp/syntax/benchmarks/data/RedBlackTreeNoComments.res b/jscomp/syntax/benchmarks/data/RedBlackTreeNoComments.res index 67a2a5463c8..6f68764300b 100644 --- a/jscomp/syntax/benchmarks/data/RedBlackTreeNoComments.res +++ b/jscomp/syntax/benchmarks/data/RedBlackTreeNoComments.res @@ -252,7 +252,7 @@ let removeNode = (rbt, node) => { } let (successor, isLeaf) = switch successor { | None => - let leaf = createNode(~value=%bs.raw("0"), ~color=Black, ~height=0.) + let leaf = createNode(~value=%raw("0"), ~color=Black, ~height=0.) let isLeaf = (. x) => x === leaf (leaf, isLeaf) | Some(successor) => (successor, (. _) => false) diff --git a/jscomp/syntax/src/res_ast_conversion.ml b/jscomp/syntax/src/res_ast_conversion.ml index b8c419b80ff..b274bcaf51c 100644 --- a/jscomp/syntax/src/res_ast_conversion.ml +++ b/jscomp/syntax/src/res_ast_conversion.ml @@ -274,18 +274,6 @@ let normalize = let open Ast_mapper in { default_mapper with - extension = - (fun mapper ext -> - match ext with - | id, payload -> - ( {id with txt = Res_printer.convertBsExtension id.txt}, - default_mapper.payload mapper payload )); - attribute = - (fun mapper attr -> - match attr with - | id, payload -> - ( {id with txt = Res_printer.convertBsExternalAttribute id.txt}, - default_mapper.payload mapper payload )); attributes = (fun mapper attrs -> attrs diff --git a/jscomp/syntax/src/res_printer.ml b/jscomp/syntax/src/res_printer.ml index 65b8e91bec2..9c0181ee624 100644 --- a/jscomp/syntax/src/res_printer.ml +++ b/jscomp/syntax/src/res_printer.ml @@ -16,49 +16,6 @@ type callbackStyle = *) | ArgumentsFitOnOneLine -(* Since compiler version 8.3, the bs. prefix is no longer needed *) -(* Synced from - https://github.com/rescript-lang/rescript-compiler/blob/29174de1a5fde3b16cf05d10f5ac109cfac5c4ca/jscomp/frontend/ast_external_process.ml#L291-L367 *) -let convertBsExternalAttribute = function - | "bs.as" -> "as" - | "bs.deriving" -> "deriving" - | "bs.get" -> "get" - | "bs.get_index" -> "get_index" - | "bs.ignore" -> "ignore" - | "bs.inline" -> "inline" - | "bs.int" -> "int" - | "bs.meth" -> "meth" - | "bs.module" -> "module" - | "bs.new" -> "new" - | "bs.obj" -> "obj" - | "bs.optional" -> "optional" - | "bs.return" -> "return" - | "bs.send" -> "send" - | "bs.scope" -> "scope" - | "bs.set" -> "set" - | "bs.set_index" -> "set_index" - | "bs.splice" | "bs.variadic" -> "variadic" - | "bs.string" -> "string" - | "bs.this" -> "this" - | "bs.uncurry" -> "uncurry" - | "bs.unwrap" -> "unwrap" - | "bs.val" -> "val" - (* bs.send.pipe shouldn't be transformed *) - | txt -> txt - -(* These haven't been needed for a long time now *) -(* Synced from - https://github.com/rescript-lang/rescript-compiler/blob/29174de1a5fde3b16cf05d10f5ac109cfac5c4ca/jscomp/frontend/ast_exp_extension.ml *) -let convertBsExtension = function - | "bs.debugger" -> "debugger" - | "bs.external" -> "raw" - (* We should never see this one since we use the sugared object form, but still *) - | "bs.obj" -> "obj" - | "bs.raw" -> "raw" - | "bs.re" -> "re" - (* TODO: what about bs.time and bs.node? *) - | txt -> txt - let addParens doc = Doc.group (Doc.concat @@ -2154,7 +2111,7 @@ and printPackageConstraint ~state i cmtTbl (longidentLoc, typ) = ] and printExtension ~state ~atModuleLvl (stringLoc, payload) cmtTbl = - let txt = convertBsExtension stringLoc.Location.txt in + let txt = stringLoc.Location.txt in let extName = let doc = Doc.concat @@ -5466,7 +5423,7 @@ and printAttribute ?(standalone = false) ~state (Doc.concat [ Doc.text (if standalone then "@@" else "@"); - Doc.text (convertBsExternalAttribute id.txt); + Doc.text id.txt; printPayload ~state payload cmtTbl; ]), Doc.line ) diff --git a/jscomp/syntax/src/res_printer.mli b/jscomp/syntax/src/res_printer.mli index 3647dc37907..5253ce6a270 100644 --- a/jscomp/syntax/src/res_printer.mli +++ b/jscomp/syntax/src/res_printer.mli @@ -1,6 +1,3 @@ -val convertBsExternalAttribute : string -> string -val convertBsExtension : string -> string - val printTypeParams : (Parsetree.core_type * Asttypes.variance) list -> Res_comments_table.t -> diff --git a/jscomp/syntax/tests/idempotency/bs-webapi/tests/Webapi/Webapi__Dom/Webapi__Dom__Document__test.res b/jscomp/syntax/tests/idempotency/bs-webapi/tests/Webapi/Webapi__Dom/Webapi__Dom__Document__test.res index bee60a18471..4a734f9ef03 100644 --- a/jscomp/syntax/tests/idempotency/bs-webapi/tests/Webapi/Webapi__Dom/Webapi__Dom__Document__test.res +++ b/jscomp/syntax/tests/idempotency/bs-webapi/tests/Webapi/Webapi__Dom/Webapi__Dom__Document__test.res @@ -75,7 +75,7 @@ let _ = importNode(el, document) let _ = importNodeDeep(el, document) /* TODO: These get dead code eliminated let _ = registerElement(document, "my-component"); -let _ = registerElementWithOptions(document, "my-component", [%bs.raw "{}"]); +let _ = registerElementWithOptions(document, "my-component", [%raw "{}"]); */ let _ = getElementById("root", document) let _ = querySelector(".lstlisting", document) diff --git a/jscomp/syntax/tests/idempotency/mareo/Main.res b/jscomp/syntax/tests/idempotency/mareo/Main.res index 2d742a74542..16f0ffb1b1a 100644 --- a/jscomp/syntax/tests/idempotency/mareo/Main.res +++ b/jscomp/syntax/tests/idempotency/mareo/Main.res @@ -1,4 +1,4 @@ -@@bs.config({no_export: no_export}) +@@config({no_export: no_export}) open Belt diff --git a/jscomp/syntax/tests/idempotency/pupilfirst/courses/CoursesCurriculum__SubmissionBuilder.res b/jscomp/syntax/tests/idempotency/pupilfirst/courses/CoursesCurriculum__SubmissionBuilder.res index 3c1b0823884..93ca1719d47 100644 --- a/jscomp/syntax/tests/idempotency/pupilfirst/courses/CoursesCurriculum__SubmissionBuilder.res +++ b/jscomp/syntax/tests/idempotency/pupilfirst/courses/CoursesCurriculum__SubmissionBuilder.res @@ -1,4 +1,4 @@ -@@bs.config({jsx: 3}) +@@config({jsx: 3}) open CoursesCurriculum__Types diff --git a/jscomp/syntax/tests/idempotency/pupilfirst/courses/SubmissionChecklistItemShow.res b/jscomp/syntax/tests/idempotency/pupilfirst/courses/SubmissionChecklistItemShow.res index 8f9024aea09..60fd0249ceb 100644 --- a/jscomp/syntax/tests/idempotency/pupilfirst/courses/SubmissionChecklistItemShow.res +++ b/jscomp/syntax/tests/idempotency/pupilfirst/courses/SubmissionChecklistItemShow.res @@ -1,4 +1,4 @@ -@@bs.config({jsx: 3}) +@@config({jsx: 3}) module ChecklistItem = SubmissionChecklistItem diff --git a/jscomp/syntax/tests/idempotency/pupilfirst/schools/CurriculumEditor__TargetChecklistItemEditor.res b/jscomp/syntax/tests/idempotency/pupilfirst/schools/CurriculumEditor__TargetChecklistItemEditor.res index faf609a9c84..a2ef33216b4 100644 --- a/jscomp/syntax/tests/idempotency/pupilfirst/schools/CurriculumEditor__TargetChecklistItemEditor.res +++ b/jscomp/syntax/tests/idempotency/pupilfirst/schools/CurriculumEditor__TargetChecklistItemEditor.res @@ -1,4 +1,4 @@ -@@bs.config({jsx: 3}) +@@config({jsx: 3}) open CurriculumEditor__Types diff --git a/jscomp/syntax/tests/idempotency/reductive/reductiveContext.res b/jscomp/syntax/tests/idempotency/reductive/reductiveContext.res index 0d994d2ba45..4faa0e5add2 100644 --- a/jscomp/syntax/tests/idempotency/reductive/reductiveContext.res +++ b/jscomp/syntax/tests/idempotency/reductive/reductiveContext.res @@ -1,4 +1,4 @@ -@@bs.config({jsx: 3}) +@@config({jsx: 3}) module type Config = { type state type action diff --git a/jscomp/syntax/tests/idempotency/reductive/subscription.res b/jscomp/syntax/tests/idempotency/reductive/subscription.res index d87978b3fd9..2b6e4d70b40 100644 --- a/jscomp/syntax/tests/idempotency/reductive/subscription.res +++ b/jscomp/syntax/tests/idempotency/reductive/subscription.res @@ -1,4 +1,4 @@ -@@bs.config({jsx: 3}) +@@config({jsx: 3}) @deriving({jsConverter: newType}) type source<'a> = { diff --git a/jscomp/syntax/tests/idempotency/reprocessing/Reprocessing_Draw.res b/jscomp/syntax/tests/idempotency/reprocessing/Reprocessing_Draw.res index 22c9daad5ce..416775d9e93 100644 --- a/jscomp/syntax/tests/idempotency/reprocessing/Reprocessing_Draw.res +++ b/jscomp/syntax/tests/idempotency/reprocessing/Reprocessing_Draw.res @@ -6,9 +6,9 @@ open Reprocessing_Common * This is where all the fancy things happen. * * ```reason;shared(sandbox) - * [@bs.val] external sandboxCanvasId: string = \"\"; - * [@bs.val] external sandboxCanvas: 'canvas = \"\"; - * [@bs.val] external containerDiv: 'node = \"\"; + * [@val] external sandboxCanvasId: string = \"\"; + * [@val] external sandboxCanvas: 'canvas = \"\"; + * [@val] external containerDiv: 'node = \"\"; * [@send] external addEventListener: ('node, string, 'eventT => unit) => unit = \"addEventListener\"; * let id = sandboxCanvasId; * addEventListener(containerDiv, \"mouseleave\", (_) => Reprocessing.playPause(id, false) |> ignore); diff --git a/jscomp/syntax/tests/idempotency/reprocessing/Reprocessing_Draw.resi b/jscomp/syntax/tests/idempotency/reprocessing/Reprocessing_Draw.resi index 53a66a8b2d9..a30ab392d0f 100644 --- a/jscomp/syntax/tests/idempotency/reprocessing/Reprocessing_Draw.resi +++ b/jscomp/syntax/tests/idempotency/reprocessing/Reprocessing_Draw.resi @@ -3,9 +3,9 @@ * This is where all the fancy things happen. * * ```reason;shared(sandbox) - * [@bs.val] external sandboxCanvasId: string = \"\"; - * [@bs.val] external sandboxCanvas: 'canvas = \"\"; - * [@bs.val] external containerDiv: 'node = \"\"; + * [@val] external sandboxCanvasId: string = \"\"; + * [@val] external sandboxCanvas: 'canvas = \"\"; + * [@val] external containerDiv: 'node = \"\"; * [@send] external addEventListener: ('node, string, 'eventT => unit) => unit = \"addEventListener\"; * let id = sandboxCanvasId; * addEventListener(containerDiv, \"mouseleave\", (_) => Reprocessing.playPause(id, false) |> ignore); diff --git a/jscomp/syntax/tests/idempotency/wildcards-world-ui/SsrEntryPoint.res b/jscomp/syntax/tests/idempotency/wildcards-world-ui/SsrEntryPoint.res index f85b346e063..8bffc6131f8 100644 --- a/jscomp/syntax/tests/idempotency/wildcards-world-ui/SsrEntryPoint.res +++ b/jscomp/syntax/tests/idempotency/wildcards-world-ui/SsrEntryPoint.res @@ -1,4 +1,4 @@ -// [%bs.raw {|require("./custom.css")|}]; +// [%raw {|require("./custom.css")|}]; open Globals module Router = { diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/block.res b/jscomp/syntax/tests/parsing/grammar/expressions/block.res index f652ecabd52..a7af95bc5c8 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/block.res +++ b/jscomp/syntax/tests/parsing/grammar/expressions/block.res @@ -127,10 +127,10 @@ let f = () => { let reifyStyle = (type a, x: 'a): (style, a) => { module Internal = { type rec constructor - @bs.val external canvasGradient: constructor = "CanvasGradient" /* internal */ - @bs.val external canvasPattern: constructor = "CanvasPattern" /* internal */ + @val external canvasGradient: constructor = "CanvasGradient" /* internal */ + @val external canvasPattern: constructor = "CanvasPattern" /* internal */ let instanceOf = ( - %bs.raw(`function(x,y) {return +(x instanceof y)}`): ('a, constructor) => bool + %raw(`function(x,y) {return +(x instanceof y)}`): ('a, constructor) => bool ) /* internal */ } diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/expected/block.res.txt b/jscomp/syntax/tests/parsing/grammar/expressions/expected/block.res.txt index 0cce867c206..6777f28579b 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/expected/block.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/expressions/expected/block.res.txt @@ -46,10 +46,10 @@ let reifyStyle (type a) (x : 'a) = (((let module Internal = struct type constructor - external canvasGradient : constructor = "CanvasGradient"[@@bs.val ] - external canvasPattern : constructor = "CanvasPattern"[@@bs.val ] + external canvasGradient : constructor = "CanvasGradient"[@@val ] + external canvasPattern : constructor = "CanvasPattern"[@@val ] let instanceOf = - ([%bs.raw + ([%raw (({js|function(x,y) {return +(x instanceof y)}|js}) [@res.template ])] : 'a -> constructor -> bool) end in diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/expected/extension.res.txt b/jscomp/syntax/tests/parsing/grammar/expressions/expected/extension.res.txt index b97d310d574..21b88f9fcb0 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/expected/extension.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/expressions/expected/extension.res.txt @@ -2,4 +2,4 @@ ;;[%expr.extension ] ;;[%expr.extension.with.args {js|argument|js}] ;;[%expr.extension.with.args fun x -> f x] -let x = ([%bs.raw {js|1|js}]) + ([%bs.raw {js|2|js}]) \ No newline at end of file +let x = ([%raw {js|1|js}]) + ([%raw {js|2|js}]) \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/extension.res b/jscomp/syntax/tests/parsing/grammar/expressions/extension.res index 8f363f442da..c7a62d6c6a8 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/extension.res +++ b/jscomp/syntax/tests/parsing/grammar/expressions/extension.res @@ -6,4 +6,4 @@ %expr.extension.with.args(x => f(x)) -let x = %bs.raw("1") + %bs.raw("2") +let x = %raw("1") + %raw("2") diff --git a/jscomp/syntax/tests/parsing/grammar/pattern/expected/extension.res.txt b/jscomp/syntax/tests/parsing/grammar/pattern/expected/extension.res.txt index 1f14e535785..ca0ed6d49fc 100644 --- a/jscomp/syntax/tests/parsing/grammar/pattern/expected/extension.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/pattern/expected/extension.res.txt @@ -1,8 +1,8 @@ let [%patternExtension ] = () let [%pattern.extension ] = () -let [%bs.raw {js|x|js}] = () -let ([%bs.raw {js|x|js}] : unit) = () -let [%bs.raw {js|x|js}] as y = () +let [%raw {js|x|js}] = () +let ([%raw {js|x|js}] : unit) = () +let [%raw {js|x|js}] as y = () let [%patExt1 ]|[%patExt2 ] = () ;;match x with | [%patternExtension ] -> () @@ -13,10 +13,10 @@ let [%patExt1 ]|[%patExt2 ] = () | [%patExt1 ]|[%patExt2 ] -> () let f [%patternExtension ] = () let f [%pattern.extension ] = () -let f [%bs.raw {js|x|js}] = () -let f [%bs.raw {js|x|js}] [%bs.raw {js|y|js}] = () -let f ([%bs.raw {js|x|js}] as _y) = () -let f ([%bs.raw {js|x|js}] : unit) = () +let f [%raw {js|x|js}] = () +let f [%raw {js|x|js}] [%raw {js|y|js}] = () +let f ([%raw {js|x|js}] as _y) = () +let f ([%raw {js|x|js}] : unit) = () let f ([%patExt1 ]|[%patExt2 ]) = () ;;for [%ext ] = x to y do () done ;;for [%ext1 ]|[%ext2 ] = x to y do () done diff --git a/jscomp/syntax/tests/parsing/grammar/pattern/extension.res b/jscomp/syntax/tests/parsing/grammar/pattern/extension.res index a24db1a8ce7..c04a2a3faab 100644 --- a/jscomp/syntax/tests/parsing/grammar/pattern/extension.res +++ b/jscomp/syntax/tests/parsing/grammar/pattern/extension.res @@ -2,9 +2,9 @@ let %patternExtension = () let %pattern.extension = () -let %bs.raw("x") = () -let (%bs.raw("x") : unit) = () -let %bs.raw("x") as y = () +let %raw("x") = () +let (%raw("x") : unit) = () +let %raw("x") as y = () let %patExt1 | %patExt2 = () @@ -19,10 +19,10 @@ switch x { let f = (%patternExtension) => () let f = (%pattern.extension) => () -let f = (%bs.raw("x")) => () -let f = (%bs.raw("x"), %bs.raw("y")) => () -let f = (%bs.raw("x") as _y) => () -let f = (%bs.raw("x") : unit) => () +let f = (%raw("x")) => () +let f = (%raw("x"), %raw("y")) => () +let f = (%raw("x") as _y) => () +let f = (%raw("x") : unit) => () let f = (%patExt1 | %patExt2) => () for %ext in x to y { () } diff --git a/jscomp/syntax/tests/parsing/grammar/typexpr/expected/uncurried.res.txt b/jscomp/syntax/tests/parsing/grammar/typexpr/expected/uncurried.res.txt index 5097ce68d86..126cacdee2b 100644 --- a/jscomp/syntax/tests/parsing/grammar/typexpr/expected/uncurried.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/typexpr/expected/uncurried.res.txt @@ -22,7 +22,7 @@ type nonrec t = [ `Has_arity2 ]) function$ external setTimeout : (unit -> unit, [ `Has_arity1 ]) function$ -> int -> timerId = "setTimeout" -[@@bs.val ] +[@@val ] external setTimeout : ((unit -> unit) -> int -> timerId, [ `Has_arity2 ]) function$ = "setTimeout" \ No newline at end of file diff --git a/jscomp/syntax/tests/parsing/grammar/typexpr/uncurried.res b/jscomp/syntax/tests/parsing/grammar/typexpr/uncurried.res index 7ea7f55fd8e..91fc3a548b1 100644 --- a/jscomp/syntax/tests/parsing/grammar/typexpr/uncurried.res +++ b/jscomp/syntax/tests/parsing/grammar/typexpr/uncurried.res @@ -8,7 +8,7 @@ type t = (. @attr float, @attr2 int, . @attr3 bool, @attr4 string) => unit type t = @attr (. float) => @attr2 int => @attr3 (. bool) => @attr4 string => unit type t = (. (@attr float), (@attr2 int), . (@attr3 bool), (@attr4 string)) => unit -@bs.val +@val external setTimeout : ((. ()) => unit, int) => timerId = "setTimeout" // totally different meaning external setTimeout : (. unit => unit, int) => timerId = "setTimeout" diff --git a/jscomp/test/alias_default_value_test.res b/jscomp/test/alias_default_value_test.res index 68d6a8b5f8f..5bdeda0728a 100644 --- a/jscomp/test/alias_default_value_test.res +++ b/jscomp/test/alias_default_value_test.res @@ -1,4 +1,4 @@ -@@bs.config({ +@@config({ flags: ["-bs-jsx", "4"], }) diff --git a/jscomp/test/bs_MapInt_test.res b/jscomp/test/bs_MapInt_test.res index a09919cdcba..a66fa9f58f9 100644 --- a/jscomp/test/bs_MapInt_test.res +++ b/jscomp/test/bs_MapInt_test.res @@ -1,4 +1,4 @@ -@@bs.config({flags: ["-bs-no-cross-module-opt"]}) +@@config({flags: ["-bs-no-cross-module-opt"]}) let should = b => if !b { Js.Exn.raiseError("IMPOSSIBLE") diff --git a/jscomp/test/bs_auto_uncurry.res b/jscomp/test/bs_auto_uncurry.res index f6e09ec83ca..7f1e243d9ed 100644 --- a/jscomp/test/bs_auto_uncurry.res +++ b/jscomp/test/bs_auto_uncurry.res @@ -6,7 +6,7 @@ module Block = {} type id = int => int @val external map2: (array, @uncurry (int => int)) => array = "Array.prototype.map.cal" -/* [@bs.uncurry n] should not be documented, +/* [@uncurry n] should not be documented, since such inconsistency could not be checked */ @@ -92,10 +92,10 @@ let v = fishy_unit_2 () [@bs] /* external ff : int -> - (unit -> unit [@bs.uncurry]) -> + (unit -> unit [@uncurry]) -> int = "" -[@@bs.val] +[@@val] */ /* @@ -117,7 +117,7 @@ Maybe we can create a sugar /* external config : - hi: (int -> int [@bs.uncurry]) -> + hi: (int -> int [@uncurry]) -> lo: int -> unit -> _ = "" [@@obj] diff --git a/jscomp/test/bs_qualified.res b/jscomp/test/bs_qualified.res index 54ae1188d29..96096477aab 100644 --- a/jscomp/test/bs_qualified.res +++ b/jscomp/test/bs_qualified.res @@ -29,7 +29,7 @@ external makeBuffer2: int => buffer = "Buffer" external makeBuffer3: int => buffer = "makeBuffer3" @scope("Math") @val external max: (float, float) => float = "max" -/* TODO: `bs.val` is not necessary, by default is good? +/* TODO: `@val` is not necessary, by default is good? */ type t diff --git a/jscomp/test/bs_rest_test.res b/jscomp/test/bs_rest_test.res index b3be3b2fc2c..74d25fcd1c6 100644 --- a/jscomp/test/bs_rest_test.res +++ b/jscomp/test/bs_rest_test.res @@ -16,5 +16,4 @@ include ( ) let u = xxx(. 3) -/** Do we need both [bs.val] and [bs.call]* instead of just one [bs.val] */ let xx = xxx(. "3") diff --git a/jscomp/test/bs_unwrap_test.res b/jscomp/test/bs_unwrap_test.res index 5fe7e5670d5..6360f8dd26e 100644 --- a/jscomp/test/bs_unwrap_test.res +++ b/jscomp/test/bs_unwrap_test.res @@ -76,7 +76,7 @@ external log4: @unwrap | #Options({"foo": int}) ] => unit = "console.log" -/* Make sure [@bs.unwrap] plays nicely with [%obj] */ +/* Make sure [@unwrap] plays nicely with [%obj] */ let _ = log4(#String("foo")) let _ = log4(#Options({"foo": 1})) diff --git a/jscomp/test/config1_test.res b/jscomp/test/config1_test.res index 15c7ddcf26d..319fe1c9bbf 100644 --- a/jscomp/test/config1_test.res +++ b/jscomp/test/config1_test.res @@ -1,3 +1,3 @@ -@@bs.config(no_export) +@@config(no_export) let a = 3 diff --git a/jscomp/test/debug_mode_value.res b/jscomp/test/debug_mode_value.res index b2b010d9094..3b63c9df68b 100644 --- a/jscomp/test/debug_mode_value.res +++ b/jscomp/test/debug_mode_value.res @@ -1,4 +1,4 @@ -@@bs.config({ +@@config({ flags: [ /* "-drawlambda"; */ /* "-dlambda"; */ diff --git a/jscomp/test/event_ffi.res b/jscomp/test/event_ffi.res index ecd2c7b7395..30f6738f9a0 100644 --- a/jscomp/test/event_ffi.res +++ b/jscomp/test/event_ffi.res @@ -8,7 +8,7 @@ external on : process -> ] -> unit Js.fn -> unit = "on" [@@send] -external p : process = "process" [@@bs.val] +external p : process = "process" [@@val] external on_hi : process -> diff --git a/jscomp/test/gpr_1072.res b/jscomp/test/gpr_1072.res index d8a5058af78..92492c67ae8 100644 --- a/jscomp/test/gpr_1072.res +++ b/jscomp/test/gpr_1072.res @@ -1,6 +1,6 @@ /* external ice_cream: - ?flavor:([`vanilla | `chocolate ] [@bs.string]) -> + ?flavor:([`vanilla | `chocolate ] [@string]) -> num:int -> unit -> _ = "" @@ -11,7 +11,7 @@ let my_scoop = ice_cream ~flavor:`vanilla ~num:3 () */ /* external ice_cream_2: - flavor:([`vanilla | `chocolate ] [@bs.string]) -> + flavor:([`vanilla | `chocolate ] [@string]) -> num:int -> unit -> _ = "" @@ -175,7 +175,7 @@ let () = { again4(~x=incr(side_effect), ~y=(), __LINE__, ()) } -/* external again5 : ?x__ignore:([`a of unit -> int | `b of string -> int ] [@bs.string]) */ -/* -> int -> unit = "" [@@bs.val] */ +/* external again5 : ?x__ignore:([`a of unit -> int | `b of string -> int ] [@string]) */ +/* -> int -> unit = "" [@@val] */ /* let v = again5 3 */ diff --git a/jscomp/test/gpr_1072_reg.res b/jscomp/test/gpr_1072_reg.res index 13256d9ca2b..f1119861119 100644 --- a/jscomp/test/gpr_1072_reg.res +++ b/jscomp/test/gpr_1072_reg.res @@ -38,28 +38,28 @@ let v1 = make( external make2 : ?localeMatcher: - ([`lookup | `best_fit [@as \"best fit\"]] [@bs.string]) -> + ([`lookup | `best_fit [@as \"best fit\"]] [@string]) -> ?timeZone:string -> ?hour12:bool -> ?formatMatcher: - ([`basic | `best_fit [@as \"best fit\"]] [@bs.string]) -> + ([`basic | `best_fit [@as \"best fit\"]] [@string]) -> - ?weekday:([`narrow | `short | `long] [@bs.string]) -> - ?era:([`narrow | `short | `long] [@bs.string]) -> - ?year:([`numeric | `two_digit [@as \"2-digit\"]] [@bs.string]) -> + ?weekday:([`narrow | `short | `long] [@string]) -> + ?era:([`narrow | `short | `long] [@string]) -> + ?year:([`numeric | `two_digit [@as \"2-digit\"]] [@string]) -> ?month: ([`narrow | `short | `long | `numeric | - `two_digit [@as \"2-digit\"]] [@bs.string]) -> + `two_digit [@as \"2-digit\"]] [@string]) -> - ?day:(([`numeric | `two_digit [@as \"2-digit\"]] [@bs.string]) as 'num) -> + ?day:(([`numeric | `two_digit [@as \"2-digit\"]] [@string]) as 'num) -> ?hour:('num) -> ?minute:('num) -> ?second:('num) -> - ?timeZoneName:([`short | `long] [@bs.string]) -> + ?timeZoneName:([`short | `long] [@string]) -> unit -> t = \"\" [@@obj] diff --git a/jscomp/test/gpr_1698_test.res b/jscomp/test/gpr_1698_test.res index 0cfd35ad6b3..b49992f4797 100644 --- a/jscomp/test/gpr_1698_test.res +++ b/jscomp/test/gpr_1698_test.res @@ -1,4 +1,4 @@ -@@bs.config({no_export: true}) +@@config({no_export: true}) type value = | Natural(int) | Symbol(string) diff --git a/jscomp/test/gpr_2682_test.res b/jscomp/test/gpr_2682_test.res index 638604b79cb..7a21ef4665a 100644 --- a/jscomp/test/gpr_2682_test.res +++ b/jscomp/test/gpr_2682_test.res @@ -1,5 +1,5 @@ @@warning("-22") -/* [@@@bs.config no_export] */ +/* [@@@config no_export] */ /* let for_each n = ([%raw{| for (var key in n){ diff --git a/jscomp/test/gpr_4280_test.res b/jscomp/test/gpr_4280_test.res index a8c039a3d6c..ac0fc6e15ed 100644 --- a/jscomp/test/gpr_4280_test.res +++ b/jscomp/test/gpr_4280_test.res @@ -1,4 +1,4 @@ -@@bs.config({flags: [/* "-bs-diagnose" */]}) +@@config({flags: [/* "-bs-diagnose" */]}) let suites: ref = ref(list{}) let test_id = ref(0) let eq = (loc, x, y) => Mt.eq_suites(~test_id, ~suites, loc, x, y) diff --git a/jscomp/test/gpr_459_test.res b/jscomp/test/gpr_459_test.res index dcbce381818..e4e51bda814 100644 --- a/jscomp/test/gpr_459_test.res +++ b/jscomp/test/gpr_459_test.res @@ -1,4 +1,4 @@ -@@bs.config({no_export: no_export}) +@@config({no_export: no_export}) let suites: ref = ref(list{}) let test_id = ref(0) diff --git a/jscomp/test/gpr_658.res b/jscomp/test/gpr_658.res index 141f538953a..9a67d6105bc 100644 --- a/jscomp/test/gpr_658.res +++ b/jscomp/test/gpr_658.res @@ -1,4 +1,4 @@ -/* external obj : < hi : int > = "{hi:1}" [@@bs.val] */ +/* external obj : < hi : int > = "{hi:1}" [@@val] */ @obj external mk: (~hi: int, unit) => {"hi": int} = "" diff --git a/jscomp/test/gpr_return_type_unused_attribute.res b/jscomp/test/gpr_return_type_unused_attribute.res index 35beb73a3ff..c6a266be41c 100644 --- a/jscomp/test/gpr_return_type_unused_attribute.res +++ b/jscomp/test/gpr_return_type_unused_attribute.res @@ -2,7 +2,7 @@ @val external mk: int => [#a | #b] = "mk" -/* [@bs.string] */ +/* [@string] */ let v = mk(2) diff --git a/jscomp/test/include_side_effect.res b/jscomp/test/include_side_effect.res index 14f7d6dc6a7..2652357abcd 100644 --- a/jscomp/test/include_side_effect.res +++ b/jscomp/test/include_side_effect.res @@ -1,2 +1,2 @@ -@@bs.config({no_export: no_export}) +@@config({no_export: no_export}) include Side_effect diff --git a/jscomp/test/include_side_effect_free.res b/jscomp/test/include_side_effect_free.res index 92bf8eea566..1b16ed15765 100644 --- a/jscomp/test/include_side_effect_free.res +++ b/jscomp/test/include_side_effect_free.res @@ -1,4 +1,4 @@ -@@bs.config(no_export) +@@config(no_export) /* since it is side effect free , this should generate a dummy file */ include Side_effect_free diff --git a/jscomp/test/inline_string_test.res b/jscomp/test/inline_string_test.res index 6bcc79f4ce0..4264e2be32b 100644 --- a/jscomp/test/inline_string_test.res +++ b/jscomp/test/inline_string_test.res @@ -1,4 +1,4 @@ -@@bs.config({no_export: no_export}) +@@config({no_export: no_export}) type t = | A_list | A_hashtable diff --git a/jscomp/test/jsxv4_newtype.res b/jscomp/test/jsxv4_newtype.res index 8989c189981..62919a82848 100644 --- a/jscomp/test/jsxv4_newtype.res +++ b/jscomp/test/jsxv4_newtype.res @@ -1,4 +1,4 @@ -@@bs.config({ +@@config({ flags: ["-bs-jsx", "4"], }) diff --git a/jscomp/test/key_word_property.res b/jscomp/test/key_word_property.res index cece2e9d254..d5282aa5c6d 100644 --- a/jscomp/test/key_word_property.res +++ b/jscomp/test/key_word_property.res @@ -1,4 +1,4 @@ -/* [@@@bs.config {flags = [| +/* [@@@config {flags = [| "-bs-package-output"; "es6:jscomp/test" |]}] */ diff --git a/jscomp/test/mario_game.res b/jscomp/test/mario_game.res index dfd833f693b..4dc4f048516 100644 --- a/jscomp/test/mario_game.res +++ b/jscomp/test/mario_game.res @@ -1,4 +1,4 @@ -@@bs.config({flags: ["-w", "a", "-bs-no-bin-annot"]}) +@@config({flags: ["-w", "a", "-bs-no-bin-annot"]}) module Actors: { type dir_1d = Left | Right diff --git a/jscomp/test/mt.res b/jscomp/test/mt.res index 5810bfac2a6..aaf6e225bc4 100644 --- a/jscomp/test/mt.res +++ b/jscomp/test/mt.res @@ -277,7 +277,7 @@ let old_from_promise_suites_donotuse = (name, suites: list<(string, Js.Promise.t Note that [require] is a file local value, we need type [require] -let is_top : unit -> bool = [%bs.raw{| +let is_top : unit -> bool = [%raw{| function (_){ console.log('hi'); if (typeof require === "undefined"){ diff --git a/jscomp/test/mutable_uncurry_test.res b/jscomp/test/mutable_uncurry_test.res index 8acbd3401d5..3754f69662b 100644 --- a/jscomp/test/mutable_uncurry_test.res +++ b/jscomp/test/mutable_uncurry_test.res @@ -1,4 +1,4 @@ -@@bs.config({ +@@config({ flags: [ /* "-bs-diagnose" */ ], diff --git a/jscomp/test/number_lexer.mll b/jscomp/test/number_lexer.mll index b423508e9b7..56e7c458f3a 100644 --- a/jscomp/test/number_lexer.mll +++ b/jscomp/test/number_lexer.mll @@ -1,5 +1,5 @@ { -external log : string -> unit = "caml_alloc_dummy" [@@bs.val "console.log"] +external log : string -> unit = "caml_alloc_dummy" [@@val "console.log"] let l = #if BS then log diff --git a/jscomp/test/obj_magic_test.res b/jscomp/test/obj_magic_test.res index eaed75b5877..4c67bc866c7 100644 --- a/jscomp/test/obj_magic_test.res +++ b/jscomp/test/obj_magic_test.res @@ -1,4 +1,4 @@ -@@bs.config({ +@@config({ flags: [ /* "-drawlambda" */ ], diff --git a/jscomp/test/ocaml_re_test.res b/jscomp/test/ocaml_re_test.res index d4b40171c66..c75c80134b5 100644 --- a/jscomp/test/ocaml_re_test.res +++ b/jscomp/test/ocaml_re_test.res @@ -1,4 +1,4 @@ -@@bs.config({flags: ["-w", "a", "-bs-no-bin-annot"], no_export}) +@@config({flags: ["-w", "a", "-bs-no-bin-annot"], no_export}) let suites: ref = ref(list{}) let test_id = ref(0) let eq = (loc, x, y) => { diff --git a/jscomp/test/poly_empty_array.res b/jscomp/test/poly_empty_array.res index 63ee85b1566..06375bd6090 100644 --- a/jscomp/test/poly_empty_array.res +++ b/jscomp/test/poly_empty_array.res @@ -1,2 +1,2 @@ -@@bs.config({flags: ["-bs-unsafe-empty-array"]}) +@@config({flags: ["-bs-unsafe-empty-array"]}) let a = [] diff --git a/jscomp/test/poly_variant_test.res b/jscomp/test/poly_variant_test.res index c03dc4c7cf6..1a49b579f31 100644 --- a/jscomp/test/poly_variant_test.res +++ b/jscomp/test/poly_variant_test.res @@ -93,7 +93,7 @@ let register = readline => { /* external on : */ /* ([ `line of (string -> unit [@bs]) */ /* | `close of (unit -> unit [@bs])] */ -/* [@bs.string]) -> */ +/* [@string]) -> */ /* readline -> readline = */ /* "on" [@@send] */ @send diff --git a/jscomp/test/polyvar_test.res b/jscomp/test/polyvar_test.res index 7758f58f304..ed27d1cc3e8 100644 --- a/jscomp/test/polyvar_test.res +++ b/jscomp/test/polyvar_test.res @@ -1,4 +1,4 @@ -@@bs.config(no_export) +@@config(no_export) let f = x => switch x { diff --git a/jscomp/test/prepend_data_ffi.res b/jscomp/test/prepend_data_ffi.res index b074bc1acf0..13a506b801e 100644 --- a/jscomp/test/prepend_data_ffi.res +++ b/jscomp/test/prepend_data_ffi.res @@ -66,7 +66,7 @@ external on_exit_slice5: ( ) => unit = "xx" /** - TODO: @send conflicts with bs.val: better error message + TODO: @send conflicts with @val: better error message */ let f = (x: t) => { x->on_exit_slice1(__LINE__, [1, 2, 3]) diff --git a/jscomp/test/rec_module_opt.res b/jscomp/test/rec_module_opt.res index 816cf1deede..a3e36cdda7a 100644 --- a/jscomp/test/rec_module_opt.res +++ b/jscomp/test/rec_module_opt.res @@ -1,4 +1,4 @@ -@@bs.config({ +@@config({ flags: [ /* "-drawlambda"; */ /* "-dlambda"; */ diff --git a/jscomp/test/record_debug_test.res b/jscomp/test/record_debug_test.res index 208c09826c6..8fed66a72c4 100644 --- a/jscomp/test/record_debug_test.res +++ b/jscomp/test/record_debug_test.res @@ -1,4 +1,4 @@ -/* [@@@bs.config {flags = [|"-dsource"|]}] */ +/* [@@@config {flags = [|"-dsource"|]}] */ let suites: ref = ref(list{}) let test_id = ref(0) let eq = (loc, x, y) => Mt.eq_suites(~test_id, ~suites, loc, x, y) diff --git a/jscomp/test/recursive_react_component.res b/jscomp/test/recursive_react_component.res index c6437ceb539..8e2756aa797 100644 --- a/jscomp/test/recursive_react_component.res +++ b/jscomp/test/recursive_react_component.res @@ -1,4 +1,4 @@ -@@bs.config({ +@@config({ flags: [ "-bs-jsx", "3", // "-dsource", diff --git a/jscomp/test/string_get_set_test.res b/jscomp/test/string_get_set_test.res index 6399809a571..3e9b4b076a6 100644 --- a/jscomp/test/string_get_set_test.res +++ b/jscomp/test/string_get_set_test.res @@ -1,4 +1,4 @@ -@@bs.config({no_export: no_export}) +@@config({no_export: no_export}) let \".%()" = (s: string, i) => String.get(s, i) Mt.from_pair_suites(__FILE__, list{(__LOC__, _ => Eq(\".%()"("h", 0), 'h'))}) diff --git a/jscomp/test/test.res b/jscomp/test/test.res index 0a1c7a2c1f0..befbb1b7caa 100644 --- a/jscomp/test/test.res +++ b/jscomp/test/test.res @@ -8,7 +8,7 @@ let a = external file : string option = "__filename" -[@@bs.val] [@@return{undefined_to_opt}] +[@@val] [@@return{undefined_to_opt}] let a = diff --git a/jscomp/test/test_int_map_find.res b/jscomp/test/test_int_map_find.res index d205fa2cf0b..df1ba9ab83d 100644 --- a/jscomp/test/test_int_map_find.res +++ b/jscomp/test/test_int_map_find.res @@ -13,7 +13,7 @@ include ( list{(10, 'a'), (3, 'b'), (7, 'c'), (20, 'd')}, ) - /* external log : 'a -> unit = "" [@@bs.val "console.log"] */ + /* external log : 'a -> unit = "" [@@val "console.log"] */ let assert_test = () => if IntMap.find(10, m) == 'a' { diff --git a/jscomp/test/tramp_fib.res b/jscomp/test/tramp_fib.res index da165a9e42e..92dd521e260 100644 --- a/jscomp/test/tramp_fib.res +++ b/jscomp/test/tramp_fib.res @@ -1,4 +1,4 @@ -@@bs.config({flags: ["-w", "a", "-bs-noassertfalse"]}) +@@config({flags: ["-w", "a", "-bs-noassertfalse"]}) let suites: ref = ref(list{}) let test_id = ref(0) diff --git a/jscomp/test/unit_undefined_test.res b/jscomp/test/unit_undefined_test.res index 492cc01e38c..72138880f1c 100644 --- a/jscomp/test/unit_undefined_test.res +++ b/jscomp/test/unit_undefined_test.res @@ -1,4 +1,4 @@ -@@bs.config({ +@@config({ flags: [ /* "-bs-diagnose" */ /* ; "-drawlambda" */ diff --git a/jscomp/test/unsafe_ppx_test.res b/jscomp/test/unsafe_ppx_test.res index 7bc594e0454..2b4b48eaf6a 100644 --- a/jscomp/test/unsafe_ppx_test.res +++ b/jscomp/test/unsafe_ppx_test.res @@ -3,7 +3,7 @@ let x: string = %raw(`"\\x01\\x02\\x03"`) let max: (. float, float) => float = %raw("Math.max") let u = v => max(. 1., v) -/* let max2 : float -> float -> float = [%bs.raw {Math.max} ] */ +/* let max2 : float -> float -> float = [%raw {Math.max} ] */ %%raw(` function $$test(x,y){