Merge pull request #9184 from ethereum/fixUsingForStorage

Fix using for with explicit reference types.
This commit is contained in:
chriseth
2020-06-11 14:00:28 +02:00
committed by GitHub
3 changed files with 38 additions and 4 deletions
@@ -0,0 +1,25 @@
struct Struct { uint x; }
library L {
function f(Struct storage _x) internal view returns (uint256) {
return _x.x;
}
}
contract C {
using L for Struct;
Struct s;
function h(Struct storage _s) internal view returns (uint) {
// _s is pointer
return _s.f();
}
function g() public returns (uint, uint) {
s.x = 7;
// s is reference
return (s.f(), h(s));
}
}
// ----
// g() -> 7, 7