Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- Integer patterns that alias the same int32 value (e.g. `0xFFFF_FFFF` and `-1`) may now produce unused-case warnings. https://github.com/rescript-lang/rescript/pull/8717 https://github.com/rescript-lang/rescript/pull/8858
- Fix constant folding of a `switch` picking the wrong case for `@as(int)` constructors and for coerced variants. https://github.com/rescript-lang/rescript/pull/9318
- Fix constant folding of comparisons between `@as(int)` constructors and other constructors, and merging of switch arms returning them. https://github.com/rescript-lang/rescript/pull/9319
- Fix a record spread evaluating its overrides in reverse order. https://github.com/rescript-lang/rescript/pull/9416

#### :nail_care: Polish

Expand Down
6 changes: 4 additions & 2 deletions compiler/ml/translcore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,7 @@ and transl_record loc env fields repres opt_init_expr =
(* Take a shallow copy of the init record, then mutate the fields
of the copy *)
let copy_id = Ident.create "newrecord" in
let update_field cont (lbl, definition, _opt) =
let update_field (lbl, definition, _opt) cont =
match definition with
| Kept _type -> cont
| Overridden (_lid, expr) ->
Expand All @@ -1241,7 +1241,9 @@ and transl_record loc env fields repres opt_init_expr =
Pgenval,
copy_id,
Lprim (Pduprecord, [transl_exp init_expr], loc),
Array.fold_left update_field (Lvar copy_id) fields ))
(* The fields are set in declaration order, so the overrides are
evaluated in that order *)
Array.fold_right update_field fields (Lvar copy_id) ))

and transl_match e arg pat_expr_list exn_pat_expr_list partial =
let id = Typecore.name_pattern "exn" exn_pat_expr_list
Expand Down
4 changes: 2 additions & 2 deletions tests/tests/src/jsx_preserve_test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ let newrecord$1 = {...baseProps};

let _container_with_spread_props = <div
{...newrecord$1}
title={"barry"}
className={"barry"}
title={"barry"}
>
{"Hello, world!"}
<input
Expand Down Expand Up @@ -96,8 +96,8 @@ let newrecord$3 = {...baseProps};
let _container_with_spread_props_keyed = <div
key={"barry-key"}
{...newrecord$3}
title={"barry"}
className={"barry"}
title={"barry"}
>
{"Hello, world!"}
<input
Expand Down
Loading
Loading