坚固性函数重载行为



我的合同是这样的,问题是为什么foo(uint256 n)不起作用(没有值返回(。如果合同只是foo(uint256 n),它有效。

contract OverloadContract {
// working
function foo(uint256 n, uint256 m) public pure returns (uint256) {
return n + m;
}
// not working ?
function foo(uint256 n) public pure returns (uint256) {
return n;
}
// working
function foo() public pure returns (uint256) {
return 1;
}
// working
function foo(uint256 i, uint256 n, uint256 m) public pure returns (uint256) {
return i + n + m;
}
}

该错误由以太坊/remix#864修复,并将随Remix 0.7一起提供。

链接: https://github.com/ethereum/remix-ide/issues/1460