Open
Description
#13139 attempted to add some warnings about easy-to-miss dangling reference cases.
We could go beyond that and also warn about cases like this:
contract C {
uint[] x;
uint[] y;
function g() internal returns (uint[] storage) {
x.pop();
return y;
}
function f() public {
(x[x.length - 1], g()[1]) = (1, 2);
}
}
(which, roughly, we got reported as a bug bounty report)
In general we could warn about using most kinds of complex expressions on left-hand-sides of tuple assignments, especially about function calls.
We should also check if we can construct problematic cases in non-tuple assignments.