Skip to content

C#: Remove redundant code from DeadStoreOfLocal.ql#22049

Merged
hvitved merged 1 commit into
github:mainfrom
hvitved:csharp/dead-store-cleanup
Jun 25, 2026
Merged

C#: Remove redundant code from DeadStoreOfLocal.ql#22049
hvitved merged 1 commit into
github:mainfrom
hvitved:csharp/dead-store-cleanup

Conversation

@hvitved

@hvitved hvitved commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

The removed code was redundant since we filter away results for all captured variables.

@github-actions github-actions Bot added the C# label Jun 25, 2026
@hvitved hvitved added the no-change-note-required This PR does not need a change note label Jun 25, 2026
@hvitved hvitved marked this pull request as ready for review June 25, 2026 11:33
@hvitved hvitved requested a review from a team as a code owner June 25, 2026 11:33
Copilot AI review requested due to automatic review settings June 25, 2026 11:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 simplifies the C# cs/useless-assignment-to-local query by removing a predicate and helper definitions that are redundant given the query already treats all captured locals as potentially live.

Changes:

  • Deleted the mayEscape logic and related helper predicates/functions from DeadStoreOfLocal.ql.
  • Simplified RelevantDefinition.isMaybeLive() by dropping the redundant mayEscape(v) branch.
Show a summary per file
File Description
csharp/ql/src/Dead Code/DeadStoreOfLocal.ql Removes redundant captured-variable escape logic and simplifies liveness reasoning for reported dead stores.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

@michaelnebel michaelnebel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@hvitved hvitved merged commit b582844 into github:main Jun 25, 2026
25 checks passed
@hvitved hvitved deleted the csharp/dead-store-cleanup branch June 25, 2026 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C# no-change-note-required This PR does not need a change note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants