mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-23 12:02:28 +00:00
Canonicalize multiple abilities bound to a type variable
This commit is contained in:
parent
97dbac1631
commit
6bb97c92b9
9 changed files with 84 additions and 77 deletions
|
@ -357,14 +357,14 @@ fn canonicalize_alias<'a>(
|
|||
// This is a valid lowercase rigid var for the type def.
|
||||
let named_variable = named.swap_remove(index);
|
||||
let var = named_variable.variable();
|
||||
let opt_bound_ability = named_variable.opt_ability();
|
||||
let opt_bound_abilities = named_variable.opt_abilities().map(ToOwned::to_owned);
|
||||
let name = named_variable.name();
|
||||
|
||||
can_vars.push(Loc {
|
||||
value: AliasVar {
|
||||
name,
|
||||
var,
|
||||
opt_bound_ability,
|
||||
opt_bound_abilities,
|
||||
},
|
||||
region: loc_lowercase.region,
|
||||
});
|
||||
|
@ -386,7 +386,7 @@ fn canonicalize_alias<'a>(
|
|||
value: AliasVar {
|
||||
name: loc_lowercase.value.clone(),
|
||||
var: var_store.fresh(),
|
||||
opt_bound_ability: None,
|
||||
opt_bound_abilities: None,
|
||||
},
|
||||
region: loc_lowercase.region,
|
||||
});
|
||||
|
@ -859,7 +859,7 @@ fn canonicalize_opaque<'a>(
|
|||
alias_var.region,
|
||||
OptAbleType {
|
||||
typ: Type::Variable(var_store.fresh()),
|
||||
opt_ability: alias_var.value.opt_bound_ability,
|
||||
opt_abilities: alias_var.value.opt_bound_abilities.clone(),
|
||||
},
|
||||
)
|
||||
})
|
||||
|
@ -1345,7 +1345,7 @@ fn resolve_abilities<'a>(
|
|||
.introduced_variables
|
||||
.able
|
||||
.iter()
|
||||
.partition(|av| av.ability == ability);
|
||||
.partition(|av| av.abilities.iter().any(|ab| *ab == ability));
|
||||
|
||||
let var_bound_to_ability = match variables_bound_to_ability.as_slice() {
|
||||
[one] => one.variable,
|
||||
|
@ -2872,7 +2872,7 @@ fn make_tag_union_of_alias_recursive<'a>(
|
|||
|
||||
let alias_opt_able_vars = alias.type_variables.iter().map(|l| OptAbleType {
|
||||
typ: Type::Variable(l.value.var),
|
||||
opt_ability: l.value.opt_bound_ability,
|
||||
opt_abilities: l.value.opt_bound_abilities.clone(),
|
||||
});
|
||||
|
||||
let lambda_set_vars = alias.lambda_set_variables.iter();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue