Skip to content
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

don't consider inserted default values in overload disambiguation #24232

Open
wants to merge 3 commits into
base: devel
Choose a base branch
from

Conversation

metagn
Copy link
Collaborator

@metagn metagn commented Oct 4, 2024

refs status-im/nimbus-eth1#2684 (comment)

In overload disambiguation, the entire proc types of the overloads are compared to each other, including the types of parameters that aren't in the original call. To fix this, we make the "specificity" value of inserted params like default values or empty varargs equal to 0, which acts as if they weren't there at all.

To check for inserted params the nfDefaultParam node flag is used, and now empty varargs generated at the end of the match is also marked as nfDefaultParam. We could rename this to nfInsertedParam, but updateDefaultParams had to be changed to a way that happens to work with varargs (checking if the param has a default value, only works because varargs can't have default values), so it's not necessarily that general.

An alternative is to track the insertedness of arguments as an array inside TCandidate, as an enum with values like NotInserted, InsertedDefaultParam, InsertedVarargs, in which case we don't need nfDefaultParam at all. Let me know if this should be done instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant