-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Additional tests for lambda attributes, explicit return type, and inferred delegate type #59634
Conversation
@@ -399,6 +399,33 @@ public void TestNormalizeStatement1() | |||
TestNormalizeStatement("Func<string, int> f = blah;", "Func<string, int> f = blah;"); | |||
} | |||
|
|||
[Theory] | |||
[InlineData("[return:A]void Local([B]object o){}", "[return: A]\r\nvoid Local([B] object o)\r\n{\r\n}")] |
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.
nit: Consider making the input worse (literally the opposite for every position where possible on the attributes):
[InlineData("[return:A]void Local([B]object o){}", "[return: A]\r\nvoid Local([B] object o)\r\n{\r\n}")] | |
[InlineData("[ return:A ]void Local( [ B ]object o){}", "[return: A]\r\nvoid Local([B] object o)\r\n{\r\n}")] | |
``` #Closed |
UsingTree(source, TestOptions.Regular9); | ||
verify(); | ||
|
||
UsingTree(source, TestOptions.RegularNext); |
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.
Seems like this should be Regular10 (we only need to use RegularNext when we mean Regular11 which doesn't exist yet) #Resolved
UsingExpression(source, TestOptions.Regular9); | ||
verify(); | ||
|
||
UsingExpression(source, TestOptions.RegularNext); |
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.
Ditto #Closed
|
||
var symbolInfo = model.GetSymbolInfo(returnTypeSyntax); | ||
Assert.Equal(expectedType, symbolInfo.Symbol); | ||
} |
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.
Did you find the stress test that has deeply nested lambdas? We could add a variant where the return type removes the "stress". #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.
Added OverloadResolutionPerfTests.NestedLambdas_WithParameterAndReturnTypes()
.
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 Thanks (iteration 2)
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 Thanks (iteration 5)
Add various tests identified in test plan #52192 ...
Attributes
Parsing
Semantics
LambdaTests.LambdaAttributes_AttributeSemanticModel()
)Explicit return type
Syntax
async MyMethod() => null;
on the top level parses as a local function statement with a return type ofasync
Semantics
return
statement types and declared return typeOverloadResolutionPerfTests.NestedLambdas_WithParameterAndReturnTypes()
)LambdaTests.LambdaReturnType_SemanticModel()
)LambdaTests.LambdaReturnType_SemanticModel()
)Inferred (natural) delegate type
Semantics
var
_ = () => {};
(not really useful, but is this allowed?)System.Delegate
typeGetTypeInfo()
should return the inferred delegate type for method groups #52874)GetSymbolInfo()
should return the resolved method from a method group with inferred delegate type #52870)