Skip to content

Commit

Permalink
fix: fix type checking for slicing upper bound
Browse files Browse the repository at this point in the history
Including z3.ArithRef (type of Length()) as valid slicing upper bound
  • Loading branch information
Raine-Yang-UofT committed Jul 15, 2024
1 parent 86eaa06 commit 1cfca13
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion python_ta/transforms/ExprWrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,11 @@ def parse_index_op(self, node: nodes.Subscript) -> z3.ExprRef:
)
step = 1 if slice.step is None else self._parse_number_literal(slice.step)

if isinstance(lower, int) and isinstance(upper, int) and isinstance(step, int):
if (
isinstance(lower, int)
and isinstance(upper, (int, z3.ArithRef))
and isinstance(step, int)
):

if step == 1:
return z3.SubString(value, lower, upper)
Expand Down

0 comments on commit 1cfca13

Please sign in to comment.