diff --git a/compiler/ml/parmatch.ml b/compiler/ml/parmatch.ml index 9e66800c8b4..ebb6903c661 100644 --- a/compiler/ml/parmatch.ml +++ b/compiler/ml/parmatch.ml @@ -512,6 +512,7 @@ let extract_fields omegas arg = let all_record_args lbls = match lbls with + | [] -> [] | (_, {lbl_all}, _, opt) :: _ -> let t = Array.map @@ -560,7 +561,6 @@ let all_record_args lbls = t.(lbl.lbl_pos) <- x) lbls; Array.to_list t - | _ -> fatal_error "Parmatch.all_record_args" (* Build argument list when p2 >= p1, where p1 is a simple pattern *) let rec simple_match_args p1 p2 = diff --git a/tests/tests/src/parmatch_empty_record_pattern_test.mjs b/tests/tests/src/parmatch_empty_record_pattern_test.mjs new file mode 100644 index 00000000000..a1d4eda9c80 --- /dev/null +++ b/tests/tests/src/parmatch_empty_record_pattern_test.mjs @@ -0,0 +1,13 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let match = {}; + +let emptyDictPatternShouldCompile; + +emptyDictPatternShouldCompile = typeof match === "object" && match !== null && !Array.isArray(match); + +export { + emptyDictPatternShouldCompile, +} +/* emptyDictPatternShouldCompile Not a pure module */ diff --git a/tests/tests/src/parmatch_empty_record_pattern_test.res b/tests/tests/src/parmatch_empty_record_pattern_test.res new file mode 100644 index 00000000000..0b0fcad5958 --- /dev/null +++ b/tests/tests/src/parmatch_empty_record_pattern_test.res @@ -0,0 +1,4 @@ +let emptyDictPatternShouldCompile = switch JSON.Object(dict{}) { +| JSON.Object(dict{}) => true +| _ => false +}