aboutsummaryrefslogtreecommitdiff
path: root/src/type/check.rs
diff options
context:
space:
mode:
authorJoel Kronqvist <joel.kronqvist@iki.fi>2025-08-12 12:12:39 +0300
committerJoel Kronqvist <joel.kronqvist@iki.fi>2025-08-12 12:12:39 +0300
commitdb736d795b759edd913d96195747f0881c4e950f (patch)
tree14cdf8e53810162857ff3a6ee672b9fd8e6ccbff /src/type/check.rs
parent2e17ad5361a86d004ca48419a0f69f9c298ec1e1 (diff)
downloadmyslip-db736d795b759edd913d96195747f0881c4e950f.tar.gz
myslip-db736d795b759edd913d96195747f0881c4e950f.zip
test: added failing tests for pattern match typing and matches_type
Diffstat (limited to 'src/type/check.rs')
-rw-r--r--src/type/check.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/type/check.rs b/src/type/check.rs
index b2815c7..9d7c52b 100644
--- a/src/type/check.rs
+++ b/src/type/check.rs
@@ -143,6 +143,24 @@ impl SExp {
/// };
/// Atom(Fun).type_check();
/// ```
+ ///
+ /// **Pattern matching**
+ ///
+ /// If this works, I guess it seems to work...
+ /// ```rust
+ /// use myslip::{
+ /// r#type::{*, Type::*, TypeError::*, util::*},
+ /// sexp::{SExp::*, SLeaf::*, util::*},
+ /// parse::parsetree::parse_to_ast
+ /// };
+ ///
+ /// assert_eq!(
+ /// parse_to_ast(
+ /// "(case (1 2 3 true false) ((x 2 3 false true) (+ x 1)) ((0 0 0 true true) 0) (_ 1))"
+ /// ).unwrap().type_check(),
+ /// Ok(Integer)
+ /// );
+ /// ```
///
///
/// Though perhaps the most important task of the type system