Repository navigation
Fix converting Omitted/Optional parameters which could result in wrong method overload being called. - #907
Merged
Conversation
Member
Author
|
Idea: maybe the logic "pull every optional argument" could be only executed when the invocation symbol has overloads. Shouldn't be too hard to implement. I will take a look. //edit |
This was referenced Jun 28, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #906
More complicated than I initially thought. The idea of just providing every omitted argument didn't work for all cases. Example:
Input sharplab.io:
Develop sharplab.io
Initial idea sharplab.io
Final (?) solution sharplab.io
The solution works more or less like this:
ExplicitDefaultValue.a) Note that after named arg we can still have omitted args!
b) If the omitted arg is required in C# (ref/out) then do the hoisting.
GetAdditionalRequiredArgswill check what parameters we're still missing to match the invoked symbol.This includes cases where we need to provide
Microsoft.VisualBasic.CompareMethodenum or do the hoisting for (ref/out) arg.The downside of this approach is that we sometimes pull more arguments than it's necessary but I guess it's better than calling wrong method overload.