Basic type inference and solving for abilities

Note that is still pretty limited. We only permit opaque types to
implement abilities, abilities cannot have type arguments, and also no
other functions may depend on abilities
This commit is contained in:
Ayaz Hafiz 2022-04-12 15:37:16 -04:00
parent 913d97cab1
commit 15a040ec87
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
25 changed files with 1808 additions and 477 deletions

View file

@ -188,9 +188,23 @@ pub fn constrain_pattern(
// Erroneous patterns don't add any constraints.
}
Identifier(symbol) | Shadowed(_, _, symbol)
// TODO(abilities): handle linking the member def to the specialization ident
| AbilityMemberSpecialization {
Identifier(symbol) | Shadowed(_, _, symbol) => {
if could_be_a_tag_union(expected.get_type_ref()) {
state
.constraints
.push(constraints.is_open_type(expected.get_type_ref().clone()));
}
state.headers.insert(
*symbol,
Loc {
region,
value: expected.get_type(),
},
);
}
AbilityMemberSpecialization {
ident: symbol,
specializes: _,
} => {