-
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
Add missing test for CallerArgumentExpression #57805
Conversation
This test, combined with dotnet/csharplang#5438 to update the spec with the conversion rules, closes out the test plan for CallerArgumentExpression. @dotnet/roslyn-compiler for a very small test-only change. |
", targetFramework: TargetFramework.NetCoreApp); | ||
|
||
comp.VerifyDiagnostics( | ||
// (5,16): error CS8964: The CallerArgumentExpressionAttribute may only be applied to parameters with default values |
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.
[InlineData("out")] | ||
[InlineData("ref")] | ||
[InlineData("in")] | ||
public void CallerArgumentExpression_OnRefParameter(string refType) |
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.
Done with review pass (commit 1) |
@AlekseyTs addressed feedback. In reply to: 971899219 |
Diagnostic(ErrorCode.ERR_BadCallerArgumentExpressionParamWithoutDefaultValue, "CallerArgumentExpression").WithLocation(5, 16), | ||
// (5,47): error CS1741: A ref or out parameter cannot have a default value | ||
// void M(int i, [CallerArgumentExpression("i")] out string s = null) | ||
Diagnostic(ErrorCode.ERR_RefOutDefaultValue, "out").WithLocation(5, 47) |
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.
{ | ||
Console.WriteLine(s); | ||
} | ||
", targetFramework: TargetFramework.NetCoreApp); |
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.
No, it will still compile against Netstandard2.0 APIs, which doesn't have CallerArgumentExpression
.
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.
LGTM (commit 3), assuming CI is passing
…rovements * upstream/main: (310 commits) Read SourceLink info and call service to retrieve source from there (dotnet#57978) Add new parser/lexer to the StackTraceAnalyzer (dotnet#57598) (dotnet#58050) Snap 17.1 P2 (dotnet#58041) Make it possible to analyze the dataflow of `ConstructorInitializerSyntax` and `PrimaryConstructorBaseTypeSyntax` (dotnet#57576) Shorten paths in VS installation (dotnet#57726) Add comments Add new parser/lexer to the StackTraceAnalyzer (dotnet#57598) Fix await completion for expression body lambda Add tests Fix comment Honor option, and also improve formatting with comment Skip TestLargeStringConcatenation (dotnet#58035) Log runtime framework of remote host Mark EqualityContract property accessor as not auto-implemented (dotnet#57917) Fix typo in XML doc for GeneratorExtensions (dotnet#58020) Hold Receiver directly in bound node for implicit indexer access (dotnet#58009) Pass AnalysisKind instead of int Enable nullable reference types for TableDataSource Simplify 'interpolation' data, and move to an easier to consume System.Range approach for it (dotnet#57966) Add missing test for CallerArgumentExpression (dotnet#57805) ...
Closes #52745.