Skip to content

Commit 22ae336

Browse files
Update and add tests
1 parent 14fcd5d commit 22ae336

25 files changed

+64
-19
lines changed
Lines changed: 1 addition & 1 deletion
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.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
address constant x = 0xdCad3a6d3569DF655070DEd06cb7A1b2Ccd1D3AF;
2+
contract C layout at x {
3+
4+
}
5+
// ----
6+
// TypeError 6396: (86-87): The base slot of the storage layout must evaluate to a rational number.
Lines changed: 1 addition & 1 deletion
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.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
bool constant x = false;
2+
contract C layout at x {}
3+
// ----
4+
// TypeError 6396: (46-47): The base slot of the storage layout must evaluate to a rational number.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
bytes32 constant x = "ABC";
2+
contract A layout at x {}
3+
contract C layout at x[1] {}
4+
// ----
5+
// TypeError 6396: (49-50): The base slot of the storage layout must evaluate to a rational number.
6+
// TypeError 6396: (75-79): The base slot of the storage layout must evaluate to a rational number.
Lines changed: 1 addition & 1 deletion
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.
Lines changed: 1 addition & 1 deletion
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.

test/libsolidity/syntaxTests/storageLayoutSpecifier/constant_from_base_contract.sol

Lines changed: 1 addition & 1 deletion
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.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
==== Source: A ====
2+
uint constant x = 77;
3+
4+
==== Source: B ====
5+
import "A" as M;
6+
contract C layout at M.x{ }
7+
// ----
8+
// TypeError 1505: (B:38-41): The base slot expression cannot be evaluated during compilation.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
uint constant x = addmod(10, 2, 8);
2+
uint constant y = mulmod(10, 2, 8);
3+
contract C layout at x {}
4+
contract D layout at y {}
5+
// ----
6+
// TypeError 1505: (93-94): The base slot expression cannot be evaluated during compilation.
7+
// TypeError 1505: (119-120): The base slot expression cannot be evaluated during compilation.

0 commit comments

Comments
 (0)