0
votes

My contract like this, the question is why foo(uint256 n) not working(no value return). If the contract just hava foo(uint256 n), it works.

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;
}
}
1
Are you testing this in Remix? I can reproduce it there, but when I call the function directly via eth_call (JSON-RPC interface), the function is working properly.user94559
In fact, in Remix, testing against a local ganache instance, I can see the right value coming back in the network tab, so this looks like a bug in the UI layer.user94559
I'd recommend filing an issue: github.com/ethereum/remix-ide.user94559
Yes, I write this in Remix-ide, Thanks @smarx, I'll filling an issueyangbinnnn

1 Answers

0
votes

That Bug is fixed by ethereum/remix#864 and will be shipped with Remix 0.7.

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