solidity/test/libsolidity/semanticTests/using/calldata_memory_copy.sol
2022-03-14 12:33:44 +01:00

20 lines
349 B
Solidity

contract C {
function f(uint[] calldata arr) external returns (uint) {
return arr.sum();
}
}
function sum(uint[] memory arr) returns (uint result) {
for(uint i = 0; i < arr.length; i++) {
result += arr[i];
}
}
using {sum} for uint[];
// ====
// compileViaYul: also
// ----
// f(uint256[]): 0x20, 3, 1, 2, 8 -> 11