Adding more syntax and semantic tests.

This commit is contained in:
Djordje Mijovic 2020-12-09 12:20:27 +01:00
parent 21dc6c8356
commit 8b6397e8fb
2 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,25 @@
contract c {
uint48[5][2] data1;
uint120[6][3] data2;
function test() public returns (uint256 x, uint120 y) {
data2[0][0] = 11;
data2[1][0] = 22;
data2[2][0] = 33;
data1[0][0] = 0;
data1[0][1] = 1;
data1[0][2] = 2;
data1[0][3] = 3;
data1[0][4] = 4;
data1[1][0] = 3;
data2 = data1;
assert(data1[0][1] == data2[0][1]);
x = data2.length;
y = data2[0][4];
}
}
// ====
// compileViaYul: also
// ----
// test() -> 3, 4

View File

@ -0,0 +1,13 @@
contract C {
int256[32] data1;
uint256[10] data2;
function f() external {
data1 = data2;
}
function g() external {
data2 = data1;
}
}
// ----
// TypeError 7407: (102-107): Type uint256[10] storage ref is not implicitly convertible to expected type int256[32] storage ref.
// TypeError 7407: (159-164): Type int256[32] storage ref is not implicitly convertible to expected type uint256[10] storage ref.