Skip to content

Commit

Permalink
cleanup code related to try expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomocavalieri authored and lpil committed Oct 7, 2024
1 parent 6afffcb commit 4aa05d0
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions compiler-core/src/type_/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1300,12 +1300,6 @@ pub enum UnifyErrorSituation {
/// The operands of a binary operator were incorrect.
Operator(BinOp),

/// A try expression returned a different error type to the previous try.
TryErrorMismatch,

/// The final value of a try expression was not a Result.
TryReturnResult,

/// One of the elements of a list was not the same type as the others.
ListElementMismatch,

Expand Down Expand Up @@ -1351,17 +1345,6 @@ annotation of this function.",
}
Self::Operator(_op) => None,

Self::TryErrorMismatch => Some(
"This returned value has a type incompatible with the previous try expression.
All the try expressions in a block and the final result value must have
the same error type.",
),

Self::TryReturnResult => Some(
"This returned value has a type incompatible with the previous try expression.
The returned value after a try must be of type Result.",
),

Self::ListElementMismatch => Some(
"All elements of a list must be the same type, but this one doesn't
match the one before it.",
Expand Down Expand Up @@ -1434,14 +1417,6 @@ impl UnifyError {
self.with_unify_error_situation(UnifyErrorSituation::Operator(binop))
}

pub fn inconsistent_try(self, return_value_is_result: bool) -> Self {
self.with_unify_error_situation(if return_value_is_result {
UnifyErrorSituation::TryErrorMismatch
} else {
UnifyErrorSituation::TryReturnResult
})
}

pub fn into_error(self, location: SrcSpan) -> Error {
match self {
Self::CouldNotUnify {
Expand Down

0 comments on commit 4aa05d0

Please sign in to comment.