vyperlang / vyper

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

compiler panic on indexing empty literal arrays #4001

Open ritzdorf opened 4 months ago

ritzdorf commented 4 months ago

Version Information

Indexing an empty array is not caught by the type checker and causes the code generation to fail with a compiler panic.

POC

Compiling the following contract will cause a compiler panic:

@external
def bar(x:uint128):
    a:uint128 = empty(DynArray[uint128,2])[0]
vyper.exceptions.TypeCheckFailure: indexing into zero array not allowed