mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 05:49:08 +00:00
Get rid of MemberImpl::Derived
We don't need this anymore, since derived members become Impls during canonicalization now!
This commit is contained in:
parent
1d885c4ab2
commit
e75f3c3c79
7 changed files with 6 additions and 25 deletions
|
@ -127,7 +127,6 @@ pub struct ImplKey {
|
|||
#[derive(Clone, Debug)]
|
||||
pub enum ResolvedImpl {
|
||||
Impl(MemberSpecializationInfo<Resolved>),
|
||||
Derived,
|
||||
Error,
|
||||
}
|
||||
|
||||
|
@ -452,7 +451,7 @@ impl IAbilitiesStore<Resolved> {
|
|||
|
||||
Ok(())
|
||||
}
|
||||
MemberImpl::Derived | MemberImpl::Error => Err(MarkError::ImplIsNotCustom),
|
||||
MemberImpl::Error => Err(MarkError::ImplIsNotCustom),
|
||||
},
|
||||
None => Err(MarkError::NoDeclaredImpl),
|
||||
}
|
||||
|
@ -498,7 +497,6 @@ impl IAbilitiesStore<Pending> {
|
|||
self.import_specialization(specialization);
|
||||
MemberImpl::Impl(specialization.symbol)
|
||||
}
|
||||
ResolvedImpl::Derived => MemberImpl::Derived,
|
||||
ResolvedImpl::Error => MemberImpl::Error,
|
||||
};
|
||||
|
||||
|
@ -957,14 +955,12 @@ mod serialize {
|
|||
#[repr(C)]
|
||||
enum SerMemberImpl {
|
||||
Impl(Symbol),
|
||||
Derived,
|
||||
Error,
|
||||
}
|
||||
impl From<&MemberImpl> for SerMemberImpl {
|
||||
fn from(k: &MemberImpl) -> Self {
|
||||
match k {
|
||||
MemberImpl::Impl(s) => Self::Impl(*s),
|
||||
MemberImpl::Derived => Self::Derived,
|
||||
MemberImpl::Error => Self::Error,
|
||||
}
|
||||
}
|
||||
|
@ -973,7 +969,6 @@ mod serialize {
|
|||
fn from(k: &SerMemberImpl) -> Self {
|
||||
match k {
|
||||
SerMemberImpl::Impl(s) => Self::Impl(*s),
|
||||
SerMemberImpl::Derived => Self::Derived,
|
||||
SerMemberImpl::Error => Self::Error,
|
||||
}
|
||||
}
|
||||
|
@ -1134,14 +1129,12 @@ mod serialize {
|
|||
#[repr(C)]
|
||||
enum SerResolvedImpl {
|
||||
Impl(SerMemberSpecInfo),
|
||||
Derived,
|
||||
Error,
|
||||
}
|
||||
impl SerResolvedImpl {
|
||||
fn num_regions(&self) -> usize {
|
||||
match self {
|
||||
SerResolvedImpl::Impl(spec) => spec.1.len(),
|
||||
SerResolvedImpl::Derived => 0,
|
||||
SerResolvedImpl::Error => 0,
|
||||
}
|
||||
}
|
||||
|
@ -1186,7 +1179,6 @@ mod serialize {
|
|||
);
|
||||
SerResolvedImpl::Impl(SerMemberSpecInfo(*symbol, regions, vars))
|
||||
}
|
||||
ResolvedImpl::Derived => SerResolvedImpl::Derived,
|
||||
ResolvedImpl::Error => SerResolvedImpl::Error,
|
||||
};
|
||||
|
||||
|
@ -1237,7 +1229,6 @@ mod serialize {
|
|||
});
|
||||
ResolvedImpl::Impl(spec_info)
|
||||
}
|
||||
SerResolvedImpl::Derived => ResolvedImpl::Derived,
|
||||
SerResolvedImpl::Error => ResolvedImpl::Error,
|
||||
};
|
||||
|
||||
|
@ -1310,7 +1301,7 @@ mod test {
|
|||
|
||||
store.register_declared_implementations(
|
||||
Symbol::ATTR_ATTR,
|
||||
[(Symbol::ARG_5, MemberImpl::Derived)],
|
||||
[(Symbol::ARG_5, MemberImpl::Error)],
|
||||
);
|
||||
|
||||
store
|
||||
|
|
|
@ -4464,7 +4464,7 @@ fn run_solve_solve(
|
|||
.values()
|
||||
.any(|resolved_impl| match resolved_impl {
|
||||
ResolvedImpl::Impl(specialization) => specialization.symbol == sym,
|
||||
ResolvedImpl::Derived | ResolvedImpl::Error => false,
|
||||
ResolvedImpl::Error => false,
|
||||
})
|
||||
};
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use roc_can::abilities::AbilitiesStore;
|
||||
use roc_can::expr::PendingDerives;
|
||||
use roc_collections::{VecMap, VecSet};
|
||||
use roc_error_macros::{internal_error, todo_abilities};
|
||||
use roc_error_macros::internal_error;
|
||||
use roc_module::symbol::Symbol;
|
||||
use roc_region::all::{Loc, Region};
|
||||
use roc_solve_problem::{
|
||||
|
@ -1238,9 +1238,6 @@ pub fn resolve_ability_specialization<R: AbilityResolver>(
|
|||
roc_types::types::MemberImpl::Impl(spec_symbol) => {
|
||||
Resolved::Specialization(spec_symbol)
|
||||
}
|
||||
roc_types::types::MemberImpl::Derived => {
|
||||
todo_abilities!("get type from obligated opaque")
|
||||
}
|
||||
// TODO this is not correct. We can replace `Resolved` with `MemberImpl` entirely,
|
||||
// which will make this simpler.
|
||||
roc_types::types::MemberImpl::Error => Resolved::Specialization(Symbol::UNDERSCORE),
|
||||
|
|
|
@ -147,9 +147,6 @@ pub fn exposed_types_storage_subs(
|
|||
stored_specialization_lambda_set_vars.insert(lset_var, imported_lset_var);
|
||||
}
|
||||
}
|
||||
ResolvedImpl::Derived => {
|
||||
// nothing to do
|
||||
}
|
||||
ResolvedImpl::Error => {
|
||||
// nothing to do
|
||||
}
|
||||
|
@ -202,7 +199,6 @@ pub fn extract_module_owned_implementations(
|
|||
);
|
||||
ResolvedImpl::Impl(specialization.clone())
|
||||
}
|
||||
MemberImpl::Derived => ResolvedImpl::Derived,
|
||||
MemberImpl::Error => ResolvedImpl::Error,
|
||||
};
|
||||
|
||||
|
|
|
@ -638,7 +638,7 @@ fn make_specialization_decision<P: Phase>(
|
|||
// Doesn't specialize; an error will already be reported for this.
|
||||
SpecializeDecision::Drop
|
||||
}
|
||||
Some(MemberImpl::Error | MemberImpl::Derived) => {
|
||||
Some(MemberImpl::Error) => {
|
||||
// TODO: probably not right, we may want to choose a derive decision!
|
||||
SpecializeDecision::Specialize(Opaque(*opaque))
|
||||
}
|
||||
|
@ -743,7 +743,6 @@ fn get_specialization_lambda_set_ambient_function<P: Phase>(
|
|||
.expect("lambda set region not resolved");
|
||||
Ok(specialized_lambda_set)
|
||||
}
|
||||
MemberImpl::Derived => todo_abilities!(),
|
||||
MemberImpl::Error => todo_abilities!(),
|
||||
},
|
||||
}
|
||||
|
|
|
@ -384,7 +384,7 @@ mod solve_expr {
|
|||
);
|
||||
Some((impl_key, specialization.clone()))
|
||||
}
|
||||
MemberImpl::Derived | MemberImpl::Error => None,
|
||||
MemberImpl::Error => None,
|
||||
},
|
||||
);
|
||||
|
||||
|
|
|
@ -2139,8 +2139,6 @@ pub enum MemberImpl {
|
|||
/// The implementation is claimed to be at the given symbol.
|
||||
/// During solving we validate that the impl is really there.
|
||||
Impl(Symbol),
|
||||
/// The implementation should be derived.
|
||||
Derived,
|
||||
/// The implementation is not present or does not match the expected member type.
|
||||
Error,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue