From 69da32d414441d5703f6ee026ff7000915a33f5e Mon Sep 17 00:00:00 2001 From: Jeff Date: Wed, 19 Jun 2024 00:09:47 -0400 Subject: [PATCH] Fix type inference bug --- dust-lang/src/abstract_tree/function_call.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/dust-lang/src/abstract_tree/function_call.rs b/dust-lang/src/abstract_tree/function_call.rs index fd84d10..c5e9a41 100644 --- a/dust-lang/src/abstract_tree/function_call.rs +++ b/dust-lang/src/abstract_tree/function_call.rs @@ -137,17 +137,17 @@ impl ExpectedType for FunctionCall { .. } = function_node_type { - for (constructor, identifier) in self - .type_arguments - .as_ref() - .unwrap() - .into_iter() - .zip(type_parameters.unwrap().into_iter()) + if let Type::Generic { + identifier: return_identifier, + .. + } = *return_type.clone() { - if let Type::Generic { - identifier: return_identifier, - .. - } = *return_type.clone() + for (constructor, identifier) in self + .type_arguments + .as_ref() + .unwrap() + .into_iter() + .zip(type_parameters.unwrap().into_iter()) { if return_identifier == identifier { let concrete_type = constructor.clone().construct(&context)?;