From d64165e9e6af92bfe350e5d2cc46545b28dbb5c0 Mon Sep 17 00:00:00 2001 From: Joel Kronqvist Date: Tue, 5 Aug 2025 18:07:50 +0300 Subject: Added vectors and tests for their evaluation and typing --- src/type/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/type/mod.rs') diff --git a/src/type/mod.rs b/src/type/mod.rs index e29e069..01aed40 100644 --- a/src/type/mod.rs +++ b/src/type/mod.rs @@ -22,6 +22,8 @@ pub enum Type { List(Vec), + VecOf(Box), + /// Type for generics /// and also error messages /// with unknown types @@ -89,6 +91,9 @@ impl Type { /// .is_concrete(), /// Err("a".to_string()) /// ); + /// + /// assert_eq!(vecof(vt("a")).is_concrete(), Err("a".to_string())); + /// assert_eq!(vecof(Integer).is_concrete(), Ok(())); /// ``` pub fn is_concrete(&self) -> Result<(), String> { match self { @@ -103,6 +108,7 @@ impl Type { } res }, + VecOf(ty) => (*ty).is_concrete(), VarType(s) => Err(s.clone()), } } -- cgit v1.2.3