Skip to content

Commit

Permalink
Improve BoolRef addition (#7045)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyilo committed Dec 5, 2023
1 parent 7c81ee0 commit a9513c1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/api/python/z3/z3.py
Original file line number Diff line number Diff line change
Expand Up @@ -1572,7 +1572,12 @@ def sort(self):
return BoolSortRef(Z3_get_sort(self.ctx_ref(), self.as_ast()), self.ctx)

def __add__(self, other):
return If(self, 1, 0) + If(other, 1, 0)
if isinstance(other, BoolRef):
other = If(other, 1, 0)
return If(self, 1, 0) + other

def __radd__(self, other):
return self + other

def __rmul__(self, other):
return self * other
Expand Down

0 comments on commit a9513c1

Please sign in to comment.