Skip to content

Issue919 local functions#920

Merged
manfred-brands merged 4 commits intomasterfrom
Issue919_LocalFunctions
Sep 28, 2025
Merged

Issue919 local functions#920
manfred-brands merged 4 commits intomasterfrom
Issue919_LocalFunctions

Conversation

@manfred-brands
Copy link
Copy Markdown
Member

Fixes #919

Copy link
Copy Markdown
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

Adds support for local functions in NUnit analyzer's field disposal and nullability suppression analyzers. This enhancement allows the analyzers to properly detect field assignments and disposal operations that occur within local functions, ensuring consistent analysis behavior across different code patterns.

  • Added local function support to the dispose fields analyzer for both assignment and disposal tracking
  • Extended nullability suppressor to handle field assignments in local functions
  • Added comprehensive test coverage for local function scenarios

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
DisposeFieldsAndPropertiesInTearDownAnalyzer.cs Added overloads to handle LocalFunctionStatementSyntax for both assignment and disposal tracking
NonNullableFieldOrPropertyIsUninitializedSuppressor.cs Extended type signatures and added local function support for field assignment detection
DisposeFieldsAndPropertiesInTearDownAnalyzerTests.cs Added test cases for local function scenarios and updated variable naming
NonNullableFieldOrPropertyIsUninitializedSuppressorTests.cs Added test case for field assignment in local functions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Copy Markdown
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

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


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Copy Markdown
Member

@mikkelbu mikkelbu left a comment

Choose a reason for hiding this comment

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

Looks great and seems like a natural addition. I only have very minor nitpick, but I'm happy to merge this when you are.

Great work as usual 👍

…opertyIsUninitializedSuppressor.cs

Co-authored-by: Mikkel Nylander Bundgaard <[email protected]>
@manfred-brands manfred-brands merged commit 3ac62aa into master Sep 28, 2025
6 checks passed
@manfred-brands manfred-brands deleted the Issue919_LocalFunctions branch September 28, 2025 08:10
@mikkelbu mikkelbu added this to the Release 4.11 milestone Sep 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NUnit1032/NUnit3002 - local functions not analyzed

3 participants