This commit is contained in:
Ayaz Hafiz 2022-07-19 08:14:12 -04:00
parent 92b5b0ef42
commit 666becad87
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 17 additions and 21 deletions

View file

@ -611,19 +611,17 @@ fn canonicalize_opaque<'a>(
ability_name: ability, ability_name: ability,
impls: impl_map, impls: impl_map,
}); });
} else if ability.is_builtin_ability() {
derived_abilities.push(Loc::at(region, ability));
supported_abilities.push(OpaqueSupports::Derived(ability));
} else { } else {
if ability.is_builtin_ability() { // There was no record specified of functions to use for
derived_abilities.push(Loc::at(region, ability)); // members, but also this isn't a builtin ability, so we don't
supported_abilities.push(OpaqueSupports::Derived(ability)); // know how to auto-derive it.
} else { //
// There was no record specified of functions to use for // Register the problem but keep going, we may still be able to compile the
// members, but also this isn't a builtin ability, so we don't // program even if a derive is missing.
// know how to auto-derive it. env.problem(Problem::IllegalClaimedAbility(region));
//
// Register the problem but keep going, we may still be able to compile the
// program even if a derive is missing.
env.problem(Problem::IllegalClaimedAbility(region));
}
} }
} }
@ -693,14 +691,11 @@ pub(crate) fn canonicalize_defs<'a>(
if let Ok(type_index) = either_index.split() { if let Ok(type_index) = either_index.split() {
let type_def = &loc_defs.type_defs[type_index.index()]; let type_def = &loc_defs.type_defs[type_index.index()];
let pending_type_def = to_pending_type_def(env, type_def, scope, pattern_type); let pending_type_def = to_pending_type_def(env, type_def, scope, pattern_type);
match &pending_type_def { if let PendingTypeDef::Ability { name, members } = &pending_type_def {
PendingTypeDef::Ability { name, members } => { pending_abilities_in_scope.insert(
pending_abilities_in_scope.insert( name.value,
name.value, members.iter().map(|mem| mem.name.value).collect(),
members.iter().map(|mem| mem.name.value).collect(), );
);
}
_ => {}
} }
pending_type_defs.push(pending_type_def); pending_type_defs.push(pending_type_def);
} }
@ -714,7 +709,7 @@ pub(crate) fn canonicalize_defs<'a>(
let pending = to_pending_value_def( let pending = to_pending_value_def(
env, env,
var_store, var_store,
&value_def, value_def,
scope, scope,
&pending_abilities_in_scope, &pending_abilities_in_scope,
&mut output, &mut output,

View file

@ -175,6 +175,7 @@ pub enum DestructType {
Guard(Variable, Loc<Pattern>), Guard(Variable, Loc<Pattern>),
} }
#[allow(clippy::too_many_arguments)]
pub fn canonicalize_def_header_pattern<'a>( pub fn canonicalize_def_header_pattern<'a>(
env: &mut Env<'a>, env: &mut Env<'a>,
var_store: &mut VarStore, var_store: &mut VarStore,