Skip to content

Allow type variables when spreading record type definitions #6309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jun 25, 2023
Prev Previous commit
Next Next commit
rename record type spread utils file
  • Loading branch information
zth committed Jun 25, 2023
commit 23b94d2fbae3ada7446004cf8010b916322536a8
File renamed without changes.
4 changes: 2 additions & 2 deletions jscomp/ml/typedecl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,8 @@ let transl_declaration ~typeRecordAsObject env sdecl id =
let lbls_opt = match has_spread with
| true ->
let substitute_type_vars type_vars typ =
let type_map = type_vars |> List.fold_left (fun acc (tvar_name, tvar_typ) -> Record_spread.StringMap.add tvar_name tvar_typ acc) Record_spread.StringMap.empty in
Record_spread.substitute_types ~type_map typ in
let type_map = type_vars |> List.fold_left (fun acc (tvar_name, tvar_typ) -> Record_type_spread.StringMap.add tvar_name tvar_typ acc) Record_type_spread.StringMap.empty in
Record_type_spread.substitute_types ~type_map typ in
let rec extract t = match t.desc with
| Tpoly(t, []) -> extract t
| _ -> Ctype.repr t in
Expand Down