-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Support constants in custom storage layout expression #15944
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
Open
matheusaaguiar
wants to merge
8
commits into
develop
Choose a base branch
from
allowConstantsCustomStorageLayout
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8554ac4
Update and add tests
matheusaaguiar d9edd2a
Allow constants in custom storage layout expression
matheusaaguiar 947b0df
fixup! Update and add tests
matheusaaguiar 77415c1
fixup! Allow constants in custom storage layout
matheusaaguiar a8c2ddc
fixup! Update and add tests
matheusaaguiar 9eb4130
Update Changelog.md
matheusaaguiar de2597c
fixup! Update and add tests
matheusaaguiar bbfd87c
fixup! Allow constants in custom storage layout expression
matheusaaguiar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
test/libsolidity/syntaxTests/storageLayoutSpecifier/abi_decode.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
contract C layout at abi.decode(abi.encode(42), (uint)) {} | ||
// ---- | ||
// TypeError 6396: (21-55): The base slot of the storage layout must evaluate to a rational number. | ||
// TypeError 1505: (21-55): The base slot expression contains elements that are not yet supported by the internal constant evaluator and therefore cannot be evaluated at compilation time. |
2 changes: 1 addition & 1 deletion
2
test/libsolidity/syntaxTests/storageLayoutSpecifier/address.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
contract C layout at address(0x1234) {} | ||
// ---- | ||
// TypeError 6396: (21-36): The base slot of the storage layout must evaluate to a rational number. | ||
// TypeError 1763: (21-36): The base slot of the storage layout must evaluate to an integer. The type of the supplied expression is address. |
6 changes: 6 additions & 0 deletions
6
test/libsolidity/syntaxTests/storageLayoutSpecifier/address_constant.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
address constant x = 0xdCad3a6d3569DF655070DEd06cb7A1b2Ccd1D3AF; | ||
contract C layout at x { | ||
|
||
} | ||
// ---- | ||
// TypeError 1763: (86-87): The base slot of the storage layout must evaluate to an integer. The type of the supplied expression is address. |
2 changes: 1 addition & 1 deletion
2
test/libsolidity/syntaxTests/storageLayoutSpecifier/array_literal.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
contract C layout at [1, 2, 3] {} | ||
// ---- | ||
// TypeError 6396: (21-30): The base slot of the storage layout must evaluate to a rational number. | ||
// TypeError 1763: (21-30): The base slot of the storage layout must evaluate to an integer. |
2 changes: 1 addition & 1 deletion
2
test/libsolidity/syntaxTests/storageLayoutSpecifier/bitwise_negation_after_cast.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
contract C layout at ~uint(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) {} | ||
// ---- | ||
// TypeError 6396: (21-94): The base slot of the storage layout must evaluate to a rational number. | ||
// TypeError 1505: (21-94): The base slot expression contains elements that are not yet supported by the internal constant evaluator and therefore cannot be evaluated at compilation time. |
4 changes: 4 additions & 0 deletions
4
test/libsolidity/syntaxTests/storageLayoutSpecifier/bool_constant.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
bool constant x = false; | ||
contract C layout at x {} | ||
// ---- | ||
// TypeError 1763: (46-47): The base slot of the storage layout must evaluate to an integer. |
2 changes: 1 addition & 1 deletion
2
test/libsolidity/syntaxTests/storageLayoutSpecifier/boolean.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
contract C layout at true {} | ||
// ---- | ||
// TypeError 6396: (21-25): The base slot of the storage layout must evaluate to a rational number. | ||
// TypeError 1763: (21-25): The base slot of the storage layout must evaluate to an integer. |
6 changes: 6 additions & 0 deletions
6
test/libsolidity/syntaxTests/storageLayoutSpecifier/bytes_constant.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
bytes32 constant CONST1 = "12345"; | ||
contract A layout at CONST1 {} | ||
contract C layout at CONST1[1] {} | ||
// ---- | ||
// TypeError 1763: (56-62): The base slot of the storage layout must evaluate to an integer. The type of the supplied expression is bytes32. | ||
// TypeError 1763: (87-96): The base slot of the storage layout must evaluate to an integer. The type of the supplied expression is bytes1. |
2 changes: 1 addition & 1 deletion
2
test/libsolidity/syntaxTests/storageLayoutSpecifier/constant_divided_by_its_negation.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
uint constant N = 100; | ||
contract C layout at N / ~N {} | ||
// ---- | ||
// TypeError 6396: (44-50): The base slot of the storage layout must evaluate to a rational number. | ||
// TypeError 3667: (48-50): Arithmetic error when computing constant value. |
2 changes: 1 addition & 1 deletion
2
test/libsolidity/syntaxTests/storageLayoutSpecifier/constant_divided_by_zero.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
uint constant N = 100; | ||
contract C layout at N / 0 {} | ||
// ---- | ||
// TypeError 6396: (44-49): The base slot of the storage layout must evaluate to a rational number. | ||
// TypeError 1505: (44-49): The base slot expression contains elements that are not yet supported by the internal constant evaluator and therefore cannot be evaluated at compilation time. | ||
matheusaaguiar marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
test/libsolidity/syntaxTests/storageLayoutSpecifier/constant_from_module.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
==== Source: A ==== | ||
uint constant x = 77; | ||
|
||
==== Source: B ==== | ||
import "A" as M; | ||
contract C layout at M.x{ } | ||
// ---- | ||
// TypeError 1505: (B:38-41): The base slot expression contains elements that are not yet supported by the internal constant evaluator and therefore cannot be evaluated at compilation time. |
7 changes: 7 additions & 0 deletions
7
test/libsolidity/syntaxTests/storageLayoutSpecifier/constant_initialized_from_builtin.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
uint constant x = addmod(10, 2, 8); | ||
uint constant y = mulmod(10, 2, 8); | ||
contract C layout at x {} | ||
contract D layout at y {} | ||
// ---- | ||
// TypeError 1505: (93-94): The base slot expression contains elements that are not yet supported by the internal constant evaluator and therefore cannot be evaluated at compilation time. | ||
// TypeError 1505: (119-120): The base slot expression contains elements that are not yet supported by the internal constant evaluator and therefore cannot be evaluated at compilation time. |
4 changes: 4 additions & 0 deletions
4
test/libsolidity/syntaxTests/storageLayoutSpecifier/constant_initialized_from_cast.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
uint constant x = uint(42); | ||
contract C layout at x {} | ||
// ---- | ||
// TypeError 1505: (49-50): The base slot expression contains elements that are not yet supported by the internal constant evaluator and therefore cannot be evaluated at compilation time. |
4 changes: 4 additions & 0 deletions
4
...bsolidity/syntaxTests/storageLayoutSpecifier/constant_initialized_from_other_constant.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
uint constant x = 42; | ||
uint constant y = x * 2; | ||
contract C layout at y {} | ||
// ---- |
3 changes: 3 additions & 0 deletions
3
...idity/syntaxTests/storageLayoutSpecifier/constant_initialized_with_literal_expression.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
uint constant x = ((2**5 + 2**5) * (2 ** 10 + 1 << 1)) % 2**256 - 1; | ||
contract C layout at x {} | ||
// ---- |
7 changes: 7 additions & 0 deletions
7
...ests/storageLayoutSpecifier/constant_initialized_with_unlimited_arithmetic_expression.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
uint constant CONST1 = 1.23e100 / 2e50; | ||
contract C layout at CONST1 {} | ||
uint constant CONST2 = 2**256 * (500e-3); | ||
contract D layout at CONST2 {} | ||
uint constant CONST3 = (2**255 * 2) - (2**256 + 1) + 1; | ||
contract E layout at CONST3 {} | ||
// ---- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
test/libsolidity/syntaxTests/storageLayoutSpecifier/hex_address.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
contract C layout at 0xdCad3a6d3569DF655070DEd06cb7A1b2Ccd1D3AF {} | ||
// ---- | ||
// TypeError 6396: (21-63): The base slot of the storage layout must evaluate to a rational number. | ||
// TypeError 1763: (21-63): The base slot of the storage layout must evaluate to an integer. The type of the supplied expression is address. |
2 changes: 1 addition & 1 deletion
2
test/libsolidity/syntaxTests/storageLayoutSpecifier/hex_string.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
contract C layout at hex"616263" {} | ||
// ---- | ||
// TypeError 6396: (21-32): The base slot of the storage layout must evaluate to a rational number. | ||
// TypeError 1763: (21-32): The base slot of the storage layout must evaluate to an integer. |
2 changes: 1 addition & 1 deletion
2
test/libsolidity/syntaxTests/storageLayoutSpecifier/hex_string_cast.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
contract at layout at uint40(bytes5(hex"0011223344")) { } | ||
// ---- | ||
// TypeError 6396: (22-53): The base slot of the storage layout must evaluate to a rational number. | ||
// TypeError 1505: (22-53): The base slot expression contains elements that are not yet supported by the internal constant evaluator and therefore cannot be evaluated at compilation time. |
17 changes: 17 additions & 0 deletions
17
test/libsolidity/syntaxTests/storageLayoutSpecifier/immutables.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
function f() returns (uint) { | ||
return 2; | ||
} | ||
|
||
contract A { | ||
address immutable a = 0x0000000000000000000000000000000000000001; | ||
uint immutable x = 1; // considered pure by the compiler (initialized with a literal) | ||
uint immutable y = f(); // considered not pure by the compiler (initialized with a function) | ||
} | ||
|
||
contract B is A layout at A.a { } | ||
contract C is A layout at A.x { } | ||
contract D is A layout at A.y { } | ||
// ---- | ||
// TypeError 1139: (346-349): The base slot of the storage layout must be a compile-time constant expression. | ||
// TypeError 1139: (380-383): The base slot of the storage layout must be a compile-time constant expression. | ||
// TypeError 1139: (414-417): The base slot of the storage layout must be a compile-time constant expression. |
7 changes: 7 additions & 0 deletions
7
test/libsolidity/syntaxTests/storageLayoutSpecifier/int_constant.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
int constant x = -42; | ||
int constant y = 64; | ||
contract C layout at x {} | ||
contract D layout at y {} | ||
// ---- | ||
// TypeError 6753: (64-65): The base slot of the storage layout evaluates to -42, which is outside the range of type uint256. | ||
// TypeError 1481: (90-91): The base slot expression type int256 is not convertible to type uint256. |
2 changes: 1 addition & 1 deletion
2
test/libsolidity/syntaxTests/storageLayoutSpecifier/layout_specification_bytes.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
bytes32 constant b = "bytes"; | ||
contract A layout at b[1] {} | ||
// ---- | ||
// TypeError 6396: (51-55): The base slot of the storage layout must evaluate to a rational number. | ||
// TypeError 1763: (51-55): The base slot of the storage layout must evaluate to an integer. The type of the supplied expression is bytes1. |
1 change: 0 additions & 1 deletion
1
...lidity/syntaxTests/storageLayoutSpecifier/layout_specification_constant_in_expression.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
uint constant X = 42; | ||
contract C layout at 0xffff * (50 - X) { } | ||
// ---- | ||
// TypeError 6396: (43-60): The base slot of the storage layout must evaluate to a rational number. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
test/libsolidity/syntaxTests/storageLayoutSpecifier/layout_specified_by_other_contract.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
contract A {} | ||
contract C layout at A(address(0x1234)) {} | ||
// ---- | ||
// TypeError 6396: (35-53): The base slot of the storage layout must evaluate to a rational number. | ||
// TypeError 1763: (35-53): The base slot of the storage layout must evaluate to an integer. |
2 changes: 1 addition & 1 deletion
2
test/libsolidity/syntaxTests/storageLayoutSpecifier/layout_specified_by_type.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
contract A layout at uint {} | ||
// ---- | ||
// TypeError 6396: (21-25): The base slot of the storage layout must evaluate to a rational number. | ||
// TypeError 1763: (21-25): The base slot of the storage layout must evaluate to an integer. |
2 changes: 1 addition & 1 deletion
2
test/libsolidity/syntaxTests/storageLayoutSpecifier/literal_cast.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
contract at layout at uint(42) { } | ||
// ---- | ||
// TypeError 6396: (22-30): The base slot of the storage layout must evaluate to a rational number. | ||
// TypeError 1505: (22-30): The base slot expression contains elements that are not yet supported by the internal constant evaluator and therefore cannot be evaluated at compilation time. |
4 changes: 2 additions & 2 deletions
4
test/libsolidity/syntaxTests/storageLayoutSpecifier/precompiles.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
contract A layout at addmod(1, 2, 3) {} | ||
contract B layout at mulmod(3, 2, 1) {} | ||
// ---- | ||
// TypeError 6396: (21-36): The base slot of the storage layout must evaluate to a rational number. | ||
// TypeError 6396: (61-76): The base slot of the storage layout must evaluate to a rational number. | ||
// TypeError 1505: (21-36): The base slot expression contains elements that are not yet supported by the internal constant evaluator and therefore cannot be evaluated at compilation time. | ||
// TypeError 1505: (61-76): The base slot expression contains elements that are not yet supported by the internal constant evaluator and therefore cannot be evaluated at compilation time. |
1 change: 1 addition & 0 deletions
1
.../rational_number_zero_fractional_part.sol → ...tional_number_without_fractional_part.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
contract A layout at 42.0 {} | ||
contract B layout at 2.5e10 {} | ||
contract C layout at 12/3 {} | ||
// ---- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
contract C layout at "MyLayoutBase" {} | ||
// ---- | ||
// TypeError 6396: (21-35): The base slot of the storage layout must evaluate to a rational number. | ||
// TypeError 1763: (21-35): The base slot of the storage layout must evaluate to an integer. |
4 changes: 2 additions & 2 deletions
4
test/libsolidity/syntaxTests/storageLayoutSpecifier/ternary_operator.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
contract A layout at true ? 42 : 94 {} | ||
contract B layout at 255 + (true ? 1 : 0) {} | ||
// ---- | ||
// TypeError 6396: (21-35): The base slot of the storage layout must evaluate to a rational number. | ||
// TypeError 6396: (60-80): The base slot of the storage layout must evaluate to a rational number. | ||
// TypeError 1505: (21-35): The base slot expression contains elements that are not yet supported by the internal constant evaluator and therefore cannot be evaluated at compilation time. | ||
// TypeError 1505: (60-80): The base slot expression contains elements that are not yet supported by the internal constant evaluator and therefore cannot be evaluated at compilation time. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
contract C layout at (1, 2, 3) {} | ||
// ---- | ||
// TypeError 6396: (21-30): The base slot of the storage layout must evaluate to a rational number. | ||
// TypeError 1763: (21-30): The base slot of the storage layout must evaluate to an integer. |
2 changes: 1 addition & 1 deletion
2
test/libsolidity/syntaxTests/storageLayoutSpecifier/type_uint_max.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
contract at layout at type(uint).max { } | ||
// ---- | ||
// TypeError 6396: (22-36): The base slot of the storage layout must evaluate to a rational number. | ||
// TypeError 1505: (22-36): The base slot expression contains elements that are not yet supported by the internal constant evaluator and therefore cannot be evaluated at compilation time. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
test/libsolidity/syntaxTests/storageLayoutSpecifier/user_defined_value_type_wrap.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
type MyUint is uint128; | ||
contract C layout at MyUint.wrap(42) {} | ||
// ---- | ||
// TypeError 6396: (45-60): The base slot of the storage layout must evaluate to a rational number. | ||
// TypeError 1763: (45-60): The base slot of the storage layout must evaluate to an integer. |
4 changes: 2 additions & 2 deletions
4
test/libsolidity/syntaxTests/storageLayoutSpecifier/value_from_array_literal.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
contract A layout at [1, 2, 3][0] {} | ||
contract B layout at 255 + [1, 2, 3][0] {} | ||
// ---- | ||
// TypeError 6396: (21-33): The base slot of the storage layout must evaluate to a rational number. | ||
// TypeError 6396: (58-76): The base slot of the storage layout must evaluate to a rational number. | ||
// TypeError 1505: (21-33): The base slot expression contains elements that are not yet supported by the internal constant evaluator and therefore cannot be evaluated at compilation time. | ||
// TypeError 1505: (58-76): The base slot expression contains elements that are not yet supported by the internal constant evaluator and therefore cannot be evaluated at compilation time. |
2 changes: 1 addition & 1 deletion
2
test/libsolidity/syntaxTests/storageLayoutSpecifier/value_from_bytes.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
bytes32 constant b = "Solidity"; | ||
contract C layout at uint8(b[1]) {} | ||
// ---- | ||
// TypeError 6396: (54-65): The base slot of the storage layout must evaluate to a rational number. | ||
// TypeError 1505: (54-65): The base slot expression contains elements that are not yet supported by the internal constant evaluator and therefore cannot be evaluated at compilation time. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.