Skip to content

Commit

Permalink
also check cse.get_extra_properties
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfikl committed Dec 2, 2021
1 parent 3e952c2 commit 1f1a550
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 5 additions & 1 deletion pymbolic/mapper/equality.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,11 @@ def map_common_subexpression(self, expr, other) -> bool:
return (
expr.prefix == other.prefix
and expr.scope == other.scope
and self.rec(expr.child, other.child))
and self.rec(expr.child, other.child)
and all(k == other_k and v == other_v
for (k, v), (other_k, other_v) in zip(
expr.get_extra_properties(),
other.get_extra_properties())))

def map_substitution(self, expr, other) -> bool:
return (
Expand Down
6 changes: 0 additions & 6 deletions pymbolic/primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -996,12 +996,6 @@ class Quotient(QuotientBase):
.. attribute:: denominator
"""

def is_equal(self, other):
from pymbolic.rational import Rational
return isinstance(other, (Rational, Quotient)) \
and (self.numerator == other.numerator) \
and (self.denominator == other.denominator)

mapper_method = intern("map_quotient")


Expand Down

0 comments on commit 1f1a550

Please sign in to comment.