Allow signed expressions in storage layout specifier#16589
Allow signed expressions in storage layout specifier#16589matheusaaguiar wants to merge 2 commits intodevelopfrom
Conversation
|
|
||
| Language Features: | ||
| * General: Add a builtin that computes the base slot of a storage namespace using the `erc7201` formula from ERC-7201. | ||
| * Custom Storage Layout: Allow signed positive expressions. |
There was a problem hiding this comment.
Move this up to maintain alphabetical ordering.
| uint constant UNSIGNED2 = 2; | ||
|
|
||
| contract A layout at SIGNED2 * 1 {} | ||
| contract B layout at SIGNED2_NEGATIVE * -1 {} |
There was a problem hiding this comment.
Do you have the opposite covered somewhere, i.e. where a 'complex' expression evaluates to a negative number, e.g. SIGNED2_NEGATIVE * 1? Although int_const_negative.sol would be a better place for such a test.
There was a problem hiding this comment.
Added to int_constant_negative.sol.
There was a problem hiding this comment.
Might make sense to add some max values in here, e.g. int constant x = type(int).max, although I assume we already have them around somewhere (likely in the initial implementation of the storage layout specifiers).
There was a problem hiding this comment.
Never mind, just checked and type(<type>).max is not supported by the constant expression evaluator at the moment :D
f27bc10 to
adee0c8
Compare
Suggested in #16456 (comment)
We intended to reject signed expressions for layout specifier, but since array lengths do accept them, this makes the handling consistent between both.
I guess not a bug then.