Annotation specializes ability

This commit is contained in:
Ayaz Hafiz 2022-04-13 10:44:34 -04:00
parent 25b3aa7ca7
commit d110fbde6c
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 22 additions and 1 deletions

View file

@ -1218,7 +1218,9 @@ fn canonicalize_pending_value_def<'a>(
}
};
if let Pattern::Identifier(symbol) = loc_can_pattern.value {
if let Pattern::Identifier(symbol)
| Pattern::AbilityMemberSpecialization { ident: symbol, .. } = loc_can_pattern.value
{
let def = single_can_def(
loc_can_pattern,
loc_can_expr,

View file

@ -5860,4 +5860,23 @@ mod solve_expr {
[("hash", "Id")],
)
}
#[test]
fn ability_checked_specialization_with_annotation_only() {
check_inferred_abilities(
indoc!(
r#"
app "test" provides [ hash ] to "./platform"
Hash has
hash : a -> U64 | a has Hash
Id := U64
hash : Id -> U64
"#
),
[("hash", "Id")],
)
}
}