From 4aa05d0a754c8cfd64a1109c16247bbf1bb6060a Mon Sep 17 00:00:00 2001 From: Giacomo Cavalieri Date: Sat, 5 Oct 2024 15:24:12 +0200 Subject: [PATCH] cleanup code related to try expressions --- compiler-core/src/type_/error.rs | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/compiler-core/src/type_/error.rs b/compiler-core/src/type_/error.rs index 7df7412ce98..c1dfd07b35b 100644 --- a/compiler-core/src/type_/error.rs +++ b/compiler-core/src/type_/error.rs @@ -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, @@ -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.", @@ -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 {