Skip to content

Commit 094d4e7

Browse files
fixup! Add and update tests
1 parent 74d4cff commit 094d4e7

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

test/libsolidity/syntaxTests/constantEvaluator/member_access.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ contract A {
44
contract C is A {
55
uint constant CONST = 2 + A.INHERITED;
66
uint[CONST] array;
7+
uint[1 + A.INHERITED + 2] array2;
78
}
89
// ----
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
==== Source: A.sol ====
2+
uint constant CONST = 2;
3+
==== Source: B.sol ====
4+
import "A.sol" as M;
5+
contract C {
6+
uint[M.CONST] array1;
7+
}
8+
// ----
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
==== Source: A.sol ====
2+
contract A {
3+
uint constant CONST = 2;
4+
}
5+
==== Source: B.sol ====
6+
import "A.sol" as M;
7+
contract C is M.A {
8+
uint[M.A.CONST] array;
9+
}
10+
// ----
11+
// TypeError 5462: (B.sol:50-59): Invalid array length, expected integer literal or constant expression.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
contract A {
2+
uint notConst = 1;
3+
}
4+
contract C is A {
5+
uint[A.notConst] array;
6+
}
7+
// ----
8+
// TypeError 5462: (65-75): Invalid array length, expected integer literal or constant expression.

0 commit comments

Comments
 (0)