From db736d795b759edd913d96195747f0881c4e950f Mon Sep 17 00:00:00 2001 From: Joel Kronqvist Date: Tue, 12 Aug 2025 12:12:39 +0300 Subject: test: added failing tests for pattern match typing and matches_type --- src/type/mod.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/type/mod.rs') diff --git a/src/type/mod.rs b/src/type/mod.rs index f08dc1a..34506d0 100644 --- a/src/type/mod.rs +++ b/src/type/mod.rs @@ -5,6 +5,7 @@ pub mod display; pub mod check; pub mod subst; pub mod conversion; +pub mod case; use crate::sexp::SExp; @@ -59,6 +60,8 @@ pub enum TypeError { found: Type, }, + InvalidPattern(PatFail), + ArgumentsDontMatchGeneric { argtype: Type, generictype: Type, @@ -73,6 +76,7 @@ pub enum TypeError { OtherError } + #[derive(Debug,PartialEq)] pub enum FunDefError { NoFunToken, @@ -85,6 +89,18 @@ pub enum FunDefError { InvalidReturnType, } + +#[derive(Debug,PartialEq)] +pub enum PatFail { + RepeatedVariable(String, SExp), + TypeMismatch { + pattern: SExp, + expected: Type, + found: Type, + } +} + + use Type::*; impl Type { -- cgit v1.2.3