diff --git a/CHANGELOG.md b/CHANGELOG.md index 637f479aad..42f8ffe797 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ - Fix missing checks for duplicate literals in variants with payloads. https://github.com/rescript-lang/rescript/pull/7441 - Fix printer removing private for empty record. https://github.com/rescript-lang/rescript/pull/7448 - Fix: handle dynamic imports with module aliases. https://github.com/rescript-lang/rescript/pull/7452 +- Fix missing unescaping when accessing prop with exotic name. https://github.com/rescript-lang/rescript/pull/7469 #### :house: Internal diff --git a/compiler/core/js_dump_property.ml b/compiler/core/js_dump_property.ml index 6df115808b..3b716be029 100644 --- a/compiler/core/js_dump_property.ml +++ b/compiler/core/js_dump_property.ml @@ -68,6 +68,7 @@ let obj_property_no_need_quot s = ]} *) let property_access f s = + let s = Ext_ident.unwrap_uppercase_exotic s in if obj_property_no_need_quot s then ( P.string f L.dot; P.string f s) diff --git a/tests/tests/src/gpr_7431_test.mjs b/tests/tests/src/gpr_7431_test.mjs new file mode 100644 index 0000000000..d7d2cee283 --- /dev/null +++ b/tests/tests/src/gpr_7431_test.mjs @@ -0,0 +1,13 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let x = { + MyWeirdProp: Math.random() +}; + +console.log(x.MyWeirdProp); + +export { + x, +} +/* x Not a pure module */ diff --git a/tests/tests/src/gpr_7431_test.res b/tests/tests/src/gpr_7431_test.res new file mode 100644 index 0000000000..35e931b198 --- /dev/null +++ b/tests/tests/src/gpr_7431_test.res @@ -0,0 +1,5 @@ +type props = {\"MyWeirdProp": float} + +let x = {\"MyWeirdProp": Math.random()} + +Console.log(x.\"MyWeirdProp") diff --git a/tests/tests/src/jsx_preserve_test.mjs b/tests/tests/src/jsx_preserve_test.mjs index 529ab697ef..5a3ddc0ca0 100644 --- a/tests/tests/src/jsx_preserve_test.mjs +++ b/tests/tests/src/jsx_preserve_test.mjs @@ -147,7 +147,7 @@ let _external_component_with_children = function Jsx_preserve_test$MyWeirdComponent(props) { return

{"foo"} - {props["\\\"MyWeirdProp\""]} + {props.MyWeirdProp}

; }