solidity/test/libsolidity/smtCheckerTests/types/array_static_mapping_aliasing_2.sol
2020-03-11 16:29:07 +01:00

31 lines
986 B
Solidity

pragma experimental SMTChecker;
contract C
{
mapping (uint => uint) singleMap;
mapping (uint => uint)[2] severalMaps;
mapping (uint => uint8)[2] severalMaps8;
mapping (uint => uint)[2][2] severalMaps3d;
function f(mapping (uint => uint) storage map) internal {
map[0] = 42;
severalMaps[0][0] = 42;
severalMaps8[0][0] = 42;
severalMaps3d[0][0][0] = 42;
singleMap[0] = 2;
// Should not fail since singleMap == severalMaps[0] is not possible.
assert(severalMaps[0][0] == 42);
// Should not fail since knowledge is erased only for mapping (uint => uint).
assert(severalMaps8[0][0] == 42);
// Should not fail since singleMap == severalMaps3d[0][0] is not possible.
assert(severalMaps3d[0][0][0] == 42);
// Should fail since singleMap == map is possible.
assert(map[0] == 42);
}
function g(uint x) public {
f(severalMaps3d[x][0]);
}
}
// ----
// Warning: (781-801): Assertion violation happens here
// Warning: (781-801): Assertion violation happens here