solidity/test/libsolidity/semanticTests/libraries/internal_library_function.sol

24 lines
533 B
Solidity
Raw Normal View History

// tests that internal library functions can be called from outside
// and retain the same memory context (i.e. are pulled into the caller's code)
// This has to work without linking, because everything will be inlined.
library L {
function f(uint256[] memory _data) internal {
_data[3] = 2;
}
}
contract C {
function f() public returns (uint256) {
uint256[] memory x = new uint256[](7);
x[3] = 8;
L.f(x);
return x[3];
}
}
2020-04-23 13:59:42 +00:00
// ====
// compileViaYul: also
// ----
// f() -> 2