vyperlang / vyper

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

bug: compiler panic when returning empty constant #4044

Open tserg opened 1 month ago

tserg commented 1 month ago

Version Information

What's your issue about?

The following contracts that used to compile in v0.3.9 now fail compilation. I have traced it to 56c4c9dbc09d6310bf132cfde3fdbe1431189a9b.

BOO: constant(uint256[3]) = empty(uint256[3])

@external
def foo() -> uint256[3]:
    return BOO
vyper.exceptions.CompilerPanic: unreachable!

  contract "tmp/empty_list.vy:7", function "foo", line 7:4 
       6 #def foo() -> DynArray[uint256, 3]:
  ---> 7     return BOO
  -----------^
       8     #return empty(uint256[3])

This is an unhandled internal compiler error. Please create an issue on Github to notify the developers!
BOO: constant(DynArray[uint256, 3]) = empty(DynArray[uint256, 3])

@external
def foo() -> DynArray[uint256, 3]:
    return BOO
vyper.exceptions.CompilerPanic: cannot dereference non-pointer type

  contract "tmp/empty_list.vy:7", function "foo", line 7:4 
       6 def foo() -> DynArray[uint256, 3]:
  ---> 7     return BOO
  -----------^
       8     #return empty(uint256[3])

This is an unhandled internal compiler error. Please create an issue on Github to notify the developers!

How can it be fixed?

Fill this in if you know how to fix it.

tserg commented 1 month ago

Structs are affected too.