mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
35 lines
632 B
Solidity
35 lines
632 B
Solidity
==== Source: A ====
|
|
library L {
|
|
function id(uint x) internal pure returns (uint) {
|
|
return x;
|
|
}
|
|
function one_ext(uint) pure external returns(uint) {
|
|
return 1;
|
|
}
|
|
function empty() pure internal {
|
|
}
|
|
|
|
}
|
|
|
|
==== Source: B ====
|
|
contract C {
|
|
using M.L for uint;
|
|
function f(uint x) public pure returns (uint) {
|
|
return x.id();
|
|
}
|
|
function g(uint x) public pure returns (uint) {
|
|
return x.one_ext();
|
|
}
|
|
}
|
|
|
|
import "A" as M;
|
|
|
|
// ====
|
|
// compileViaYul: also
|
|
// ----
|
|
// library: "A":L
|
|
// f(uint256): 5 -> 5
|
|
// f(uint256): 10 -> 10
|
|
// g(uint256): 5 -> 1
|
|
// g(uint256): 10 -> 1
|