Skip to content

Commit

Permalink
fix: make is_same_shape work for primitives
Browse files Browse the repository at this point in the history
  • Loading branch information
jac3km4 committed Nov 28, 2022
1 parent b4f65e7 commit 7cb3ec7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions compiler/src/typer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1083,11 +1083,11 @@ impl<'id> Mono<'id> {
(Self::Bottom, _) | (_, Type::Top | Type::Var(_)) => true,
(Self::Prim(lhs), Type::Prim(rhs)) => lhs == rhs,
(Self::Data(lhs), Type::Data(rhs)) if lhs.id == rhs.id => true,
(Self::Data(lhs), Type::Data(rhs)) => {
match (lhs.id.ref_type(), &lhs.args[..], rhs.id.ref_type(), &rhs.args[..]) {
(Some(_), [lhs], Some(_), [rhs]) => lhs.is_same_shape(rhs),
(Some(_), [lhs], None, _) => lhs.is_same_shape(typ),
(None, _, Some(_), [rhs]) => self.is_same_shape(rhs),
(lhs, Type::Data(rhs)) => {
match (lhs.ref_type(), rhs.id.ref_type(), &rhs.args[..]) {
(Some((_, lhs)), Some(_), [rhs]) => lhs.is_same_shape(rhs),
(Some((_, lhs)), None, _) => lhs.is_same_shape(typ),
(None, Some(_), [rhs]) => self.is_same_shape(rhs),
_ => false,
}
}
Expand Down

0 comments on commit 7cb3ec7

Please sign in to comment.