From 258e926cf669ed3c7ce1de4c7ef169b7d27991f4 Mon Sep 17 00:00:00 2001 From: Emily Herbert <17410721+emilyaherbert@users.noreply.github.com> Date: Tue, 25 Jan 2022 14:51:47 -0600 Subject: [PATCH] Fix unhelpful error found when there is an unimplemented feature. (#700) * Don't report type mismatch if one of the types is error recovery. * Turn silent mode back on. --- sway-core/src/type_engine/engine.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/sway-core/src/type_engine/engine.rs b/sway-core/src/type_engine/engine.rs index a5832ab230c..54678b3f4ff 100644 --- a/sway-core/src/type_engine/engine.rs +++ b/sway-core/src/type_engine/engine.rs @@ -181,12 +181,16 @@ impl Engine { // } // If no previous attempts to unify were successful, raise an error - (_, _) => Err(TypeError::MismatchedType { - expected, - received, - help_text: Default::default(), - span: span.clone(), - }), + (the_received, the_expected) => match (the_received, the_expected) { + (TypeInfo::ErrorRecovery, _) => Ok(vec![]), + (_, TypeInfo::ErrorRecovery) => Ok(vec![]), + _ => Err(TypeError::MismatchedType { + expected, + received, + help_text: Default::default(), + span: span.clone(), + }), + }, } }