Skip to content

Commit

Permalink
simplify visit_For
Browse files Browse the repository at this point in the history
  • Loading branch information
tserg committed Sep 28, 2023
1 parent c73080e commit 9880fbf
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions vyper/semantics/analysis/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def visit_For(self, node):
if bound is None:
n_val = derive_folded_value(n)
if not isinstance(n_val, int):
raise StateAccessViolation("Value must be a literal", n)
raise StateAccessViolation("Value must be a literal integer", n)
if n_val <= 0:
raise StructureException("For loop must have at least 1 iteration", args[0])
type_list = get_possible_types_from_node(n)
Expand Down Expand Up @@ -398,9 +398,7 @@ def visit_For(self, node):
)

right_val = derive_folded_value(args[1].right)
if not isinstance(args[1].right, vy_ast.Int) and not (
isinstance(args[1].right, vy_ast.Name) and right_val
):
if right_val is None:
raise InvalidLiteral("Literal must be an integer", args[1].right)
if right_val < 1:
raise StructureException(
Expand Down

0 comments on commit 9880fbf

Please sign in to comment.