diff --git a/CHANGELOG.md b/CHANGELOG.md index f2478cabb1..6b789fd2cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ #### :bug: Bug fix - Revert Throws an instance of JavaScript's `new Error()` and adds the extension payload for `cause` option introduced in https://github.com/rescript-lang/rescript-compiler/pull/6611. https://github.com/rescript-lang/rescript-compiler/pull/7016 +- Fix dict literals error. https://github.com/rescript-lang/rescript-compiler/pull/7019 # 12.0.0-alpha.2 diff --git a/jscomp/others/release.ninja b/jscomp/others/release.ninja index 24ad04df4f..bcb6f32fed 100644 --- a/jscomp/others/release.ninja +++ b/jscomp/others/release.ninja @@ -150,5 +150,7 @@ o others/dom_storage.cmi others/dom_storage.cmj : cc others/dom_storage.res | ot o others/dom_storage2.cmi others/dom_storage2.cmj : cc others/dom_storage2.res | others/belt_internals.cmi others/js.cmi $bsc o others/runtime_deriving.cmj : cc_cmi others/runtime_deriving.res | others/belt_internals.cmi others/js.cmi others/runtime_deriving.cmi $bsc js_pkg o others/runtime_deriving.cmi : cc others/runtime_deriving.resi | others/belt_internals.cmi others/js.cmi $bsc +o others/runtime_dict.cmj : cc_cmi others/runtime_dict.res | others/belt_internals.cmi others/js.cmi others/runtime_dict.cmi $bsc js_pkg +o others/runtime_dict.cmi : cc others/runtime_dict.resi | others/belt_internals.cmi others/js.cmi $bsc o others/runtime_promise.cmi others/runtime_promise.cmj : cc others/runtime_promise.res | others/belt_internals.cmi others/js.cmi $bsc -o others : phony others/belt_Array.cmi others/belt_Array.cmj others/belt_Float.cmi others/belt_Float.cmj others/belt_HashMap.cmi others/belt_HashMap.cmj others/belt_HashMapInt.cmi others/belt_HashMapInt.cmj others/belt_HashMapString.cmi others/belt_HashMapString.cmj others/belt_HashSet.cmi others/belt_HashSet.cmj others/belt_HashSetInt.cmi others/belt_HashSetInt.cmj others/belt_HashSetString.cmi others/belt_HashSetString.cmj others/belt_Id.cmi others/belt_Id.cmj others/belt_Int.cmi others/belt_Int.cmj others/belt_List.cmi others/belt_List.cmj others/belt_Map.cmi others/belt_Map.cmj others/belt_MapDict.cmi others/belt_MapDict.cmj others/belt_MapInt.cmi others/belt_MapInt.cmj others/belt_MapString.cmi others/belt_MapString.cmj others/belt_MutableMap.cmi others/belt_MutableMap.cmj others/belt_MutableMapInt.cmi others/belt_MutableMapInt.cmj others/belt_MutableMapString.cmi others/belt_MutableMapString.cmj others/belt_MutableQueue.cmi others/belt_MutableQueue.cmj others/belt_MutableSet.cmi others/belt_MutableSet.cmj others/belt_MutableSetInt.cmi others/belt_MutableSetInt.cmj others/belt_MutableSetString.cmi others/belt_MutableSetString.cmj others/belt_MutableStack.cmi others/belt_MutableStack.cmj others/belt_Option.cmi others/belt_Option.cmj others/belt_Range.cmi others/belt_Range.cmj others/belt_Result.cmi others/belt_Result.cmj others/belt_Set.cmi others/belt_Set.cmj others/belt_SetDict.cmi others/belt_SetDict.cmj others/belt_SetInt.cmi others/belt_SetInt.cmj others/belt_SetString.cmi others/belt_SetString.cmj others/belt_SortArray.cmi others/belt_SortArray.cmj others/belt_SortArrayInt.cmi others/belt_SortArrayInt.cmj others/belt_SortArrayString.cmi others/belt_SortArrayString.cmj others/belt_internalAVLset.cmi others/belt_internalAVLset.cmj others/belt_internalAVLtree.cmi others/belt_internalAVLtree.cmj others/belt_internalBuckets.cmi others/belt_internalBuckets.cmj others/belt_internalBucketsType.cmi others/belt_internalBucketsType.cmj others/belt_internalMapInt.cmi others/belt_internalMapInt.cmj others/belt_internalMapString.cmi others/belt_internalMapString.cmj others/belt_internalSetBuckets.cmi others/belt_internalSetBuckets.cmj others/belt_internalSetInt.cmi others/belt_internalSetInt.cmj others/belt_internalSetString.cmi others/belt_internalSetString.cmj others/dom.cmi others/dom.cmj others/dom_storage.cmi others/dom_storage.cmj others/dom_storage2.cmi others/dom_storage2.cmj others/runtime_deriving.cmi others/runtime_deriving.cmj others/runtime_promise.cmi others/runtime_promise.cmj +o others : phony others/belt_Array.cmi others/belt_Array.cmj others/belt_Float.cmi others/belt_Float.cmj others/belt_HashMap.cmi others/belt_HashMap.cmj others/belt_HashMapInt.cmi others/belt_HashMapInt.cmj others/belt_HashMapString.cmi others/belt_HashMapString.cmj others/belt_HashSet.cmi others/belt_HashSet.cmj others/belt_HashSetInt.cmi others/belt_HashSetInt.cmj others/belt_HashSetString.cmi others/belt_HashSetString.cmj others/belt_Id.cmi others/belt_Id.cmj others/belt_Int.cmi others/belt_Int.cmj others/belt_List.cmi others/belt_List.cmj others/belt_Map.cmi others/belt_Map.cmj others/belt_MapDict.cmi others/belt_MapDict.cmj others/belt_MapInt.cmi others/belt_MapInt.cmj others/belt_MapString.cmi others/belt_MapString.cmj others/belt_MutableMap.cmi others/belt_MutableMap.cmj others/belt_MutableMapInt.cmi others/belt_MutableMapInt.cmj others/belt_MutableMapString.cmi others/belt_MutableMapString.cmj others/belt_MutableQueue.cmi others/belt_MutableQueue.cmj others/belt_MutableSet.cmi others/belt_MutableSet.cmj others/belt_MutableSetInt.cmi others/belt_MutableSetInt.cmj others/belt_MutableSetString.cmi others/belt_MutableSetString.cmj others/belt_MutableStack.cmi others/belt_MutableStack.cmj others/belt_Option.cmi others/belt_Option.cmj others/belt_Range.cmi others/belt_Range.cmj others/belt_Result.cmi others/belt_Result.cmj others/belt_Set.cmi others/belt_Set.cmj others/belt_SetDict.cmi others/belt_SetDict.cmj others/belt_SetInt.cmi others/belt_SetInt.cmj others/belt_SetString.cmi others/belt_SetString.cmj others/belt_SortArray.cmi others/belt_SortArray.cmj others/belt_SortArrayInt.cmi others/belt_SortArrayInt.cmj others/belt_SortArrayString.cmi others/belt_SortArrayString.cmj others/belt_internalAVLset.cmi others/belt_internalAVLset.cmj others/belt_internalAVLtree.cmi others/belt_internalAVLtree.cmj others/belt_internalBuckets.cmi others/belt_internalBuckets.cmj others/belt_internalBucketsType.cmi others/belt_internalBucketsType.cmj others/belt_internalMapInt.cmi others/belt_internalMapInt.cmj others/belt_internalMapString.cmi others/belt_internalMapString.cmj others/belt_internalSetBuckets.cmi others/belt_internalSetBuckets.cmj others/belt_internalSetInt.cmi others/belt_internalSetInt.cmj others/belt_internalSetString.cmi others/belt_internalSetString.cmj others/dom.cmi others/dom.cmj others/dom_storage.cmi others/dom_storage.cmj others/dom_storage2.cmi others/dom_storage2.cmj others/runtime_deriving.cmi others/runtime_deriving.cmj others/runtime_dict.cmi others/runtime_dict.cmj others/runtime_promise.cmi others/runtime_promise.cmj diff --git a/jscomp/runtime/caml_dict.res b/jscomp/others/runtime_dict.res similarity index 100% rename from jscomp/runtime/caml_dict.res rename to jscomp/others/runtime_dict.res diff --git a/jscomp/runtime/caml_dict.resi b/jscomp/others/runtime_dict.resi similarity index 100% rename from jscomp/runtime/caml_dict.resi rename to jscomp/others/runtime_dict.resi diff --git a/jscomp/runtime/release.ninja b/jscomp/runtime/release.ninja index aa3b6965ca..b848fd71bc 100644 --- a/jscomp/runtime/release.ninja +++ b/jscomp/runtime/release.ninja @@ -21,8 +21,6 @@ o runtime/caml_bigint.cmj : cc_cmi runtime/caml_bigint.res | runtime/caml_bigint o runtime/caml_bigint.cmi : cc runtime/caml_bigint.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_bytes.cmj : cc_cmi runtime/caml_bytes.res | runtime/caml_bytes.cmi o runtime/caml_bytes.cmi : cc runtime/caml_bytes.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj -o runtime/caml_dict.cmj : cc_cmi runtime/caml_dict.res | runtime/caml_dict.cmi -o runtime/caml_dict.cmi : cc runtime/caml_dict.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_exceptions.cmj : cc_cmi runtime/caml_exceptions.res | runtime/caml_exceptions.cmi o runtime/caml_exceptions.cmi : cc runtime/caml_exceptions.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_float.cmj : cc_cmi runtime/caml_float.res | runtime/caml_float.cmi runtime/caml_float_extern.cmj @@ -64,4 +62,4 @@ o runtime/caml_nativeint_extern.cmi runtime/caml_nativeint_extern.cmj : cc runti o runtime/caml_string_extern.cmi runtime/caml_string_extern.cmj : cc runtime/caml_string_extern.res | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_undefined_extern.cmi runtime/caml_undefined_extern.cmj : cc runtime/caml_undefined_extern.res | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/curry.cmi runtime/curry.cmj : cc runtime/curry.res | runtime/bs_stdlib_mini.cmi runtime/caml_array.cmj runtime/caml_array_extern.cmj runtime/js.cmi runtime/js.cmj -o runtime : phony runtime/bs_stdlib_mini.cmi runtime/js.cmj runtime/js.cmi runtime/caml.cmi runtime/caml.cmj runtime/caml_array.cmi runtime/caml_array.cmj runtime/caml_bigint.cmi runtime/caml_bigint.cmj runtime/caml_bytes.cmi runtime/caml_bytes.cmj runtime/caml_dict.cmi runtime/caml_dict.cmj runtime/caml_exceptions.cmi runtime/caml_exceptions.cmj runtime/caml_float.cmi runtime/caml_float.cmj runtime/caml_format.cmi runtime/caml_format.cmj runtime/caml_hash.cmi runtime/caml_hash.cmj runtime/caml_hash_primitive.cmi runtime/caml_hash_primitive.cmj runtime/caml_int32.cmi runtime/caml_int32.cmj runtime/caml_int64.cmi runtime/caml_int64.cmj runtime/caml_lexer.cmi runtime/caml_lexer.cmj runtime/caml_md5.cmi runtime/caml_md5.cmj runtime/caml_module.cmi runtime/caml_module.cmj runtime/caml_obj.cmi runtime/caml_obj.cmj runtime/caml_option.cmi runtime/caml_option.cmj runtime/caml_parser.cmi runtime/caml_parser.cmj runtime/caml_splice_call.cmi runtime/caml_splice_call.cmj runtime/caml_string.cmi runtime/caml_string.cmj runtime/caml_sys.cmi runtime/caml_sys.cmj runtime/caml_array_extern.cmi runtime/caml_array_extern.cmj runtime/caml_bigint_extern.cmi runtime/caml_bigint_extern.cmj runtime/caml_float_extern.cmi runtime/caml_float_extern.cmj runtime/caml_int64_extern.cmi runtime/caml_int64_extern.cmj runtime/caml_js_exceptions.cmi runtime/caml_js_exceptions.cmj runtime/caml_nativeint_extern.cmi runtime/caml_nativeint_extern.cmj runtime/caml_string_extern.cmi runtime/caml_string_extern.cmj runtime/caml_undefined_extern.cmi runtime/caml_undefined_extern.cmj runtime/curry.cmi runtime/curry.cmj +o runtime : phony runtime/bs_stdlib_mini.cmi runtime/js.cmj runtime/js.cmi runtime/caml.cmi runtime/caml.cmj runtime/caml_array.cmi runtime/caml_array.cmj runtime/caml_bigint.cmi runtime/caml_bigint.cmj runtime/caml_bytes.cmi runtime/caml_bytes.cmj runtime/caml_exceptions.cmi runtime/caml_exceptions.cmj runtime/caml_float.cmi runtime/caml_float.cmj runtime/caml_format.cmi runtime/caml_format.cmj runtime/caml_hash.cmi runtime/caml_hash.cmj runtime/caml_hash_primitive.cmi runtime/caml_hash_primitive.cmj runtime/caml_int32.cmi runtime/caml_int32.cmj runtime/caml_int64.cmi runtime/caml_int64.cmj runtime/caml_lexer.cmi runtime/caml_lexer.cmj runtime/caml_md5.cmi runtime/caml_md5.cmj runtime/caml_module.cmi runtime/caml_module.cmj runtime/caml_obj.cmi runtime/caml_obj.cmj runtime/caml_option.cmi runtime/caml_option.cmj runtime/caml_parser.cmi runtime/caml_parser.cmj runtime/caml_splice_call.cmi runtime/caml_splice_call.cmj runtime/caml_string.cmi runtime/caml_string.cmj runtime/caml_sys.cmi runtime/caml_sys.cmj runtime/caml_array_extern.cmi runtime/caml_array_extern.cmj runtime/caml_bigint_extern.cmi runtime/caml_bigint_extern.cmj runtime/caml_float_extern.cmi runtime/caml_float_extern.cmj runtime/caml_int64_extern.cmi runtime/caml_int64_extern.cmj runtime/caml_js_exceptions.cmi runtime/caml_js_exceptions.cmj runtime/caml_nativeint_extern.cmi runtime/caml_nativeint_extern.cmj runtime/caml_string_extern.cmi runtime/caml_string_extern.cmj runtime/caml_undefined_extern.cmi runtime/caml_undefined_extern.cmj runtime/curry.cmi runtime/curry.cmj diff --git a/jscomp/syntax/src/res_comments_table.ml b/jscomp/syntax/src/res_comments_table.ml index c1b9435548..d334743b88 100644 --- a/jscomp/syntax/src/res_comments_table.ml +++ b/jscomp/syntax/src/res_comments_table.ml @@ -1349,7 +1349,7 @@ and walk_expression expr t comments = ( { pexp_desc = Pexp_ident - {txt = Longident.Ldot (Lident "Caml_dict", "unsafe_create")}; + {txt = Longident.Ldot (Lident "Runtime_dict", "unsafe_create")}; }, [(Nolabel, key_values)] ) when Res_parsetree_viewer.is_tuple_array key_values -> diff --git a/jscomp/syntax/src/res_core.ml b/jscomp/syntax/src/res_core.ml index 4560b04bcf..ba182675f7 100644 --- a/jscomp/syntax/src/res_core.ml +++ b/jscomp/syntax/src/res_core.ml @@ -3946,7 +3946,7 @@ and parse_dict_expr ~start_pos p = Ast_helper.Exp.apply ~loc (Ast_helper.Exp.ident ~loc (Location.mkloc - (Longident.Ldot (Longident.Lident "Caml_dict", "unsafe_create")) + (Longident.Ldot (Longident.Lident "Runtime_dict", "unsafe_create")) loc)) [(Asttypes.Nolabel, Ast_helper.Exp.array ~loc key_value_pairs)] diff --git a/jscomp/syntax/src/res_printer.ml b/jscomp/syntax/src/res_printer.ml index c6c386e25a..43f34c8a84 100644 --- a/jscomp/syntax/src/res_printer.ml +++ b/jscomp/syntax/src/res_printer.ml @@ -4078,7 +4078,7 @@ and print_pexp_apply ~state expr cmt_tbl = ( { pexp_desc = Pexp_ident - {txt = Longident.Ldot (Lident "Caml_dict", "unsafe_create")}; + {txt = Longident.Ldot (Lident "Runtime_dict", "unsafe_create")}; }, [(Nolabel, key_values)] ) when Res_parsetree_viewer.is_tuple_array key_values -> diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/expected/dict.res.txt b/jscomp/syntax/tests/parsing/grammar/expressions/expected/dict.res.txt index 3c01d55193..e289ca062b 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/expected/dict.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/expressions/expected/dict.res.txt @@ -1,7 +1,8 @@ -let x = Caml_dict.unsafe_create [||] -let x = Caml_dict.unsafe_create [|("foo", {js|bar|js})|] -let x = Caml_dict.unsafe_create [|("foo", {js|bar|js});("bar", {js|baz|js})|] +let x = Runtime_dict.unsafe_create [||] +let x = Runtime_dict.unsafe_create [|("foo", {js|bar|js})|] +let x = + Runtime_dict.unsafe_create [|("foo", {js|bar|js});("bar", {js|baz|js})|] let baz = {js|foo|js} let x = - Caml_dict.unsafe_create + Runtime_dict.unsafe_create [|("foo", {js|bar|js});("bar", {js|baz|js});("baz", baz)|] \ No newline at end of file diff --git a/lib/es6/caml_dict.js b/lib/es6/runtime_dict.js similarity index 100% rename from lib/es6/caml_dict.js rename to lib/es6/runtime_dict.js diff --git a/lib/js/caml_dict.js b/lib/js/runtime_dict.js similarity index 100% rename from lib/js/caml_dict.js rename to lib/js/runtime_dict.js diff --git a/packages/artifacts.txt b/packages/artifacts.txt index da2e0cc501..f63d74dd55 100644 --- a/packages/artifacts.txt +++ b/packages/artifacts.txt @@ -80,7 +80,6 @@ lib/es6/caml_array_extern.js lib/es6/caml_bigint.js lib/es6/caml_bigint_extern.js lib/es6/caml_bytes.js -lib/es6/caml_dict.js lib/es6/caml_exceptions.js lib/es6/caml_float.js lib/es6/caml_float_extern.js @@ -172,6 +171,7 @@ lib/es6/pervasives.js lib/es6/queue.js lib/es6/random.js lib/es6/runtime_deriving.js +lib/es6/runtime_dict.js lib/es6/runtime_promise.js lib/es6/set.js lib/es6/setLabels.js @@ -239,7 +239,6 @@ lib/js/caml_array_extern.js lib/js/caml_bigint.js lib/js/caml_bigint_extern.js lib/js/caml_bytes.js -lib/js/caml_dict.js lib/js/caml_exceptions.js lib/js/caml_float.js lib/js/caml_float_extern.js @@ -330,6 +329,7 @@ lib/js/pervasives.js lib/js/queue.js lib/js/random.js lib/js/runtime_deriving.js +lib/js/runtime_dict.js lib/js/runtime_promise.js lib/js/set.js lib/js/setLabels.js @@ -957,6 +957,12 @@ lib/ocaml/runtime_deriving.cmt lib/ocaml/runtime_deriving.cmti lib/ocaml/runtime_deriving.res lib/ocaml/runtime_deriving.resi +lib/ocaml/runtime_dict.cmi +lib/ocaml/runtime_dict.cmj +lib/ocaml/runtime_dict.cmt +lib/ocaml/runtime_dict.cmti +lib/ocaml/runtime_dict.res +lib/ocaml/runtime_dict.resi lib/ocaml/runtime_promise.cmi lib/ocaml/runtime_promise.cmj lib/ocaml/runtime_promise.cmt