From dbe52e1ad74603c1a26e14c6e7fc146610a4d85e Mon Sep 17 00:00:00 2001 From: Jeff Date: Sun, 31 Dec 2023 14:17:43 -0500 Subject: [PATCH] Fix type check bug --- src/abstract_tree/assignment.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/abstract_tree/assignment.rs b/src/abstract_tree/assignment.rs index f9d28aa..dba4532 100644 --- a/src/abstract_tree/assignment.rs +++ b/src/abstract_tree/assignment.rs @@ -33,8 +33,6 @@ impl AbstractTree for Assignment { Some(TypeDefinition::from_syntax_node( source, type_node, context, )?) - } else if let Some((_, r#type)) = context.variables()?.get(identifier.inner()) { - Some(TypeDefinition::new(r#type.clone())) } else { None }; @@ -99,6 +97,8 @@ impl AbstractTree for Assignment { let variable_key = identifier.inner().clone(); let variable_type = if let Some(definition) = &type_definition { definition.inner().clone() + } else if let Some((_, r#type)) = context.variables()?.get(identifier.inner()) { + r#type.clone() } else { statement_type };