Skip to content

Commit

Permalink
Print object information on Z3TypeError (WIP)
Browse files Browse the repository at this point in the history
ref #776
  • Loading branch information
jklmnn committed Oct 14, 2022
1 parent e91b737 commit b1df95b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions rflx/expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -1947,7 +1947,9 @@ def z3expr(self) -> z3.BoolRef:
left = self.left.z3expr()
right = self.right.z3expr()
if not isinstance(left, z3.ArithRef) or not isinstance(right, z3.ArithRef):
raise Z3TypeError("less relation between non-arithmetic terms")
raise Z3TypeError(
f"less relation between non-arithmetic terms: {repr(left)} - {repr(right)}, {str(left)} - {str(right)}, {type(left)} - {type(right)}; {repr(self.left)} - {repr(self.right)}; {repr(self.left.type_)} - {repr(self.right.type_)}; {type(self.left.z3expr())} - {type(self.right.z3expr())}"
)
return left < right


Expand Down Expand Up @@ -2031,7 +2033,9 @@ def z3expr(self) -> z3.BoolRef:
left = self.left.z3expr()
right = self.right.z3expr()
if not isinstance(left, z3.ArithRef) or not isinstance(right, z3.ArithRef):
raise Z3TypeError("greater-equal relation between non-arithmetic terms")
raise Z3TypeError(
f"less relation between non-arithmetic terms: {repr(left)} - {repr(right)}, {str(left)} - {str(right)}, {type(left)} - {type(right)}"
)
return left >= right


Expand Down Expand Up @@ -2060,7 +2064,9 @@ def z3expr(self) -> z3.BoolRef:
left = self.left.z3expr()
right = self.right.z3expr()
if not isinstance(left, z3.ArithRef) or not isinstance(right, z3.ArithRef):
raise Z3TypeError("greater relation between non-arithmetic terms")
raise Z3TypeError(
f"less relation between non-arithmetic terms: {repr(left)} - {repr(right)}, {str(left)} - {str(right)}, {type(left)} - {type(right)}"
)
return left > right


Expand Down

0 comments on commit b1df95b

Please sign in to comment.