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, 10 insertions, 7 deletions
diff --git a/src/type/check.rs b/src/type/check.rs
index 647ec4d..80cc974 100644
--- a/src/type/check.rs
+++ b/src/type/check.rs
@@ -192,7 +192,14 @@ impl Type {
match self {
Arrow(from, to) => {
- let generics = (*from).infer_generics_ctx(argtype, Vec::new())?;
+ let generics = match (*from).infer_generics_ctx(argtype, Vec::new()) {
+ Ok(x) => Ok(x),
+ Err(None) => Err(ArgumentsDontMatchGeneric {
+ argtype: argtype.clone(),
+ generictype: self.clone(),
+ }),
+ Err(Some(e)) => Err(e),
+ }?;
let mut restype = (**to).clone();
for (name, ty) in generics {
restype = restype.subst(&name, &ty);
@@ -211,7 +218,7 @@ impl Type {
&self,
argtype: &Type,
ctx: Vec<(String, Type)>
- ) -> Result<Vec<(String, Type)>, TypeError> {
+ ) -> Result<Vec<(String, Type)>, Option<TypeError>> {
match (self, argtype) {
(a, b) if a == b => Ok(ctx),
@@ -239,11 +246,7 @@ impl Type {
Ok(res)
},
- (_a, _b) => Err(InvalidArgList {
- arglist: Atom(Var("undefined".to_string())), // TODO: hacky as heck
- expected: self.clone(),
- found: argtype.clone(),
- }),
+ (_a, _b) => Err(None),
}
}