diff --git a/loopy/match.py b/loopy/match.py index 66cc58cbe58f09a9d03e70231079d38b761b7f27..ab0038af8dc5e9189a382bb76115998f57aef74e 100644 --- a/loopy/match.py +++ b/loopy/match.py @@ -140,6 +140,9 @@ class All(MatchExpressionBase): def __eq__(self, other): return (type(self) == type(other)) + def __hash__(self): + return hash(type(self)) + class And(MatchExpressionBase): def __init__(self, children): @@ -159,6 +162,9 @@ class And(MatchExpressionBase): return (type(self) == type(other) and self.children == other.children) + def __hash__(self): + return hash((type(self), self.children)) + class Or(MatchExpressionBase): def __init__(self, children): @@ -178,6 +184,9 @@ class Or(MatchExpressionBase): return (type(self) == type(other) and self.children == other.children) + def __hash__(self): + return hash((type(self), self.children)) + class Not(MatchExpressionBase): def __init__(self, child): @@ -197,6 +206,9 @@ class Not(MatchExpressionBase): return (type(self) == type(other) and self.child == other.child) + def __hash__(self): + return hash((type(self), self.child)) + class GlobMatchExpressionBase(MatchExpressionBase): def __init__(self, glob): @@ -218,6 +230,9 @@ class GlobMatchExpressionBase(MatchExpressionBase): return (type(self) == type(other) and self.glob == other.glob) + def __hash__(self): + return hash((type(self), self.glob)) + class Id(GlobMatchExpressionBase): def __call__(self, kernel, matchable):