Solve and gen ability members that bind other able variables

This commit is contained in:
Ayaz Hafiz 2022-04-21 14:11:32 -04:00 committed by ayazhafiz
parent 5fe902b8d3
commit b5efd830e5
6 changed files with 110 additions and 28 deletions

View file

@ -578,12 +578,14 @@ fn resolve_abilities<'a>(
// What variables in the annotation are bound to the parent ability, and what variables
// are bound to some other ability?
let (variables_bound_to_ability, variables_bound_to_other_abilities): (Vec<_>, Vec<_>) =
member_annot
.introduced_variables
.able
.iter()
.partition(|av| av.ability == loc_ability_name.value);
let (variables_bound_to_ability, _variables_bound_to_other_abilities): (
Vec<_>,
Vec<_>,
) = member_annot
.introduced_variables
.able
.iter()
.partition(|av| av.ability == loc_ability_name.value);
let mut bad_has_clauses = false;
@ -618,18 +620,6 @@ fn resolve_abilities<'a>(
bad_has_clauses = true;
}
if !variables_bound_to_other_abilities.is_empty() {
// Disallow variables bound to other abilities, for now.
for bad_variable in variables_bound_to_other_abilities.iter() {
env.problem(Problem::AbilityMemberBindsExternalAbility {
member: member_sym,
ability: loc_ability_name.value,
region: bad_variable.first_seen,
});
}
bad_has_clauses = true;
}
if bad_has_clauses {
// Pretend the member isn't a part of the ability
continue;