mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
Print multiple abilities in error types
This commit is contained in:
parent
94fc58a508
commit
49e19d96e5
3 changed files with 62 additions and 30 deletions
|
@ -3738,14 +3738,14 @@ fn content_to_err_type(
|
|||
}
|
||||
};
|
||||
|
||||
// TODO(multi-abilities)
|
||||
ErrorType::FlexAbleVar(name, subs.get_subs_slice(abilities)[0])
|
||||
let ability_set = AbilitySet::from_iter(subs.get_subs_slice(abilities).iter().copied());
|
||||
ErrorType::FlexAbleVar(name, ability_set)
|
||||
}
|
||||
|
||||
RigidAbleVar(name_index, abilities) => {
|
||||
let name = subs.field_names[name_index.index as usize].clone();
|
||||
// TODO(multi-abilities)
|
||||
ErrorType::RigidAbleVar(name, subs.get_subs_slice(abilities)[0])
|
||||
let ability_set = AbilitySet::from_iter(subs.get_subs_slice(abilities).iter().copied());
|
||||
ErrorType::RigidAbleVar(name, ability_set)
|
||||
}
|
||||
|
||||
RecursionVar {
|
||||
|
|
|
@ -256,7 +256,7 @@ pub struct AliasCommon {
|
|||
///
|
||||
/// In the future we might want to do some small-vec optimizations, though that may be trivialized
|
||||
/// away with a SoA representation of canonicalized types.
|
||||
#[derive(Clone, Debug, Default, PartialEq, PartialOrd, Eq, Ord)]
|
||||
#[derive(Clone, Debug, Default, PartialEq, PartialOrd, Eq, Ord, Hash)]
|
||||
pub struct AbilitySet(Vec<Symbol>);
|
||||
|
||||
impl AbilitySet {
|
||||
|
@ -282,11 +282,11 @@ impl AbilitySet {
|
|||
self.0.contains(ability)
|
||||
}
|
||||
|
||||
pub fn sorted_iter(&self) -> impl Iterator<Item = &Symbol> {
|
||||
pub fn sorted_iter(&self) -> impl ExactSizeIterator<Item = &Symbol> {
|
||||
self.0.iter()
|
||||
}
|
||||
|
||||
pub fn into_sorted_iter(self) -> impl Iterator<Item = Symbol> {
|
||||
pub fn into_sorted_iter(self) -> impl ExactSizeIterator<Item = Symbol> {
|
||||
self.0.into_iter()
|
||||
}
|
||||
}
|
||||
|
@ -2266,8 +2266,8 @@ pub enum ErrorType {
|
|||
Type(Symbol, Vec<ErrorType>),
|
||||
FlexVar(Lowercase),
|
||||
RigidVar(Lowercase),
|
||||
FlexAbleVar(Lowercase, Symbol),
|
||||
RigidAbleVar(Lowercase, Symbol),
|
||||
FlexAbleVar(Lowercase, AbilitySet),
|
||||
RigidAbleVar(Lowercase, AbilitySet),
|
||||
Record(SendMap<Lowercase, RecordField<ErrorType>>, TypeExt),
|
||||
TagUnion(SendMap<TagName, Vec<ErrorType>>, TypeExt),
|
||||
RecursiveTagUnion(Box<ErrorType>, SendMap<TagName, Vec<ErrorType>>, TypeExt),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue