diff options
Diffstat (limited to 'src/type/check.rs')
-rw-r--r-- | src/type/check.rs | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/type/check.rs b/src/type/check.rs index 2c04d2e..effdc0a 100644 --- a/src/type/check.rs +++ b/src/type/check.rs @@ -220,7 +220,7 @@ impl SExp { match res { Ok(res) => match res.is_concrete() { Ok(()) => Ok(res), - Err(name) => Err(UnboundGeneric(name)), + Err(name) => Err(UnboundGeneric(name, res)), }, e => e, } @@ -338,10 +338,6 @@ impl SExp { let opertype = (*op).infer_type(ctx.clone())?; let argstype = (*l).infer_list_type(ctx)?; - if opertype == TypeLit && argstype.aka(&vecof(TypeLit)) { - return Ok(TypeLit); - } - let conv_args = match (opertype.clone(), argstype.clone()) { (Arrow(from, _), a) => match a.clone().into_type(&*from) { Ok(s) => Ok(s), @@ -429,7 +425,7 @@ impl Type { match restype.is_concrete() { Ok(()) => Ok(arr(argtype.clone(), restype)), - Err(unbound) => Err(UnboundGeneric(unbound)), + Err(unbound) => Err(UnboundGeneric(unbound, self.clone())), } }, _ => Err(OtherError) @@ -490,9 +486,8 @@ mod tests { #[test] fn test_failing_infer_generics() { - assert_eq!( - arr(Integer, VarType("X".to_string())).infer_generics(&Integer), - Err(TypeError::UnboundGeneric(String::from("X"))) + assert!( + arr(Integer, VarType("X".to_string())).infer_generics(&Integer).is_err() ); } |