vyperlang / vyper

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

`_handle_modification` Fails for `IfExp` Nodes #4104

Open ritzdorf opened 4 months ago

ritzdorf commented 4 months ago

Version Information

When an IfExp node is passed to _handle_modification, the function fails to handle it and the compiler panics with an unhandled exception.

POC

The following examples demonstrate this behavior:

@external
def bar():
    d: DynArray[uint256, 2] = [1,2]
    (d if True else d)[1] = 1 # CompilerPanic: unhandled exception 
@external
def bar():
    d: DynArray[uint256, 2] = [1]
    x:uint256 = (d if True else d).pop() # CompilerPanic: unhandled exception
@external
def bar():
    d: DynArray[uint256, 2] = [1]
    (d if True else d).append(1) # CompilerPanic: unhandled exception