mirror of
https://github.com/roc-lang/roc.git
synced 2025-11-01 05:24:15 +00:00
Use ImplKey in abilities store public API
This commit is contained in:
parent
923341ec95
commit
28c1a4cb95
6 changed files with 48 additions and 50 deletions
|
|
@ -12,7 +12,10 @@ mod solve_expr {
|
|||
use crate::helpers::with_larger_debug_stack;
|
||||
use lazy_static::lazy_static;
|
||||
use regex::Regex;
|
||||
use roc_can::traverse::{find_ability_member_and_owning_type_at, find_type_at};
|
||||
use roc_can::{
|
||||
abilities::ImplKey,
|
||||
traverse::{find_ability_member_and_owning_type_at, find_type_at},
|
||||
};
|
||||
use roc_load::LoadedModule;
|
||||
use roc_module::symbol::{Interns, ModuleId};
|
||||
use roc_problem::can::Problem;
|
||||
|
|
@ -367,12 +370,12 @@ mod solve_expr {
|
|||
}
|
||||
|
||||
let known_specializations = abilities_store.iter_declared_implementations().filter_map(
|
||||
|((member, typ), member_impl)| match member_impl {
|
||||
|(impl_key, member_impl)| match member_impl {
|
||||
MemberImpl::Impl(impl_symbol) => {
|
||||
let specialization = abilities_store.specialization_info(*impl_symbol).expect(
|
||||
"declared implementations should be resolved conclusively after solving",
|
||||
);
|
||||
Some((member, typ, specialization.clone()))
|
||||
Some((impl_key, specialization.clone()))
|
||||
}
|
||||
MemberImpl::Derived | MemberImpl::Error => None,
|
||||
},
|
||||
|
|
@ -381,13 +384,17 @@ mod solve_expr {
|
|||
use std::collections::HashSet;
|
||||
let pretty_specializations = known_specializations
|
||||
.into_iter()
|
||||
.map(|(member, typ, _)| {
|
||||
let member_data = abilities_store.member_def(member).unwrap();
|
||||
let member_str = member.as_str(&interns);
|
||||
.map(|(impl_key, _)| {
|
||||
let ImplKey {
|
||||
opaque,
|
||||
ability_member,
|
||||
} = impl_key;
|
||||
let member_data = abilities_store.member_def(ability_member).unwrap();
|
||||
let member_str = ability_member.as_str(&interns);
|
||||
let ability_str = member_data.parent_ability.as_str(&interns);
|
||||
(
|
||||
format!("{}:{}", ability_str, member_str),
|
||||
typ.as_str(&interns),
|
||||
opaque.as_str(&interns),
|
||||
)
|
||||
})
|
||||
.collect::<HashSet<_>>();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue