aboutsummaryrefslogtreecommitdiff
path: root/src/type/conversion.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/type/conversion.rs')
-rw-r--r--src/type/conversion.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/type/conversion.rs b/src/type/conversion.rs
index 844632f..ab858e6 100644
--- a/src/type/conversion.rs
+++ b/src/type/conversion.rs
@@ -12,6 +12,7 @@ impl Type {
/// 1. (T T ... T T) -> (T ...)
/// 2. self = concrete and other = variable type => self,
/// 3. arrow types and lists are mapped
+ /// 4. makes [self] self if self == other
pub fn convert(self, other: &Type) -> Result<Type, ()> {
let (ty, ctx) = self.convert_ctx(other)?;
let mut checks = HashMap::new();
@@ -83,6 +84,12 @@ impl Type {
Ok((vecof(convt), ctx))
},
+ // at the end, because it'd be nice to know in the
+ // guard that the conversion from v to t2 works, and
+ // if it doesn't, try something else, but now everyhting
+ // has already been tried so this is safe
+ (List(v), t2) if v.len() == 1 => v[0].clone().convert_ctx(t2),
+
_ => Err(())
}
}