mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 11:52:19 +00:00
Instantiate erased lambdas
This commit is contained in:
parent
fb4c550a29
commit
1d6f0d3d3f
2 changed files with 45 additions and 18 deletions
|
@ -23,7 +23,7 @@ use crate::{
|
|||
ability::{AbilityImplError, ObligationCache},
|
||||
deep_copy::deep_copy_var_in,
|
||||
env::InferenceEnv,
|
||||
Aliases,
|
||||
Aliases, FunctionKind,
|
||||
};
|
||||
|
||||
std::thread_local! {
|
||||
|
@ -346,9 +346,18 @@ pub(crate) fn type_to_var_help(
|
|||
name,
|
||||
ambient_function,
|
||||
} => {
|
||||
let captures = types.get_type_arguments(typ_index);
|
||||
let union_lambdas =
|
||||
create_union_lambda(env, rank, arena, types, name, captures, &mut stack);
|
||||
let union_lambdas = match env.function_kind {
|
||||
FunctionKind::LambdaSet => {
|
||||
let captures = types.get_type_arguments(typ_index);
|
||||
create_union_lambda(env, rank, arena, types, name, captures, &mut stack)
|
||||
}
|
||||
FunctionKind::Erased => {
|
||||
// NB we cannot use a constant variable for the erased lambda set (yet)
|
||||
// because we still need to link it to the ambient function. In the future,
|
||||
// perhaps we could.
|
||||
UnionLambdas::from_slices(Subs::LAMBDA_NAME_ERASED, SubsSlice::empty())
|
||||
}
|
||||
};
|
||||
|
||||
let content = Content::LambdaSet(subs::LambdaSet {
|
||||
solved: union_lambdas,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue