mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 08:11:12 +00:00
Lift lambda sets as their own type
This prepares for unspecialized lambda set in the type system in general.
This commit is contained in:
parent
40b43ea98d
commit
c2a2ce690c
13 changed files with 708 additions and 410 deletions
|
@ -5,8 +5,8 @@ use roc_can::{
|
|||
expr::{AccessorData, ClosureData, Expr, Field, WhenBranch},
|
||||
};
|
||||
use roc_types::subs::{
|
||||
AliasVariables, Descriptor, OptVariable, RecordFields, Subs, SubsSlice, UnionTags, Variable,
|
||||
VariableSubsSlice,
|
||||
self, AliasVariables, Descriptor, OptVariable, RecordFields, Subs, SubsSlice, UnionTags,
|
||||
Variable, VariableSubsSlice,
|
||||
};
|
||||
|
||||
/// Deep copies the type variables in the type hosted by [`var`] into [`expr`].
|
||||
|
@ -611,6 +611,29 @@ fn deep_copy_type_vars<'a>(
|
|||
})
|
||||
}
|
||||
|
||||
LambdaSet(subs::LambdaSet { solved }) => {
|
||||
for variables_slice_index in solved.variables() {
|
||||
let variables_slice = subs[variables_slice_index];
|
||||
descend_slice!(variables_slice);
|
||||
}
|
||||
|
||||
perform_clone!({
|
||||
let new_variable_slices =
|
||||
SubsSlice::reserve_variable_slices(subs, solved.len());
|
||||
let it = (new_variable_slices.indices()).zip(solved.variables());
|
||||
for (target_index, index) in it {
|
||||
let slice = subs[index];
|
||||
let new_variables = clone_var_slice!(slice);
|
||||
subs.variable_slices[target_index] = new_variables;
|
||||
}
|
||||
|
||||
let new_solved =
|
||||
UnionTags::from_slices(solved.tag_names(), new_variable_slices);
|
||||
|
||||
LambdaSet(subs::LambdaSet { solved: new_solved })
|
||||
})
|
||||
}
|
||||
|
||||
RangedNumber(typ, range) => {
|
||||
let new_typ = descend_var!(typ);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue