vyper
vyper copied to clipboard
bug: multiple evaluations of DST lead to non-unique symbol error when copying byte arrays or dynamic arrays
Version Information
- vyper Version (output of
vyper --version): https://github.com/vyperlang/vyper/commit/9e3b9a2b8ae55aa83b5450080f750be15f819de7 - OS: linux
- Python Version (output of
python --version): 3.10.4
What's your issue about?
The destination of byte arrays and dynamic arrays copying is evaluated multiple times as cache_when_complex is not used. This includes make_byte_array_copier and _dynarray_make_setter (both cases: src.value == "multi" and src.value != "multi").
This contract fails to compile with the following error: AssertionError: non-unique symbols {'self.bar()2'}.
a: DynArray[DynArray[uint256, 2],2]
@external
def foo():
self.a[self.bar()] = [1, 2]
@internal
def bar() -> uint256:
return 0
reported by @trocher
How can it be fixed?
Fill this in if you know how to fix it.
Another example to add to tests when the issue will be patched:
d:String[4]
@internal
def bar()->uint256:
return 0
@external
def bar():
f:DynArray[String[5], 1] = ["aaaaa"]
f[self.bar()] = self.d