diff options
author | Joel Kronqvist <joel.kronqvist@iki.fi> | 2025-08-12 12:12:39 +0300 |
---|---|---|
committer | Joel Kronqvist <joel.kronqvist@iki.fi> | 2025-08-12 12:12:39 +0300 |
commit | db736d795b759edd913d96195747f0881c4e950f (patch) | |
tree | 14cdf8e53810162857ff3a6ee672b9fd8e6ccbff /src/type/mod.rs | |
parent | 2e17ad5361a86d004ca48419a0f69f9c298ec1e1 (diff) | |
download | myslip-db736d795b759edd913d96195747f0881c4e950f.tar.gz myslip-db736d795b759edd913d96195747f0881c4e950f.zip |
test: added failing tests for pattern match typing and matches_type
Diffstat (limited to 'src/type/mod.rs')
-rw-r--r-- | src/type/mod.rs | 16 |
1 files changed, 16 insertions, 0 deletions
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 { |