mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 08:11:12 +00:00
Annotation specializes ability
This commit is contained in:
parent
25b3aa7ca7
commit
d110fbde6c
2 changed files with 22 additions and 1 deletions
|
@ -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(
|
let def = single_can_def(
|
||||||
loc_can_pattern,
|
loc_can_pattern,
|
||||||
loc_can_expr,
|
loc_can_expr,
|
||||||
|
|
|
@ -5860,4 +5860,23 @@ mod solve_expr {
|
||||||
[("hash", "Id")],
|
[("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")],
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue