diff --git a/nac3core/src/typecheck/typedef/mod.rs b/nac3core/src/typecheck/typedef/mod.rs
index 0164641f..33cda9db 100644
--- a/nac3core/src/typecheck/typedef/mod.rs
+++ b/nac3core/src/typecheck/typedef/mod.rs
@@ -204,10 +204,9 @@ impl Unifier {
}
for v1 in old_range2.iter() {
for v2 in range1.iter() {
- if !self.shape_match(*v1, *v2) {
- continue;
+ if let Ok(result) = self.shape_match(*v1, *v2){
+ range2.push(result.unwrap_or(*v2));
}
- range2.push(*v2);
}
}
if range2.is_empty() {
@@ -648,39 +647,116 @@ impl Unifier {
Ok(())
}
- fn shape_match(&mut self, a: Type, b: Type) -> bool {
+ fn shape_match(&mut self, a: Type, b: Type) -> Result