solang icon indicating copy to clipboard operation
solang copied to clipboard

compiler message for overloaded functions is not great

Open seanyoung opened this issue 4 years ago • 2 comments

Given this solidity:

contract C {
	function foo(int a) public {}
	function foo(int a, int b) public {}
	function foo(int a, int b, int c) public {}
	function bar() public {
		foo(true);
	}
	function bar2() public {
		foo({a:true});
	}
}

The error message you get is:

/home/sean/git/solang/overloaded.sol:6:3-12: error: cannot find overloaded function which matches signature
Line 6:
	foo(true);
	^^^^^^^^^
/home/sean/git/solang/overloaded.sol:9:3-16: error: cannot find overloaded function which matches signature
Line 9:
	foo({a:true});
	^^^^^^^^^^^^^

That is not useful. The error message should list the overloaded functions which were tried, and the error message for each of them.

The same handling should be used for overloaded constructors when deploying a new contract.

seanyoung avatar Mar 23 '22 12:03 seanyoung

Is this still open ?

devratapuri avatar May 13 '22 15:05 devratapuri

yes, the errors are still like above

seanyoung avatar May 14 '22 07:05 seanyoung