Remove problems from error type API surface

This commit is contained in:
Ayaz Hafiz 2022-11-08 13:38:42 -06:00
parent b6322ff883
commit 09748aec48
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
5 changed files with 32 additions and 45 deletions

View file

@ -191,8 +191,7 @@ impl ObligationCache {
// Demote the bad variable that exposed this problem to an error, both so
// that we have an ErrorType to report and so that codegen knows to deal
// with the error later.
let (error_type, _moar_ghosts_n_stuff) =
subs.var_to_error_type(var, Polarity::OF_VALUE);
let error_type = subs.var_to_error_type(var, Polarity::OF_VALUE);
problems.push(TypeError::BadExprMissingAbility(
region,
category,
@ -209,8 +208,7 @@ impl ObligationCache {
// Demote the bad variable that exposed this problem to an error, both so
// that we have an ErrorType to report and so that codegen knows to deal
// with the error later.
let (error_type, _moar_ghosts_n_stuff) =
subs.var_to_error_type(var, Polarity::OF_PATTERN);
let error_type = subs.var_to_error_type(var, Polarity::OF_PATTERN);
problems.push(TypeError::BadPatternMissingAbility(
region,
category,
@ -311,15 +309,14 @@ impl ObligationCache {
})) => Some(if failure_var == var {
UnderivableReason::SurfaceNotDerivable(context)
} else {
let (error_type, _skeletons) =
subs.var_to_error_type(failure_var, Polarity::OF_VALUE);
let error_type = subs.var_to_error_type(failure_var, Polarity::OF_VALUE);
UnderivableReason::NestedNotDerivable(error_type, context)
}),
None => Some(UnderivableReason::NotABuiltin),
};
if let Some(underivable_reason) = opt_underivable {
let (error_type, _skeletons) = subs.var_to_error_type(var, Polarity::OF_VALUE);
let error_type = subs.var_to_error_type(var, Polarity::OF_VALUE);
Err(Unfulfilled::AdhocUnderivable {
typ: error_type,

View file

@ -2013,7 +2013,7 @@ fn check_ability_specialization(
// Commit so that the bad signature and its error persists in subs.
subs.commit_snapshot(snapshot);
let (_typ, _problems) =
let _typ =
subs.var_to_error_type(symbol_loc_var.value, Polarity::OF_VALUE);
let problem = TypeError::WrongSpecialization {
@ -2034,7 +2034,7 @@ fn check_ability_specialization(
// Commit so that `var` persists in subs.
subs.commit_snapshot(snapshot);
let (typ, _problems) = subs.var_to_error_type(var, Polarity::OF_VALUE);
let typ = subs.var_to_error_type(var, Polarity::OF_VALUE);
let problem = TypeError::StructuralSpecialization {
region: symbol_loc_var.region,
@ -2056,9 +2056,9 @@ fn check_ability_specialization(
// so we can have two separate error types.
subs.rollback_to(snapshot);
let (expected_type, _problems) =
let expected_type =
subs.var_to_error_type(root_signature_var, Polarity::OF_VALUE);
let (actual_type, _problems) =
let actual_type =
subs.var_to_error_type(symbol_loc_var.value, Polarity::OF_VALUE);
let reason = Reason::GeneralizedAbilityMemberSpecialization {
@ -3492,7 +3492,7 @@ fn circular_error(
loc_var: &Loc<Variable>,
) {
let var = loc_var.value;
let (error_type, _) = subs.var_to_error_type(var, Polarity::OF_VALUE);
let error_type = subs.var_to_error_type(var, Polarity::OF_VALUE);
let problem = TypeError::CircularType(loc_var.region, symbol, error_type);
subs.set_content(var, Content::Error);