Support modifiers with simple lambda parameters.#75400
Merged
CyrusNajmabadi merged 126 commits intodotnet:mainfrom Jan 16, 2025
Merged
Support modifiers with simple lambda parameters.#75400CyrusNajmabadi merged 126 commits intodotnet:mainfrom
CyrusNajmabadi merged 126 commits intodotnet:mainfrom
Conversation
CyrusNajmabadi
commented
Oct 5, 2024
| var isAnonymousMethod = syntax.IsKind(SyntaxKind.AnonymousMethodExpression); | ||
| if (p.Default != null) | ||
| { | ||
| if (firstDefault == -1) |
Contributor
Author
There was a problem hiding this comment.
this logic moved from teh caller. no need for it to do a secondary pass to report errors when it can just do that here.
CyrusNajmabadi
commented
Oct 5, 2024
|
|
||
| var lambda = AnalyzeAnonymousFunction(syntax, diagnostics); | ||
| var data = lambda.Data; | ||
| if (data.HasExplicitlyTypedParameterList) |
Contributor
Author
There was a problem hiding this comment.
this logic moved into AnalyzeAnonymousFunction. In particular, we want check parameters unilaterally even if there are types or no types (since we want to check modifier usage in the latter case). so the HasExplicitlyTypedParameterList had to go.
CyrusNajmabadi
commented
Oct 5, 2024
| if (lambdaParameterType.IsErrorType()) | ||
| { | ||
| continue; | ||
| } |
Contributor
Author
There was a problem hiding this comment.
this waas already checked above on line 2107. no need to check again.
89e3513 to
a5ac0b2
Compare
cston
reviewed
Jan 15, 2025
src/Compilers/CSharp/Test/Semantic/Semantics/SimpleLambdaParametersWithModifiersTests.cs
Outdated
Show resolved
Hide resolved
cston
reviewed
Jan 15, 2025
| Assert.Equal(MethodKind.LambdaMethod, symbol.MethodKind); | ||
| Assert.Equal(RefKind.RefReadOnlyParameter, symbol.Parameters.Single().RefKind); | ||
| Assert.Equal(SpecialType.System_Int32, symbol.Parameters.Single().Type.SpecialType); | ||
| } |
Contributor
cston
reviewed
Jan 15, 2025
| <Compile Include="$(MSBuildThisFileDirectory)RemoveUnusedMembers\CSharpRemoveUnusedMembersDiagnosticAnalyzer.cs" /> | ||
| <Compile Include="$(MSBuildThisFileDirectory)RemoveUnusedParametersAndValues\CSharpRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs" /> | ||
| <Compile Include="$(MSBuildThisFileDirectory)UseCollectionInitializer\CSharpUseCollectionInitializerDiagnosticAnalyzer.cs" /> | ||
| <Compile Include="$(MSBuildThisFileDirectory)UseImplicitlyTypedLambdaExpression\UseImplicitlyTypedLambdaExpressionDiagnosticAnalyzer.cs" /> |
Contributor
Contributor
Author
There was a problem hiding this comment.
no. this was for anotehr branch. removing.
CyrusNajmabadi
commented
Jan 15, 2025
cston
approved these changes
Jan 15, 2025
Open
3 tasks
333fred
added a commit
to 333fred/roslyn
that referenced
this pull request
Jan 16, 2025
* upstream/main: (172 commits) Move impl of ILspWorkpace to EditorTestWorkspace/LspTestWorkspace (dotnet#76753) Field-backed properties: report diagnostic for variable named field declared in accessor (dotnet#76671) Add more tests Update 'use nameof instead of typeof' to support generic types Update dependencies from https://github.com/dotnet/arcade build 20250115.2 Add docs invert Update src/Analyzers/CSharp/Tests/CSharpAnalyzers.UnitTests.projitems Update options Fixup tests fixup options Update tests Add test Fix trivia Handle params Support modifiers with simple lambda parameters. (dotnet#75400) Handle params Use helper Add fixes Flesh out ...
This was referenced Jan 22, 2025
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.
Implementation of https://github.com/dotnet/csharplang/blob/main/proposals/csharp-14.0/simple-lambda-parameters-with-modifiers.md.
This is in the any-time bucket here: dotnet/csharplang#338