Skip to content

C#: Rename ForeachStmt to ForEachStmt. - #22492

Open
aschackmull wants to merge 2 commits into
github:mainfrom
aschackmull:csharp/foreach-rename
Open

C#: Rename ForeachStmt to ForEachStmt.#22492
aschackmull wants to merge 2 commits into
github:mainfrom
aschackmull:csharp/foreach-rename

Conversation

@aschackmull

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI balanced review requested due to automatic review settings September 2, 2026 10:04
@aschackmull
aschackmull requested a review from a team as a code owner September 2, 2026 10:04
@aschackmull aschackmull added the no-change-note-required This PR does not need a change note label Sep 2, 2026

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.

Copilot review overview

🟡 Changes recommended

The renamed primary QL class invalidates six unchanged PrintAst expected-output files.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced
Findings: 1 High severity

New issues introduced by this change (1)
Severity Finding
High severity csharp/​ql/​lib/​semmle/​code/​csharp/​Stmt.qll — Changing the primary QL class string makes every PrintAst test containing a foreach node emit…
What changed in this PR

Renames the C# QL ForeachStmt API to ForEachStmt while retaining deprecated compatibility aliases.

Changes:

  • Renames the core and LINQ helper classes.
  • Migrates library queries and tests to the new names.
  • Updates control-flow, data-flow, and SSA references.
File Description
csharp/​ql/​test/​library-tests/​statements/​Foreach3.ql Updates statement test type.
csharp/​ql/​test/​library-tests/​statements/​Foreach1.ql Updates statement test type.
csharp/​ql/​test/​library-tests/​csharp9/​foreach.ql Updates C# 9 foreach tests.
csharp/​ql/​test/​library-tests/​csharp7/​ForEach.ql Updates C# 7 foreach tests.
csharp/​ql/​src/​Linq/​MissedWhereOpportunity.ql Migrates LINQ helper type.
csharp/​ql/​src/​Linq/​MissedSelectOpportunity.ql Migrates LINQ helper type.
csharp/​ql/​src/​Linq/​MissedOfTypeOpportunity.ql Migrates LINQ helper type.
csharp/​ql/​src/​Linq/​MissedCastOpportunity.ql Migrates LINQ helper type.
csharp/​ql/​src/​Linq/​MissedAllOpportunity.ql Migrates LINQ helper type.
csharp/​ql/​src/​Linq/​BadMultipleIteration.ql Updates consuming-access detection.
csharp/​ql/​src/​Likely Bugs/​Statements/​UseBraces.ql Updates loop-body handling.
csharp/​ql/​src/​Likely Bugs/​Collections/​WriteOnlyContainer.ql Updates foreach-variable handling.
csharp/​ql/​src/​Language Abuse/​ForeachCapture.ql Renames foreach capture helpers.
csharp/​ql/​src/​Dead Code/​DeadStoreOfLocal.ql Updates foreach declarations.
csharp/​ql/​src/​API Abuse/​NoDisposeCallOnLocalIDisposable.ql Updates foreach disposal handling.
csharp/​ql/​lib/​semmle/​code/​csharp/​Stmt.qll Renames the public class and adds an alias.
csharp/​ql/​lib/​semmle/​code/​csharp/​exprs/​Expr.qll Updates tuple-child traversal.
csharp/​ql/​lib/​semmle/​code/​csharp/​dataflow/​Nullness.qll Updates nullness modeling.
csharp/​ql/​lib/​semmle/​code/​csharp/​dataflow/​internal/​DataFlowPrivate.qll Updates data-flow modeling.
csharp/​ql/​lib/​semmle/​code/​csharp/​controlflow/​internal/​ControlFlowGraph.qll Updates CFG adapter types.
csharp/​ql/​lib/​Linq/​Helpers.qll Renames LINQ classes and adds aliases.
csharp/​ql/​consistency-queries/​SsaConsistency.ql Updates SSA consistency checks.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread csharp/ql/lib/semmle/code/csharp/Stmt.qll
@github-actions github-actions Bot added the C# label Sep 2, 2026
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.

2 participants