You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
vyper Version (output of vyper --version): ed0a654
OS: linux
Python Version (output of python --version): 3.10.8
What's your issue about?
The _check_iterator_modification check in vyper/semantics/analysis/local.py has false positives and false negatives.
The first contract is a false negative, and the second contract is a false positive.
struct A:
iter: DynArray[uint256, 5]
a: A
@external
def foo():
self.a.iter = [1, 2, 3]
for i in self.a.iter:
self.a = A({iter: [1, 2, 3, 4]})
a: DynArray[uint256, 5]
b: uint256[10]
@external
def foo():
self.a = [1, 2, 3]
for i in self.a:
self.b[self.a[1]] = i
Error compiling: tmp/iterator_false_positive.vy
vyper.exceptions.ImmutableViolation: Cannot modify array during iteration
contract "tmp/iterator_false_positive.vy:8", function "foo", line 8:15
7 for i in self.a:
---> 8 self.b[self.a[1]] = i
----------------------^
9
Version Information
vyper --version
): ed0a654python --version
): 3.10.8What's your issue about?
The
_check_iterator_modification
check invyper/semantics/analysis/local.py
has false positives and false negatives.The first contract is a false negative, and the second contract is a false positive.
h/t @trocher @ptrcarta
How can it be fixed?
Fill this in if you know how to fix it.
The text was updated successfully, but these errors were encountered: