From 255843cb3b51abf7d2194e0c1491e3efa8cb0424 Mon Sep 17 00:00:00 2001 From: Jeff Date: Sun, 18 Feb 2024 15:52:47 -0500 Subject: [PATCH] Fix type checking bugs --- src/abstract_tree/type.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/abstract_tree/type.rs b/src/abstract_tree/type.rs index f0edf15..1ac8391 100644 --- a/src/abstract_tree/type.rs +++ b/src/abstract_tree/type.rs @@ -69,11 +69,15 @@ impl Type { | (_, Type::Any) | (Type::Boolean, Type::Boolean) | (Type::Collection, Type::Collection) + | (Type::Collection, Type::String) + | (Type::Collection, Type::List) + | (Type::List, Type::Collection) + | (Type::Collection, Type::ListExact(_)) + | (Type::ListExact(_), Type::Collection) | (Type::Collection, Type::ListOf(_)) | (Type::ListOf(_), Type::Collection) | (Type::Collection, Type::Map(_)) | (Type::Map(_), Type::Collection) - | (Type::Collection, Type::String) | (Type::String, Type::Collection) | (Type::Float, Type::Float) | (Type::Integer, Type::Integer) @@ -109,6 +113,10 @@ impl Type { true } + (Type::ListExact(exact_types), Type::ListOf(of_type)) + | (Type::ListOf(of_type), Type::ListExact(exact_types)) => { + exact_types.iter().all(|r#type| r#type == of_type.as_ref()) + } ( Type::Function { parameter_types: self_parameter_types,