vyper icon indicating copy to clipboard operation
vyper copied to clipboard

fix[ux]: indexing empty literal arrays

Open tserg opened this issue 1 year ago • 5 comments

What I did

Fix #4001

How I did it

  • Check if reduced value is a literal list in visit_Subscript in local visitor
  • Special handling for folding of dynamic arrays for empty builtin.

How to verify it

Commit message

fix: indexing empty literal array

This PR properly handles the exception for indexing into an 
empty literal array.

Description for the changelog

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

tserg avatar May 20 '24 10:05 tserg

is that an axolotl?

charles-cooper avatar May 20 '24 12:05 charles-cooper

is that an axolotl?

yes ser

tserg avatar May 20 '24 13:05 tserg

maybe we should add rules for all the other types?

charles-cooper avatar May 20 '24 13:05 charles-cooper

maybe we should add rules for all the other types?

do you mean to return a vyper node where possible in builtin(empty)._try_fold()?

tserg avatar May 20 '24 13:05 tserg

do you mean to return a vyper node where possible in builtin(empty)._try_fold()?

yea, we might be able to remove some ~empty things in codegen (but i'm not sure, it's been awhile since that code has been touched)

charles-cooper avatar May 21 '24 11:05 charles-cooper