mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
Ability impls that don't shadow can end up resolving to the member def
This commit is contained in:
parent
b7b0af0d45
commit
01815ad23f
1 changed files with 14 additions and 2 deletions
|
@ -495,8 +495,20 @@ fn canonicalize_claimed_ability_impl<'a>(
|
|||
.or_else(|| scope.lookup_str(label_str, region).ok());
|
||||
|
||||
match opt_impl_symbol {
|
||||
Some(impl_symbol) => Ok((member_symbol, impl_symbol)),
|
||||
None => {
|
||||
// It's possible that even if we find a symbol it is still only the member
|
||||
// definition symbol, for example when the ability is defined in the same
|
||||
// module as an implementer:
|
||||
//
|
||||
// Eq has eq : a, a -> U64 | a has Eq
|
||||
//
|
||||
// A := U8 has [Eq {eq}]
|
||||
//
|
||||
// So, do a final check that the implementation symbol is not resolved directly
|
||||
// to the member.
|
||||
Some(impl_symbol) if impl_symbol != member_symbol => {
|
||||
Ok((member_symbol, impl_symbol))
|
||||
}
|
||||
_ => {
|
||||
env.problem(Problem::ImplementationNotFound {
|
||||
member: member_symbol,
|
||||
region: label.region,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue