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/check.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/type/check.rs') 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 -- cgit v1.2.3