aboutsummaryrefslogtreecommitdiff
path: root/src/type/check.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/type/check.rs')
-rw-r--r--src/type/check.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/type/check.rs b/src/type/check.rs
index c3bdcb4..10ef8b4 100644
--- a/src/type/check.rs
+++ b/src/type/check.rs
@@ -44,6 +44,20 @@ impl SExp {
/// );
/// ```
///
+ /// Vectors are kind of special...
+ /// ```rust
+ /// use myslip::{
+ /// r#type::{*, Type::*, TypeError::*, util::*},
+ /// sexp::{SExp::*, SLeaf::*, util::*},
+ /// };
+ ///
+ /// assert_eq!(
+ /// scons(Vector, scons(1, scons(3, Nil))).type_check(),
+ /// Ok(vecof(Integer))
+ /// );
+ /// ```
+ /// ...so please don't ask what their type is.
+ ///
/// Some common operators get arrow types:
/// ```rust
/// use myslip::{
@@ -109,6 +123,8 @@ impl SExp {
/// assert!(scons(And, scons(1, scons(Atom(True), Nil))).type_check().is_err());
/// assert!(scons(Mul, scons(1, scons(Atom(True), Nil))).type_check().is_err());
/// assert!(scons(Not, scons(1, Nil)).type_check().is_err());
+ ///
+ /// assert!(scons(Vector, scons(1, scons(True, Nil))).type_check().is_err());
/// ```
///
/// Also, free variables should result in an error
@@ -153,6 +169,7 @@ impl SExp {
vt("T"),
List(vec![QuoteTy, vt("T")])
)),
+ Atom(Vector) => todo!(),
SCons(op, l) => {
let opertype = (*op).infer_type(ctx.clone())?;