Skip to content

Commit

Permalink
Fix equality bug (use equals over === for objects).
Browse files Browse the repository at this point in the history
  • Loading branch information
efritz committed Apr 24, 2018
1 parent c9a9860 commit 6fb4897
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/typechecker.js
Expand Up @@ -41,7 +41,6 @@ class Constraint {
if (b instanceof NamedType || b instanceof SumType) {
let na = (a instanceof NamedType) ? [a] : a.names;
let nb = (b instanceof NamedType) ? [b] : b.names;

return na.every(t1 => nb.some(t2 => t1.equals(t2)));
}
}
Expand Down Expand Up @@ -463,7 +462,7 @@ function glb(a, b) {
if (b instanceof NamedType || b instanceof SumType) {
let na = (a instanceof NamedType) ? [a] : a.names;
let nb = (b instanceof NamedType) ? [b] : b.names;
let ni = na.filter(t1 => nb.some(t2 => t1 === t2));
let ni = na.filter(t1 => nb.some(t2 => t1.equals(t2)));

if (ni.length == 1) return new NamedType(ni[0]);
if (ni.length >= 2) return new SumType(ni);
Expand Down

0 comments on commit 6fb4897

Please sign in to comment.