diff --git a/CHANGELOG.md b/CHANGELOG.md index 7840483bb2..8b206fe219 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,10 @@ - Fix issue where async as an id cannot be used with application and labelled arguments https://github.com/rescript-lang/syntax/issues/707 +- Fix 5557 the exhaustive checking for Char is incorrect during the unicode migration + +- Fix 5753 the comment for unicode char is inaccurate + # 10.1.0-rc.2 #### :bug: Bug Fix diff --git a/jscomp/ml/parmatch.ml b/jscomp/ml/parmatch.ml index 82e6afade7..e06991290b 100644 --- a/jscomp/ml/parmatch.ml +++ b/jscomp/ml/parmatch.ml @@ -1037,7 +1037,7 @@ let build_other_constant proj make first next p env = let some_other_tag = "" -let build_other ext env = match env with +let build_other ext env : Typedtree.pattern = match env with | ({pat_desc = Tpat_construct (lid, {cstr_tag=Cstr_extension _},_)},_) :: _ -> (* let c = {c with cstr_name = "*extension*"} in *) (* PR#7330 *) make_pat (Tpat_var (Ident.create "*extension*", @@ -1079,13 +1079,19 @@ let build_other ext env = match env with make_pat (Tpat_or (pat, p_res, None)) p.pat_type p.pat_env) pat other_pats end -| ({pat_desc=(Tpat_constant (Const_int _ | Const_char _))} as p,_) :: _ -> +| ({pat_desc=(Tpat_constant (Const_int _ ))} as p,_) :: _ -> build_other_constant (function Tpat_constant(Const_int i) -> i - | Tpat_constant (Const_char i) -> Char.code i | _ -> assert false) (function i -> Tpat_constant(Const_int i)) 0 succ p env +| ({pat_desc=(Tpat_constant (Const_char _ ))} as p,_) :: _ -> + build_other_constant + (function + | Tpat_constant (Const_char i) -> i + | _ -> assert false) + (function i -> Tpat_constant(Const_char i)) + 0 succ p env | ({pat_desc=(Tpat_constant (Const_int32 _))} as p,_) :: _ -> build_other_constant (function Tpat_constant(Const_int32 i) -> i | _ -> assert false) diff --git a/jscomp/napkin/CHANGELOG.md b/jscomp/napkin/CHANGELOG.md index 064b2d342c..bd63726ca9 100644 --- a/jscomp/napkin/CHANGELOG.md +++ b/jscomp/napkin/CHANGELOG.md @@ -59,6 +59,7 @@ #### :nail_care Polish - Change the internal representation of props for the lowercase components to record. https://github.com/rescript-lang/syntax/pull/665 +- Change the payload of Pconst_char for type safety. https://github.com/rescript-lang/rescript-compiler/pull/5759 ## ReScript 10.0