-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't overload function by changing only return types #259
Comments
This is on purpose. For overload resolution, only the parameter types are taken into account, as is customary in many other languages. The reason is that you can easily omit the return values (or their types), but not the parameters. In both of the following examples, resolution is ambiguous.
The main problem, though, is that resolution does not need to terminate after one step and can create ambiguities even if you use the return values:
|
Darn. I feel like this is an extension that will inevitably be required, to fit a contract into two different systems that expect different APIs. I'm sure you could annotate a function in a way that will force expressions to never have an ambiguous type but it sounds like solidity 2.0 feature |
@nmushegian they are not part of the signature |
function stuff() returns (uint) {}
function stuff() returns (uint, bool) {}
These have distinct signatures, but the compiler won't let me create both versions
The text was updated successfully, but these errors were encountered: