2019-07-08 14:04:52 +00:00
|
|
|
contract test {
|
|
|
|
struct s1 {
|
|
|
|
uint8 x;
|
|
|
|
bool y;
|
|
|
|
}
|
|
|
|
struct s2 {
|
|
|
|
uint32 z;
|
|
|
|
s1 s1data;
|
|
|
|
mapping(uint8 => s2) recursive;
|
|
|
|
}
|
|
|
|
s2 data;
|
|
|
|
function check() public returns (bool ok) {
|
|
|
|
return data.z == 1 && data.s1data.x == 2 &&
|
|
|
|
data.s1data.y == true &&
|
|
|
|
data.recursive[3].recursive[4].z == 5 &&
|
|
|
|
data.recursive[4].recursive[3].z == 6 &&
|
|
|
|
data.recursive[0].s1data.y == false &&
|
|
|
|
data.recursive[4].z == 9;
|
|
|
|
}
|
|
|
|
function set() public {
|
|
|
|
data.z = 1;
|
|
|
|
data.s1data.x = 2;
|
|
|
|
data.s1data.y = true;
|
|
|
|
data.recursive[3].recursive[4].z = 5;
|
|
|
|
data.recursive[4].recursive[3].z = 6;
|
|
|
|
data.recursive[0].s1data.y = false;
|
|
|
|
data.recursive[4].z = 9;
|
|
|
|
}
|
|
|
|
}
|
2020-06-24 16:14:29 +00:00
|
|
|
// ====
|
|
|
|
// compileViaYul: also
|
2019-07-08 14:04:52 +00:00
|
|
|
// ----
|
|
|
|
// check() -> false
|
|
|
|
// set() ->
|
2021-03-19 13:25:19 +00:00
|
|
|
// gas irOptimized: 128533
|
2021-02-12 12:45:15 +00:00
|
|
|
// gas legacy: 129577
|
|
|
|
// gas legacyOptimized: 126964
|
2019-07-08 14:04:52 +00:00
|
|
|
// check() -> true
|