Skip to content

Commit 15696d1

Browse files
Update and add tests
1 parent 9620f4f commit 15696d1

17 files changed

+22
-19
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
contract C layout at abi.decode(abi.encode(42), (uint)) {}
22
// ----
3-
// TypeError 6396: (21-55): The base slot of the storage layout must evaluate to a rational number.
3+
// TypeError 1505: (21-55): The base slot expression cannot be evaluated during compilation.
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
contract C layout at ~uint(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) {}
22
// ----
3-
// TypeError 6396: (21-94): The base slot of the storage layout must evaluate to a rational number.
3+
// TypeError 1505: (21-94): The base slot expression cannot be evaluated during compilation.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
uint constant N = 100;
22
contract C layout at N / ~N {}
33
// ----
4-
// TypeError 6396: (44-50): The base slot of the storage layout must evaluate to a rational number.
4+
// TypeError 3667: (48-50): Arithmetic error when computing constant value.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
uint constant N = 100;
22
contract C layout at N / 0 {}
33
// ----
4-
// TypeError 6396: (44-49): The base slot of the storage layout must evaluate to a rational number.
4+
// TypeError 1505: (44-49): The base slot expression cannot be evaluated during compilation.

Diff for: test/libsolidity/syntaxTests/storageLayoutSpecifier/constant_from_base_contract.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ contract A {
44

55
contract C is A layout at A.x { }
66
// ----
7-
// TypeError 6396: (68-71): The base slot of the storage layout must evaluate to a rational number.
7+
// TypeError 1505: (68-71): The base slot expression cannot be evaluated during compilation.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
uint constant x = uint(42);
2+
contract C layout at x {}
3+
// ----
4+
// TypeError 1505: (49-50): The base slot expression cannot be evaluated during compilation.

Diff for: test/libsolidity/syntaxTests/storageLayoutSpecifier/function_selector.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ contract A {
33
}
44
contract C is A layout at uint32(this.f.selector) {}
55
// ----
6-
// TypeError 6396: (68-91): The base slot of the storage layout must evaluate to a rational number.
6+
// TypeError 1505: (68-91): The base slot expression cannot be evaluated during compilation.
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
contract at layout at uint40(bytes5(hex"0011223344")) { }
22
// ----
3-
// TypeError 6396: (22-53): The base slot of the storage layout must evaluate to a rational number.
3+
// TypeError 1505: (22-53): The base slot expression cannot be evaluated during compilation.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
uint constant X = 42;
22
contract C layout at 0xffff * (50 - X) { }
33
// ----
4-
// TypeError 6396: (43-60): The base slot of the storage layout must evaluate to a rational number.

Diff for: test/libsolidity/syntaxTests/storageLayoutSpecifier/layout_specified_by_interface_id.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ interface I {}
22

33
contract C layout at uint(bytes32(type(I).interfaceId)) { }
44
// ----
5-
// TypeError 6396: (37-71): The base slot of the storage layout must evaluate to a rational number.
5+
// TypeError 1505: (37-71): The base slot expression cannot be evaluated during compilation.
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
contract at layout at uint(42) { }
22
// ----
3-
// TypeError 6396: (22-30): The base slot of the storage layout must evaluate to a rational number.
3+
// TypeError 1505: (22-30): The base slot expression cannot be evaluated during compilation.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
contract A layout at addmod(1, 2, 3) {}
22
contract B layout at mulmod(3, 2, 1) {}
33
// ----
4-
// TypeError 6396: (21-36): The base slot of the storage layout must evaluate to a rational number.
5-
// TypeError 6396: (61-76): The base slot of the storage layout must evaluate to a rational number.
4+
// TypeError 1505: (21-36): The base slot expression cannot be evaluated during compilation.
5+
// TypeError 1505: (61-76): The base slot expression cannot be evaluated during compilation.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
contract A layout at true ? 42 : 94 {}
22
contract B layout at 255 + (true ? 1 : 0) {}
33
// ----
4-
// TypeError 6396: (21-35): The base slot of the storage layout must evaluate to a rational number.
5-
// TypeError 6396: (60-80): The base slot of the storage layout must evaluate to a rational number.
4+
// TypeError 1505: (21-35): The base slot expression cannot be evaluated during compilation.
5+
// TypeError 1505: (60-80): The base slot expression cannot be evaluated during compilation.
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
contract at layout at type(uint).max { }
22
// ----
3-
// TypeError 6396: (22-36): The base slot of the storage layout must evaluate to a rational number.
3+
// TypeError 1505: (22-36): The base slot expression cannot be evaluated during compilation.

Diff for: test/libsolidity/syntaxTests/storageLayoutSpecifier/user_defined_value_type_unwrap.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ type MyUint is uint128;
22
MyUint constant x = MyUint.wrap(42);
33
contract C layout at MyUint.unwrap(x) {}
44
// ----
5-
// TypeError 6396: (82-98): The base slot of the storage layout must evaluate to a rational number.
5+
// TypeError 1505: (82-98): The base slot expression cannot be evaluated during compilation.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
contract A layout at [1, 2, 3][0] {}
22
contract B layout at 255 + [1, 2, 3][0] {}
33
// ----
4-
// TypeError 6396: (21-33): The base slot of the storage layout must evaluate to a rational number.
5-
// TypeError 6396: (58-76): The base slot of the storage layout must evaluate to a rational number.
4+
// TypeError 1505: (21-33): The base slot expression cannot be evaluated during compilation.
5+
// TypeError 1505: (58-76): The base slot expression cannot be evaluated during compilation.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
bytes32 constant b = "Solidity";
22
contract C layout at uint8(b[1]) {}
33
// ----
4-
// TypeError 6396: (54-65): The base slot of the storage layout must evaluate to a rational number.
4+
// TypeError 1505: (54-65): The base slot expression cannot be evaluated during compilation.

0 commit comments

Comments
 (0)