-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Allow signed expressions in storage layout specifier #16589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| int constant INT256 = -42; | ||
| int8 constant INT8 = -64; | ||
| int constant EXPRESSION = INT256 * 2; | ||
| int constant COMPLEX = EXPRESSION * -2 + EXPRESSION * 4; | ||
| contract A layout at INT256 {} | ||
| contract B layout at INT8 {} | ||
| contract C layout at EXPRESSION {} | ||
| contract D layout at COMPLEX {} | ||
| // ---- | ||
| // TypeError 6753: (169-175): The base slot of the storage layout evaluates to -42, which is outside the range of type uint256. | ||
| // TypeError 6753: (200-204): The base slot of the storage layout evaluates to -64, which is outside the range of type uint256. | ||
| // TypeError 6753: (229-239): The base slot of the storage layout evaluates to -84, which is outside the range of type uint256. | ||
| // TypeError 6753: (264-271): The base slot of the storage layout evaluates to -168, which is outside the range of type uint256. |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might make sense to add some max values in here, e.g.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Never mind, just checked and |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| int constant x = 42; | ||
| int16 constant y = 64; | ||
| contract C layout at x {} | ||
| contract D layout at y {} | ||
| // ---- |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| int constant SIGNED2 = 2; | ||
| int constant SIGNED2_NEGATIVE = -2; | ||
| uint constant UNSIGNED2 = 2; | ||
|
|
||
| contract A layout at SIGNED2 * 1 {} | ||
| contract B layout at SIGNED2_NEGATIVE * -1 {} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you have the opposite covered somewhere, i.e. where a 'complex' expression evaluates to a negative number, e.g.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added to |
||
| contract C layout at SIGNED2_NEGATIVE * SIGNED2_NEGATIVE {} | ||
| contract D layout at 2 * -1 * -1 {} | ||
| contract E layout at 2 * SIGNED2 {} | ||
| contract F layout at 2 * -1 * SIGNED2_NEGATIVE {} | ||
| // ---- | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this up to maintain alphabetical ordering.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ops, fixed!