2020-01-02 21:28:07 +00:00
|
|
|
interface Parent {
|
|
|
|
function parentFun() external returns (uint256);
|
|
|
|
}
|
|
|
|
|
|
|
|
interface SubA is Parent {
|
|
|
|
function subAFun() external returns (uint256);
|
|
|
|
}
|
|
|
|
|
|
|
|
interface SubB is Parent {
|
|
|
|
function subBFun() external returns (uint256);
|
|
|
|
}
|
|
|
|
|
|
|
|
contract Impl is SubA, SubB {
|
|
|
|
function parentFun() override external returns (uint256) { return 1; }
|
|
|
|
function subAFun() override external returns (uint256) { return 2; }
|
|
|
|
function subBFun() override external returns (uint256) { return 3; }
|
|
|
|
}
|
|
|
|
|
|
|
|
contract C {
|
|
|
|
function convertParent() public returns (uint256) {
|
|
|
|
Parent p = new Impl();
|
|
|
|
return p.parentFun();
|
|
|
|
}
|
|
|
|
|
|
|
|
function convertSubA() public returns (uint256, uint256) {
|
|
|
|
SubA sa = new Impl();
|
|
|
|
return (sa.parentFun(), sa.subAFun());
|
|
|
|
}
|
|
|
|
|
|
|
|
function convertSubB() public returns (uint256, uint256) {
|
|
|
|
SubB sb = new Impl();
|
|
|
|
return (sb.parentFun(), sb.subBFun());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-09 19:59:17 +00:00
|
|
|
// ====
|
|
|
|
// compileViaYul: also
|
2020-01-02 21:28:07 +00:00
|
|
|
// ----
|
|
|
|
// convertParent() -> 1
|
2021-11-04 17:20:10 +00:00
|
|
|
// gas irOptimized: 85524
|
2020-01-02 21:28:07 +00:00
|
|
|
// convertSubA() -> 1, 2
|
2021-11-04 17:20:10 +00:00
|
|
|
// gas irOptimized: 86155
|
2021-10-27 15:26:44 +00:00
|
|
|
// gas legacy: 99047
|
2020-01-02 21:28:07 +00:00
|
|
|
// convertSubB() -> 1, 3
|
2021-11-04 17:20:10 +00:00
|
|
|
// gas irOptimized: 86098
|
2021-10-27 15:26:44 +00:00
|
|
|
// gas legacy: 98981
|