mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
27 lines
472 B
Solidity
27 lines
472 B
Solidity
function id(uint x) pure returns (uint) {
|
|
return x;
|
|
}
|
|
|
|
function zero(uint) pure returns (uint) {
|
|
return 0;
|
|
}
|
|
|
|
contract C {
|
|
function f(uint z) pure external returns(uint) {
|
|
return z.id();
|
|
}
|
|
|
|
function g(uint z) pure external returns (uint) {
|
|
return z.zero();
|
|
}
|
|
|
|
using {id, zero} for uint;
|
|
}
|
|
// ====
|
|
// compileViaYul: also
|
|
// ----
|
|
// f(uint256): 10 -> 10
|
|
// g(uint256): 10 -> 0
|
|
// f(uint256): 256 -> 0x0100
|
|
// g(uint256): 256 -> 0
|