-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Params Collections - Adjust binding in presence of dynamic arguments #71421
Params Collections - Adjust binding in presence of dynamic arguments #71421
Conversation
Implements changes proposed in dotnet/csharplang#7792.
@RikkiGibson, @333fred, @dotnet/roslyn-compiler Please review |
src/Compilers/CSharp/Portable/Binder/Semantics/OverloadResolution/OverloadResolution.cs
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Binder/Semantics/OverloadResolution/OverloadResolution.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally, this LGTM. We'll need to see what LDM thinks of the single overload static resolution change here though; I personally am a bit concerned by it from a purely backcompat perspective (though I do think it's more consistent behavior overall).
} | ||
|
||
[Fact] | ||
public void DynamicInvocation_OrdinaryMethod_13_DoNotHideByApplicability() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this test have to do with params collections? #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this test have to do with params collections?
The test is not specific to "Params Collections", but the PR also has much broader impact. The implemented design goes beyond "Params Collections".
"""; | ||
var comp = CreateCompilation(src, targetFramework: TargetFramework.StandardAndCSharp, options: TestOptions.ReleaseExe); | ||
|
||
comp.VerifyDiagnostics( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not run this one? #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not run this one?
It is not my goal to test dynamic dispatch. The warning is what I wanted to see. BTW, I think runtime binder is going to throw for this scenario.
} | ||
|
||
[Fact] | ||
public void DynamicInvocation_Indexer_13_DoNotHideByApplicability() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question here about what this has to do with params collections. #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question here about what this has to do with params collections.
It is related to the changes I made in OverloadResolution.cs. The changes have broader impact.
// M2(in d, d = 3, in d); | ||
Diagnostic(ErrorCode.ERR_InDynamicMethodArg, "d").WithLocation(23, 28) | ||
); | ||
CompileAndVerify(comp, expectedOutput: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is going to work, I think we should update the comments in the source that explicitly say this doesn't work. #Resolved
|
||
ReportBadDynamicArguments(syntax, args, refKindsArray, diagnostics, queryClause); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example, the helper implements "It is a compile time error if a method invocation is dynamically bound and any of the parameters, including the receiver, has the in modifier." rule from https://github.com/dotnet/csharpstandard/blob/draft-v9/standard/expressions.md#1231-general
@RikkiGibson, @dotnet/roslyn-compiler For the second review |
1 similar comment
@RikkiGibson, @dotnet/roslyn-compiler For the second review |
src/Compilers/CSharp/Test/Semantic/Semantics/SemanticErrorTests.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Test/Semantic/Semantics/SemanticErrorTests.cs
Outdated
Show resolved
Hide resolved
a91ef66
into
dotnet:features/ParamsCollections
Implement changes proposed in dotnet/csharplang#7792.