vyperlang / vyper

Pythonic Smart Contract Language for the EVM
https://vyperlang.org
Other
4.84k stars 788 forks source link

Imprecise Sanity Check #4100

Open ritzdorf opened 4 months ago

ritzdorf commented 4 months ago

Version Information

In _check_assign_list(), the following code is used to handle static array assignment:

if isinstance(left.typ, SArrayT):
    if not is_array_like(right.typ):  # pragma: nocover
        FAIL()
    if left.typ.count != right.typ.count:  # pragma: nocover
        FAIL()

    # TODO recurse into left, right if literals?
    check_assign(
        dummy_node_for_type(left.typ.value_type), dummy_node_for_type(right.typ.value_type)
    )

the check if not is_array_like(right.typ) could be more precise since dynamic arrays cannot be assigned to static arrays.