Add support for static lambdas.#39121
Conversation
|
Tagging @jcouv for eyes. Note: these are draft PRs. |
|
@jcouv this is ready for review. |
| public override bool HasExplicitlyTypedParameterList { get { return false; } } | ||
| public override int ParameterCount { get { return _parameters.Length; } } | ||
| public override bool IsAsync { get { return false; } } | ||
| public override bool IsStatic => false; |
There was a problem hiding this comment.
the lambda created for a query is never a static lambda.
| ImmutableArray<TypeWithAnnotations> types, | ||
| ImmutableArray<string> names, | ||
| bool isAsync, | ||
| bool hasErrors = false) |
There was a problem hiding this comment.
note: there appear to be no callers that provide this value. so it's always false. @jcouv would you like me to remove it entirely?
There was a problem hiding this comment.
There was a problem hiding this comment.
Have removed it. Thanks!
CyrusNajmabadi
left a comment
There was a problem hiding this comment.
Extra blank lines, here and in other tests.
Fixed.
Done! |
|
@cston Feedback responded to! |
A proposal is at dotnet/csharplang#2891. |
|
Opened a PR for speclet: dotnet/csharplang#2899 |
|
FYI, opened test plan issue: #39606 |
| } | ||
|
|
||
| Location getLocationForDiagnostics(SyntaxNode node) | ||
| private static Location GetLocationForDiagnostics(SyntaxNode node) |
There was a problem hiding this comment.
GetLocationForDiagnostics [](start = 32, length = 25)
looks like this is still only used in one method. Could still be a local function
|
It looks like we are just blocked on the file conflicts? |
| namespace Microsoft.CodeAnalysis.CSharp.UnitTests | ||
| { | ||
| [WorkItem(275, "https://github.com/dotnet/csharplang/issues/275")] | ||
| [CompilerTrait(CompilerFeature.AnonymousFunctions)] |
There was a problem hiding this comment.
AnonymousFunctions [](start = 35, length = 18)
consider adding a new feature Consider renaming the new feature to StaticLambdas or something. I was confused by "AnonymousFunctions" ;-)
| Func<int> f = static () => a; | ||
| } | ||
| }"; | ||
| CreateCompilation(source).VerifyDiagnostics( |
There was a problem hiding this comment.
CreateCompilation [](start = 12, length = 17)
explicit language version would be good here (Regular8) so that we don't have to update this test again later
| using Roslyn.Test.Utilities; | ||
| using Xunit; | ||
|
|
||
| namespace Microsoft.CodeAnalysis.CSharp.UnitTests |
There was a problem hiding this comment.
UnitTests [](start = 40, length = 9)
consider adding some tests that execute the code (CompileAndVerify with expectedOutput). Also, please include a test with static async or async static.
jcouv
left a comment
There was a problem hiding this comment.
LGTM Thanks (iteration 37) with some test suggestions. Those could be added to test plan that I just created instead...
I would appreciate that :) |
|
i'll fix the current merge conflicts. |
|
Merged. Thanks! |
|
Yaay. Thanks! |
Adds impl support for dotnet/csharplang#275.
This should be reviewed with whitespace diffs off.
Followup to #39118
Test plan: #39606