diff --git a/dust-lang/src/abstract_tree/function_call.rs b/dust-lang/src/abstract_tree/function_call.rs index cf08120..45b2fa2 100644 --- a/dust-lang/src/abstract_tree/function_call.rs +++ b/dust-lang/src/abstract_tree/function_call.rs @@ -134,8 +134,8 @@ impl AbstractNode for FunctionCall { .map(|r#type| r#type.node.clone()) .zip(self.type_arguments.into_iter().map(|r#type| r#type.node)) { - if let Type::Argument(identifier, r#type) = type_parameter { - function_context.set_type(identifier, *r#type)?; + if let Type::Argument(identifier) = type_parameter { + function_context.set_type(identifier, type_argument)?; } } }; diff --git a/dust-lang/src/abstract_tree/type.rs b/dust-lang/src/abstract_tree/type.rs index f779ffa..5cb0b77 100644 --- a/dust-lang/src/abstract_tree/type.rs +++ b/dust-lang/src/abstract_tree/type.rs @@ -13,7 +13,7 @@ use super::{AbstractNode, Action, WithPosition}; #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord)] pub enum Type { Any, - Argument(Identifier, Box), + Argument(Identifier), Boolean, Float, Function { @@ -51,6 +51,11 @@ impl Type { | (Type::None, Type::None) | (Type::Range, Type::Range) | (Type::String, Type::String) => return Ok(()), + (Type::Argument(left), Type::Argument(right)) => { + if left == right { + return Ok(()); + } + } (Type::ListOf(left), Type::ListOf(right)) => { if let Ok(()) = left.node.check(&right.node) { return Ok(()); @@ -191,7 +196,7 @@ impl Display for Type { write!(f, ") : {}", return_type.node) } Type::Structure { name, .. } => write!(f, "{name}"), - Type::Argument(identifier, _type) => write!(f, "{identifier}"), + Type::Argument(identifier) => write!(f, "{identifier}"), } } }