add a todo impl

This commit is contained in:
Ayaz Hafiz 2023-06-25 18:32:29 -05:00
parent 63db2c0eea
commit 55fa8098d3
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58

View file

@ -8424,7 +8424,40 @@ fn call_by_name<'a>(
)
}
}
Ok(RawFunctionLayout::ErasedFunction(..)) => todo_lambda_erasure!(),
Ok(RawFunctionLayout::ErasedFunction(arg_layouts, ret_layout)) => {
// TODO(erased-lambdas) call-by-name should never apply here
let arena = env.arena;
let arg_symbols = Vec::from_iter_in(
loc_args.iter().map(|(arg_var, arg_expr)| {
possible_reuse_symbol_or_specialize(
env,
procs,
layout_cache,
&arg_expr.value,
*arg_var,
)
}),
arena,
)
.into_bump_slice();
let result = erased::call_erased_function(
env,
layout_cache,
procs,
roc_can::expr::Expr::Var(proc_name, fn_var),
fn_var,
(arg_layouts, ret_layout),
arg_symbols,
assigned,
hole,
// TODO is this right??
ret_layout,
);
let iter = loc_args.into_iter().rev().zip(arg_symbols.iter().rev());
assign_to_symbols(env, procs, layout_cache, iter, result)
}
Ok(RawFunctionLayout::ZeroArgumentThunk(ret_layout)) => {
if procs.is_module_thunk(proc_name) {
// here we turn a call to a module thunk into forcing of that thunk