solidity/test/libsolidity/semanticTests/scoping/private_function_vs_overloading.sol
Enrique Jorge 1276c43ad8 Fix inheritedFunctions returns private functions
OverrideChecker treated private functions as inheritable. Hence, a child
contract function could not be assigned the function name of a parent
contract private function.
2022-08-16 16:19:32 +01:00

18 lines
667 B
Solidity

contract A {
function foo() private pure returns (uint256) { return 1; }
function foo(uint256 value) private pure returns (uint256) { return 2; }
function test1() public pure returns (uint256) { return foo(); }
function test2() public pure returns (uint256) { return foo(0); }
}
contract B is A {
function foo() private pure returns (uint256) { return 3; }
function foo(uint256 value) private pure returns (uint256) { return 4; }
function test3() public pure returns (uint256) { return foo(); }
function test4() public pure returns (uint256) { return foo(0); }
}
// ----
// test1() -> 1
// test2() -> 2
// test3() -> 3
// test4() -> 4