Skip to content

Commit

Permalink
Register allocations for Omitted parameter closures (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
stedolan authored Nov 15, 2021
1 parent 103b139 commit fca94c4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lambda/printlambda.ml
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ let rec lam ppf = function
apply_tailcall_attribute ap.ap_tailcall
apply_inlined_attribute ap.ap_inlined
apply_specialised_attribute ap.ap_specialised
| Lfunction{kind; params; return; body; attr; ret_mode} ->
| Lfunction{kind; params; return; body; attr; mode; ret_mode} ->
let pr_params ppf params =
match kind with
| Curried {nlocal} ->
Expand All @@ -543,7 +543,8 @@ let rec lam ppf = function
value_kind ppf k)
params;
fprintf ppf ")" in
fprintf ppf "@[<2>(function%a@ %a%a%a)@]" pr_params params
fprintf ppf "@[<2>(function%s%a@ %a%a%a)@]"
(alloc_kind mode) pr_params params
function_attribute attr return_kind (ret_mode, return) lam body
| (Llet _ | Lregion(Llet _)) as expr ->
let kind = function
Expand Down
3 changes: 1 addition & 2 deletions testsuite/tests/typing-local/alloc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,7 @@ let currylocal1 n =
let currylocal2 n =
ignore_local (Sys.opaque_identity local_arg_fn ~a:n); ()
let currylocal3 n =
(* FIXME broken, see Translcore.build_apply
ignore_local (local_arg_fn ~b:n); *)
ignore_local (local_arg_fn ~b:n);
()

let partprim1 n =
Expand Down
1 change: 1 addition & 0 deletions typing/typecore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2601,6 +2601,7 @@ let type_omitted_parameters expected_mode env ty_ret mode_ret args =
let closed_args = new_closed_args @ closed_args in
let open_args = [] in
let mode_closure = Alloc_mode.join (mode_fun :: closed_args) in
register_allocation_mode mode_closure;
let arg = Omitted { mode_closure; mode_arg; mode_ret } in
let args = (lbl, arg) :: args in
(ty_ret, mode_closure, open_args, closed_args, args))
Expand Down

0 comments on commit fca94c4

Please sign in to comment.