diff --git a/CHANGELOG.md b/CHANGELOG.md index 22fe0b922e..9f97940ee2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ - `rescript build` will always build its dependency by default. The argument `-with-deps` is not needed anymore. https://github.com/rescript-lang/rescript-compiler/pull/6350 +#### :boom: Breaking Change + +- Stop mangling object field names. If you had objects with field names containing "__" or leading "_", they won't be mangled in the compiled JavaScript and represented as it is without changes. https://github.com/rescript-lang/rescript-compiler/pull/6354 + #### :bug: Bug Fix - Fixed outcome printer resolution of uncurried config. https://github.com/rescript-lang/rescript-compiler/pull/6353 diff --git a/jscomp/common/lam_methname.ml b/jscomp/common/lam_methname.ml deleted file mode 100644 index 2696e783a5..0000000000 --- a/jscomp/common/lam_methname.ml +++ /dev/null @@ -1,148 +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. *) - -(** - {[ - _open -> open - _in -> in - _MAX_LENGTH -> MAX_LENGTH - _Capital -> Capital - - _open__ -> _open - open__ -> open - - _'x -> 'x - - _Capital__ -> _Capital - _MAX__ -> _MAX - __ -> __ - __x -> __x - ___ -> _ - ____ -> __ - _ -> _ (* error *) - - - ]} - First we scan '__' from end to start, - If found, discard it. - Otherwise, check if it is [_ + keyword] or followed by capital letter, - If so, discard [_]. - - Limitations: user can not have [_Capital__, _Capital__other] to - make it all compile to [Capital]. - Keyword is fine [open__, open__other]. - So we loose polymorphism over capital letter. - It is okay, otherwise, if [_Captial__] is interpreted as [Capital], then - there is no way to express [_Capital] -*) - -(* Copied from [ocaml/parsing/lexer.mll] *) -let key_words = - Hash_set_string.of_array - [| - "and"; - "as"; - "assert"; - "begin"; - "class"; - "constraint"; - "do"; - "done"; - "downto"; - "else"; - "end"; - "exception"; - "external"; - "false"; - "for"; - "fun"; - "function"; - "functor"; - "if"; - "in"; - "include"; - "inherit"; - "initializer"; - "lazy"; - "let"; - "match"; - "method"; - "module"; - "mutable"; - "new"; - "nonrec"; - "object"; - "of"; - "open"; - "or"; - (* "parser", PARSER; *) - "private"; - "rec"; - "sig"; - "struct"; - "then"; - "to"; - "true"; - "try"; - "type"; - "val"; - "virtual"; - "when"; - "while"; - "with"; - "mod"; - "land"; - "lor"; - "lxor"; - "lsl"; - "lsr"; - "asr"; - |] - -let double_underscore = "__" - -(*https://caml.inria.fr/pub/docs/manual-ocaml/lex.html - {[ - - label-name ::= lowercase-ident - ]} -*) -let valid_start_char x = match x with '_' | 'a' .. 'z' -> true | _ -> false - -let translate name = - assert (not @@ Ext_string.is_empty name); - let i = Ext_string.rfind ~sub:double_underscore name in - if i < 0 then - let name_len = String.length name in - if name.[0] = '_' then - let try_key_word = String.sub name 1 (name_len - 1) in - if - name_len > 1 - && ((not (valid_start_char try_key_word.[0])) - || Hash_set_string.mem key_words try_key_word) - then try_key_word - else name - else name - else if i = 0 then name - else String.sub name 0 i diff --git a/jscomp/common/lam_methname.mli b/jscomp/common/lam_methname.mli deleted file mode 100644 index 07f9390df7..0000000000 --- a/jscomp/common/lam_methname.mli +++ /dev/null @@ -1,25 +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. *) - -val translate : string -> string diff --git a/jscomp/core/lam_convert.ml b/jscomp/core/lam_convert.ml index 8097410fa2..a26dad1e07 100644 --- a/jscomp/core/lam_convert.ml +++ b/jscomp/core/lam_convert.ml @@ -602,10 +602,9 @@ let convert (exports : Set_ident.t) (lam : Lambda.lambda) : let setter = Ext_string.ends_with name Literals.setter_suffix in let property = if setter then - Lam_methname.translate - (String.sub name 0 - (String.length name - Literals.setter_suffix_len)) - else Lam_methname.translate name + (String.sub name 0 + (String.length name - Literals.setter_suffix_len)) + else name in prim ~primitive:(Pjs_unsafe_downgrade { name = property; setter }) diff --git a/jscomp/frontend/ast_external_process.ml b/jscomp/frontend/ast_external_process.ml index 2267526bbb..074b7cc6aa 100644 --- a/jscomp/frontend/ast_external_process.ml +++ b/jscomp/frontend/ast_external_process.ml @@ -406,20 +406,17 @@ let process_obj (loc : Location.t) (st : external_desc) (prim_name : string) param_type :: arg_types, result_types ) | Arg_cst _ -> - let s = Lam_methname.translate name in - ( {obj_arg_label = External_arg_spec.obj_label s; obj_arg_type}, + ( {obj_arg_label = External_arg_spec.obj_label name; obj_arg_type}, arg_types, (* ignored in [arg_types], reserved in [result_types] *) result_types ) | Nothing -> - let s = Lam_methname.translate name in - ( {obj_arg_label = External_arg_spec.obj_label s; obj_arg_type}, + ( {obj_arg_label = External_arg_spec.obj_label name; obj_arg_type}, param_type :: arg_types, Parsetree.Otag ({Asttypes.txt = name; loc}, [], ty) :: result_types ) | Int _ -> - let s = Lam_methname.translate name in - ( {obj_arg_label = External_arg_spec.obj_label s; obj_arg_type}, + ( {obj_arg_label = External_arg_spec.obj_label name; obj_arg_type}, param_type :: arg_types, Otag ( {Asttypes.txt = name; loc}, @@ -427,8 +424,7 @@ let process_obj (loc : Location.t) (st : external_desc) (prim_name : string) Ast_literal.type_int ~loc () ) :: result_types ) | Poly_var_string _ -> - let s = Lam_methname.translate name in - ( {obj_arg_label = External_arg_spec.obj_label s; obj_arg_type}, + ( {obj_arg_label = External_arg_spec.obj_label name; obj_arg_type}, param_type :: arg_types, Otag ( {Asttypes.txt = name; loc}, @@ -453,7 +449,6 @@ let process_obj (loc : Location.t) (st : external_desc) (prim_name : string) param_type :: arg_types, result_types ) | Nothing -> - let s = Lam_methname.translate name in let for_sure_not_nested = match ty.ptyp_desc with | Ptyp_constr ({txt = Lident txt; _}, []) -> @@ -462,7 +457,7 @@ let process_obj (loc : Location.t) (st : external_desc) (prim_name : string) in ( { obj_arg_label = - External_arg_spec.optional for_sure_not_nested s; + External_arg_spec.optional for_sure_not_nested name; obj_arg_type; }, param_type :: arg_types, @@ -472,9 +467,8 @@ let process_obj (loc : Location.t) (st : external_desc) (prim_name : string) Ast_comb.to_undefined_type loc ty ) :: result_types ) | Int _ -> - let s = Lam_methname.translate name in ( { - obj_arg_label = External_arg_spec.optional true s; + obj_arg_label = External_arg_spec.optional true name; obj_arg_type; }, param_type :: arg_types, @@ -485,9 +479,8 @@ let process_obj (loc : Location.t) (st : external_desc) (prim_name : string) @@ Ast_literal.type_int ~loc () ) :: result_types ) | Poly_var_string _ -> - let s = Lam_methname.translate name in ( { - obj_arg_label = External_arg_spec.optional true s; + obj_arg_label = External_arg_spec.optional true name; obj_arg_type; }, param_type :: arg_types, @@ -961,7 +954,7 @@ let pval_prim_of_labels (labels : string Asttypes.loc list) = ([] : External_arg_spec.obj_params) (fun p arg_kinds -> let obj_arg_label = - External_arg_spec.obj_label (Lam_methname.translate p.txt) + External_arg_spec.obj_label (p.txt) in {obj_arg_type = Nothing; obj_arg_label} :: arg_kinds) in @@ -974,7 +967,7 @@ let pval_prim_of_option_labels (labels : (bool * string Asttypes.loc) list) (if ends_with_unit then [External_arg_spec.empty_kind Extern_unit] else []) (fun (is_option, p) arg_kinds -> - let label_name = Lam_methname.translate p.txt in + let label_name = p.txt in let obj_arg_label = if is_option then External_arg_spec.optional false label_name else External_arg_spec.obj_label label_name diff --git a/jscomp/test/class_type_ffi_test.js b/jscomp/test/class_type_ffi_test.js index c412f333f2..98bacc3ec0 100644 --- a/jscomp/test/class_type_ffi_test.js +++ b/jscomp/test/class_type_ffi_test.js @@ -4,7 +4,7 @@ var Curry = require("../../lib/js/curry.js"); function test_set(x) { - x.length = 3; + x.length__aux = 3; } function ff(fn, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) { diff --git a/jscomp/test/gpr_1072.js b/jscomp/test/gpr_1072.js index ccf957102d..157ac2f688 100644 --- a/jscomp/test/gpr_1072.js +++ b/jscomp/test/gpr_1072.js @@ -49,26 +49,26 @@ var v_ice_cream4 = { }; var vv = { - x: 3 + x__ignore: 3 }; var int_expect = { - x: 0 + x__ignore: 0 }; var int_expect2 = { - x: 0 + x__ignore: 0 }; var int_expects_0 = {}; var int_expects_1 = { hd: { - x: 2 + x__ignore: 2 }, tl: { hd: { - x: 3 + x__ignore: 3 }, tl: /* [] */0 } @@ -112,7 +112,7 @@ var v_mk6_1 = { }; var mk_u = { - x: 0 + x__ignore: 0 }; var v_mk7_0 = { diff --git a/jscomp/test/gpr_1409_test.js b/jscomp/test/gpr_1409_test.js index b17cc36f98..9d9dc6ae81 100644 --- a/jscomp/test/gpr_1409_test.js +++ b/jscomp/test/gpr_1409_test.js @@ -79,10 +79,10 @@ function test3(_open, xx__hi) { hi: 2 }; if (_open !== undefined) { - tmp.open = _open; + tmp._open = _open; } if (xx__hi !== undefined) { - tmp.xx = xx__hi; + tmp.xx__hi = xx__hi; } return tmp; } @@ -90,11 +90,11 @@ function test3(_open, xx__hi) { function test4(_open, xx__hi) { console.log("no inlin"); var tmp = { - open: _open, + _open: _open, hi: 2 }; if (xx__hi !== undefined) { - tmp.xx = xx__hi; + tmp.xx__hi = xx__hi; } return tmp; } @@ -106,11 +106,11 @@ function test5(f, x) { }; var tmp$1 = Curry._1(f, x); if (tmp$1 !== undefined) { - tmp.open = tmp$1; + tmp._open = tmp$1; } var tmp$2 = Curry._1(f, x); if (tmp$2 !== undefined) { - tmp.xx = tmp$2; + tmp.xx__hi = tmp$2; } return tmp; } @@ -125,11 +125,11 @@ function test6(f, x) { }; var tmp$1 = (x$1.contents = x$1.contents + 1 | 0, x$1.contents); if (tmp$1 !== undefined) { - tmp.open = tmp$1; + tmp._open = tmp$1; } var tmp$2 = f(x$1); if (tmp$2 !== undefined) { - tmp.xx = tmp$2; + tmp.xx__hi = tmp$2; } return tmp; } @@ -146,7 +146,7 @@ eq("File \"gpr_1409_test.res\", line 69, characters 3-10", keys({ eq("File \"gpr_1409_test.res\", line 71, characters 3-10", keys({ hd: "hi", tl: { - hd: "open", + hd: "_open", tl: /* [] */0 } }, Object.keys(test3(2, undefined))), true); @@ -154,9 +154,9 @@ eq("File \"gpr_1409_test.res\", line 71, characters 3-10", keys({ eq("File \"gpr_1409_test.res\", line 73, characters 3-10", keys({ hd: "hi", tl: { - hd: "open", + hd: "_open", tl: { - hd: "xx", + hd: "xx__hi", tl: /* [] */0 } } diff --git a/jscomp/test/gpr_1409_test.res b/jscomp/test/gpr_1409_test.res index 05debf47d8..934b850bf3 100644 --- a/jscomp/test/gpr_1409_test.res +++ b/jscomp/test/gpr_1409_test.res @@ -68,8 +68,8 @@ let keys = (xs, ys) => eq(__LOC__, keys(list{"hi"}, Js.Obj.keys(test3(None, None))), true) -eq(__LOC__, keys(list{"hi", "open"}, Js.Obj.keys(test3(Some(2), None))), true) +eq(__LOC__, keys(list{"hi", "_open"}, Js.Obj.keys(test3(Some(2), None))), true) -eq(__LOC__, keys(list{"hi", "open", "xx"}, Js.Obj.keys(test3(Some(2), Some(2)))), true) +eq(__LOC__, keys(list{"hi", "_open", "xx__hi"}, Js.Obj.keys(test3(Some(2), Some(2)))), true) Mt.from_pair_suites(__MODULE__, suites.contents) diff --git a/jscomp/test/gpr_1943_test.js b/jscomp/test/gpr_1943_test.js index a981b27609..ed12bfff36 100644 --- a/jscomp/test/gpr_1943_test.js +++ b/jscomp/test/gpr_1943_test.js @@ -30,23 +30,23 @@ function eq(loc, x, y) { function f(x) { return [ - x["003"], - x[50], - x["50x"], + x._003, + x._50, + x._50x, x.__50, x.__50x, - x["50x'"], + x["_50x'"], x["x'"] ]; } var v = f({ - "003": 0, - "50": 1, - "50x": 2, + _003: 0, + _50: 1, + _50x: 2, __50: 3, __50x: 4, - "50x'": 5, + "_50x'": 5, "x'": 6 }); diff --git a/jscomp/test/gpr_1946_test.js b/jscomp/test/gpr_1946_test.js index 0a577a27dd..7b1c6c2854 100644 --- a/jscomp/test/gpr_1946_test.js +++ b/jscomp/test/gpr_1946_test.js @@ -21,8 +21,8 @@ var x = ({ }).x; var zz = ({ - "5": 3 - })[5]; + _5: 3 + })._5; var h = { "0123": 2, @@ -37,8 +37,8 @@ function f(id) { } eq("File \"gpr_1946_test.res\", line 24, characters 3-10", ({ - "5": 3 - })[5], 3); + _5: 3 + })._5, 3); eq("File \"gpr_1946_test.res\", line 25, characters 3-10", [ 2, @@ -49,7 +49,7 @@ eq("File \"gpr_1946_test.res\", line 25, characters 3-10", [ ]); console.log(({ - "5": 3 + _5: 3 }).TAG); Mt.from_pair_suites("File \"gpr_1946_test.res\", line 28, characters 20-27", suites.contents); diff --git a/jscomp/test/gpr_459_test.js b/jscomp/test/gpr_459_test.js index 24e1dd138d..660dd23097 100644 --- a/jscomp/test/gpr_459_test.js +++ b/jscomp/test/gpr_459_test.js @@ -29,16 +29,16 @@ function eq(loc, x, y) { } var uu = { - "'x": 3 + "_'x": 3 }; var uu2 = { - then: 1, + _then: 1, catch: 2, - "'x": 3 + "_'x": 3 }; -var hh = uu["'x"]; +var hh = uu["_'x"]; eq("File \"gpr_459_test.res\", line 23, characters 12-19", hh, 3); @@ -47,9 +47,9 @@ eq("File \"gpr_459_test.res\", line 25, characters 12-19", [ 2, 3 ], [ - uu2.then, + uu2._then, uu2.catch, - uu2["'x"] + uu2["_'x"] ]); Mt.from_pair_suites("Gpr_459_test", suites.contents); diff --git a/jscomp/test/key_word_property2.js b/jscomp/test/key_word_property2.js index d15778400a..39da11a331 100644 --- a/jscomp/test/key_word_property2.js +++ b/jscomp/test/key_word_property2.js @@ -5,7 +5,7 @@ var Export_keyword = require("./export_keyword.js"); function test2(v) { return { - open: v.open, + _open: v._open, window: v.window }; } @@ -13,7 +13,7 @@ function test2(v) { function test(p) { return [ p.catch, - p.then + p._then ]; } diff --git a/jscomp/test/method_name_test.js b/jscomp/test/method_name_test.js index 67903c7b7d..75e9173f55 100644 --- a/jscomp/test/method_name_test.js +++ b/jscomp/test/method_name_test.js @@ -31,30 +31,30 @@ function eq(loc, x, y) { function f(x, i, file, v) { Curry._1(x.case, i); - Curry._2(x.case, i, v); - Curry._1(x.open, file); - Curry._1(x.open, file); - return x.MAX_LENGTH; + Curry._2(x.case__set, i, v); + Curry._1(x._open, file); + Curry._1(x.open__, file); + return x._MAX_LENGTH; } function ff(x, i, v) { - x.make = v; + x.make__config = v; x.make_config = v; - Curry._1(x.case, i); - return Curry._1(x._open, 3); + Curry._1(x.case__unsafe, i); + return Curry._1(x._open__, 3); } var u = { - "Content'type": "x" + "_Content'type": "x" }; var h = { - open: 3, - end: 32 + _open: 3, + _end: 32 }; function hg(x) { - return x.open + x.end | 0; + return x._open + x._end | 0; } eq("File \"method_name_test.res\", line 39, characters 12-19", 35, hg(h)); diff --git a/jscomp/test/name_mangle_test.js b/jscomp/test/name_mangle_test.js index 09330e2dc5..b5d42a4dca 100644 --- a/jscomp/test/name_mangle_test.js +++ b/jscomp/test/name_mangle_test.js @@ -29,57 +29,57 @@ function eq(loc, x, y) { } function f0(x) { - var old = x.open; - x.open = old + 1 | 0; - return x.open; + var old = x._open; + x._open = old + 1 | 0; + return x._open; } function f1(x) { - var old = x.in; - x.in = old + 1 | 0; - return x.in; + var old = x._in; + x._in = old + 1 | 0; + return x._in; } function f2(x) { - var old = x.MAX_LENGTH; - x.MAX_LENGTH = old + 1 | 0; - return x.MAX_LENGTH; + var old = x._MAX_LENGTH; + x._MAX_LENGTH = old + 1 | 0; + return x._MAX_LENGTH; } function f3(x) { - var old = x.Capital; - x.Capital = old + 1 | 0; - return x.Capital; + var old = x._Capital; + x._Capital = old + 1 | 0; + return x._Capital; } function f4(x) { - var old = x._open; - x._open = old + 1 | 0; - return x._open; + var old = x._open__; + x._open__ = old + 1 | 0; + return x._open__; } function f5(x) { - var old = x.open; - x.open = old + 1 | 0; - return x.open; + var old = x.open__; + x.open__ = old + 1 | 0; + return x.open__; } function f6(x) { - var old = x["'x"]; - x["'x"] = old + 1 | 0; - return x["'x"]; + var old = x["_'x"]; + x["_'x"] = old + 1 | 0; + return x["_'x"]; } function f7(x) { - var old = x._Capital; - x._Capital = old + 1 | 0; - return x._Capital; + var old = x._Capital__; + x._Capital__ = old + 1 | 0; + return x._Capital__; } function f8(x) { - var old = x._MAX; - x._MAX = old + 1 | 0; - return x._MAX; + var old = x._MAX__; + x._MAX__ = old + 1 | 0; + return x._MAX__; } function f9(x) { @@ -95,42 +95,42 @@ function f10(x) { } function f11(x) { - var old = x._; - x._ = old + 1 | 0; - return x._; + var old = x.___; + x.___ = old + 1 | 0; + return x.___; } function f12(x) { - var old = x.__; - x.__ = old + 1 | 0; - return x.__; + var old = x.____; + x.____ = old + 1 | 0; + return x.____; } -eq("File \"name_mangle_test.res\", line 94, characters 5-12", f0({open:0}), 1); +eq("File \"name_mangle_test.res\", line 94, characters 5-12", f0({_open:0}), 1); -eq("File \"name_mangle_test.res\", line 95, characters 5-12", f1({in:0}), 1); +eq("File \"name_mangle_test.res\", line 95, characters 5-12", f1({_in:0}), 1); -eq("File \"name_mangle_test.res\", line 96, characters 5-12", f2({MAX_LENGTH:0}), 1); +eq("File \"name_mangle_test.res\", line 96, characters 5-12", f2({_MAX_LENGTH:0}), 1); -eq("File \"name_mangle_test.res\", line 97, characters 5-12", f3({Capital:0}), 1); +eq("File \"name_mangle_test.res\", line 97, characters 5-12", f3({_Capital:0}), 1); -eq("File \"name_mangle_test.res\", line 98, characters 5-12", f4({_open:0}), 1); +eq("File \"name_mangle_test.res\", line 98, characters 5-12", f4({_open__:0}), 1); -eq("File \"name_mangle_test.res\", line 99, characters 5-12", f5({open:0}), 1); +eq("File \"name_mangle_test.res\", line 99, characters 5-12", f5({open__:0}), 1); -eq("File \"name_mangle_test.res\", line 100, characters 5-12", f6({ "'x" :0}), 1); +eq("File \"name_mangle_test.res\", line 100, characters 5-12", f6({ "_'x" :0}), 1); -eq("File \"name_mangle_test.res\", line 101, characters 5-12", f7({_Capital:0}), 1); +eq("File \"name_mangle_test.res\", line 101, characters 5-12", f7({_Capital__:0}), 1); -eq("File \"name_mangle_test.res\", line 102, characters 5-12", f8({_MAX:0}), 1); +eq("File \"name_mangle_test.res\", line 102, characters 5-12", f8({_MAX__:0}), 1); eq("File \"name_mangle_test.res\", line 103, characters 5-12", f9({__:0}), 1); eq("File \"name_mangle_test.res\", line 104, characters 5-12", f10({__x:0}), 1); -eq("File \"name_mangle_test.res\", line 105, characters 5-12", f11({_:0}), 1); +eq("File \"name_mangle_test.res\", line 105, characters 5-12", f11({___:0}), 1); -eq("File \"name_mangle_test.res\", line 106, characters 5-12", f12({__:0}), 1); +eq("File \"name_mangle_test.res\", line 106, characters 5-12", f12({____:0}), 1); Mt.from_pair_suites("File \"name_mangle_test.res\", line 109, characters 20-27", suites.contents); diff --git a/jscomp/test/name_mangle_test.res b/jscomp/test/name_mangle_test.res index e8ef00f69e..15ae63f98c 100644 --- a/jscomp/test/name_mangle_test.res +++ b/jscomp/test/name_mangle_test.res @@ -91,19 +91,19 @@ let f12 = (x: {@set "____": int}) => { } let () = { - eq(__LOC__, f0(%raw("{open:0}")), 1) - eq(__LOC__, f1(%raw("{in:0}")), 1) - eq(__LOC__, f2(%raw("{MAX_LENGTH:0}")), 1) - eq(__LOC__, f3(%raw("{Capital:0}")), 1) - eq(__LOC__, f4(%raw("{_open:0}")), 1) - eq(__LOC__, f5(%raw("{open:0}")), 1) - eq(__LOC__, f6(%raw(`{ "'x" :0} `)), 1) - eq(__LOC__, f7(%raw("{_Capital:0}")), 1) - eq(__LOC__, f8(%raw("{_MAX:0}")), 1) + eq(__LOC__, f0(%raw("{_open:0}")), 1) + eq(__LOC__, f1(%raw("{_in:0}")), 1) + eq(__LOC__, f2(%raw("{_MAX_LENGTH:0}")), 1) + eq(__LOC__, f3(%raw("{_Capital:0}")), 1) + eq(__LOC__, f4(%raw("{_open__:0}")), 1) + eq(__LOC__, f5(%raw("{open__:0}")), 1) + eq(__LOC__, f6(%raw(`{ "_'x" :0} `)), 1) + eq(__LOC__, f7(%raw("{_Capital__:0}")), 1) + eq(__LOC__, f8(%raw("{_MAX__:0}")), 1) eq(__LOC__, f9(%raw("{__:0}")), 1) eq(__LOC__, f10(%raw("{__x:0}")), 1) - eq(__LOC__, f11(%raw("{_:0}")), 1) - eq(__LOC__, f12(%raw("{__:0}")), 1) + eq(__LOC__, f11(%raw("{___:0}")), 1) + eq(__LOC__, f12(%raw("{____:0}")), 1) } Mt.from_pair_suites(__LOC__, suites.contents)