solidity/test/libsolidity/semanticTests/storage/complex_accessors.sol

20 lines
607 B
Solidity
Raw Normal View History

2019-07-08 14:04:52 +00:00
contract test {
mapping(uint256 => bytes4) public to_string_map;
mapping(uint256 => bool) public to_bool_map;
mapping(uint256 => uint256) public to_uint_map;
mapping(uint256 => mapping(uint256 => uint256)) public to_multiple_map;
2020-06-23 12:14:24 +00:00
constructor() {
2019-07-08 14:04:52 +00:00
to_string_map[42] = "24";
to_bool_map[42] = false;
to_uint_map[42] = 12;
to_multiple_map[42][23] = 31;
}
}
// ====
// compileViaYul: also
2019-07-08 14:04:52 +00:00
// ----
// to_string_map(uint256): 42 -> "24"
// to_bool_map(uint256): 42 -> false
// to_uint_map(uint256): 42 -> 12
// to_multiple_map(uint256,uint256): 42, 23 -> 31