Skip to content

C# 14: [TEST ONLY] Simple lambda parameters with modifiers.#21285

Open
michaelnebel wants to merge 3 commits intogithub:mainfrom
michaelnebel:csharp14/implicittypedlambdaparametermodifiers
Open

C# 14: [TEST ONLY] Simple lambda parameters with modifiers.#21285
michaelnebel wants to merge 3 commits intogithub:mainfrom
michaelnebel:csharp14/implicittypedlambdaparametermodifiers

Conversation

@michaelnebel
Copy link
Contributor

@michaelnebel michaelnebel commented Feb 6, 2026

In this PR we add tests for modifiers for implicitly typed lambda parameters. Prior to C# 14, it was only possible to use modifiers for explicitly typed lambda parameters. The feature is described here.
It turns out that the extractor and QL library supports this out-of-the-box.

@github-actions github-actions bot added the C# label Feb 6, 2026
@michaelnebel michaelnebel marked this pull request as ready for review February 6, 2026 13:55
@michaelnebel michaelnebel requested a review from a team as a code owner February 6, 2026 13:56
Copilot AI review requested due to automatic review settings February 6, 2026 13:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive test coverage for C# 14's new feature that allows modifiers on implicitly typed lambda parameters. Previously, modifiers could only be used with explicitly typed lambda parameters, but C# 14 extends this capability to implicitly typed parameters as well. The PR confirms that the CodeQL extractor and QL library support this feature without requiring any code changes.

Changes:

  • Added new test file LambdaParameterModifiers.cs with test cases for both explicitly and implicitly typed lambda parameters with various modifiers (ref, out, in, ref readonly, scoped ref, params)
  • Updated ParameterModifiers.ql to include lambda parameters from the new test file
  • Regenerated ParameterModifiers.expected with expected results for the new test cases

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
csharp/ql/test/library-tests/parameters/LambdaParameterModifiers.cs New test file containing 11 lambda expressions demonstrating both explicitly and implicitly typed lambda parameters with all supported modifiers
csharp/ql/test/library-tests/parameters/ParameterModifiers.ql Extended TestParameter class to include lambda parameters from the new test file
csharp/ql/test/library-tests/parameters/ParameterModifiers.expected Regenerated expected results file containing entries for the 11 new lambda parameters with their respective modifiers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant