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.rs15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/type/check.rs b/src/type/check.rs
index f842b4c..02b629c 100644
--- a/src/type/check.rs
+++ b/src/type/check.rs
@@ -218,10 +218,10 @@ impl SExp {
pub fn type_check(&self) -> Result<Type, TypeError> {
let res = self.infer_type(HashMap::new());
match res {
- Ok(res) => match res.is_concrete() {
+ Ok(res) => {println!("maybe unbound: {}", res); match res.is_concrete() {
Ok(()) => Ok(res),
Err(name) => Err(UnboundGeneric(name)),
- },
+ }},
e => e,
}
}
@@ -281,6 +281,17 @@ impl SExp {
return scons(op.clone(), l.clone()).get_fun_type(ctx);
}
+ // Nil vector
+ if (**op).clone() == Atom(Nil) {
+ return match (**l).clone() {
+ SCons(v, n) if *n == Atom(Nil) => match *v {
+ Atom(Ty(t)) => Ok(vecof(t)),
+ _ => Err(OtherError),
+ },
+ _ => Err(OtherError)
+ }
+ }
+
// Case expressions
if let Some((scrutinee, patarms)) = scons(op.clone(), l.clone()).check_case() {
let scruty = scrutinee.infer_type(ctx.clone())?;