Skip to content

Commit

Permalink
Functions should unify with type any.
Browse files Browse the repository at this point in the history
  • Loading branch information
alpacaaa committed Jul 26, 2023
1 parent c968cc1 commit 65f3eba
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions compiler/src/infer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1950,15 +1950,19 @@ has no field or method:
Ok(())
}

// Matching functions with constructors is always an error
(Type::Fun { .. }, Type::Con { .. }) => Err("Type mismatch".to_string()),
(Type::Con { .. }, Type::Fun { .. }) => Err("Type mismatch".to_string()),
/*
_ => {
self.dump();
todo!("{:?}, {:?}", t1, t2)
}
*/
// Matching functions with constructors is always an error, unless the type is any
(Type::Fun { .. }, Type::Con { .. }) | (Type::Con { .. }, Type::Fun { .. }) => {
if t1 == &self.type_any() || t2 == &self.type_any() {
return Ok(());
}

Err("Type mismatch".to_string())
} /*
_ => {
self.dump();
todo!("{:?}, {:?}", t1, t2)
}
*/
}
}

Expand Down

0 comments on commit 65f3eba

Please sign in to comment.