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.

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

CopilotAI 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)
SeverityFinding
High severitycsharp/​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.
FileDescription
csharp/​ql/​test/​library-tests/​statements/​Foreach3.qlUpdates statement test type.
csharp/​ql/​test/​library-tests/​statements/​Foreach1.qlUpdates statement test type.
csharp/​ql/​test/​library-tests/​csharp9/​foreach.qlUpdates C# 9 foreach tests.
csharp/​ql/​test/​library-tests/​csharp7/​ForEach.qlUpdates C# 7 foreach tests.
csharp/​ql/​src/​Linq/​MissedWhereOpportunity.qlMigrates LINQ helper type.
csharp/​ql/​src/​Linq/​MissedSelectOpportunity.qlMigrates LINQ helper type.
csharp/​ql/​src/​Linq/​MissedOfTypeOpportunity.qlMigrates LINQ helper type.
csharp/​ql/​src/​Linq/​MissedCastOpportunity.qlMigrates LINQ helper type.
csharp/​ql/​src/​Linq/​MissedAllOpportunity.qlMigrates LINQ helper type.
csharp/​ql/​src/​Linq/​BadMultipleIteration.qlUpdates consuming-access detection.
csharp/​ql/​src/​Likely Bugs/​Statements/​UseBraces.qlUpdates loop-body handling.
csharp/​ql/​src/​Likely Bugs/​Collections/​WriteOnlyContainer.qlUpdates foreach-variable handling.
csharp/​ql/​src/​Language Abuse/​ForeachCapture.qlRenames foreach capture helpers.
csharp/​ql/​src/​Dead Code/​DeadStoreOfLocal.qlUpdates foreach declarations.
csharp/​ql/​src/​API Abuse/​NoDisposeCallOnLocalIDisposable.qlUpdates foreach disposal handling.
csharp/​ql/​lib/​semmle/​code/​csharp/​Stmt.qllRenames the public class and adds an alias.
csharp/​ql/​lib/​semmle/​code/​csharp/​exprs/​Expr.qllUpdates tuple-child traversal.
csharp/​ql/​lib/​semmle/​code/​csharp/​dataflow/​Nullness.qllUpdates nullness modeling.
csharp/​ql/​lib/​semmle/​code/​csharp/​dataflow/​internal/​DataFlowPrivate.qllUpdates data-flow modeling.
csharp/​ql/​lib/​semmle/​code/​csharp/​controlflow/​internal/​ControlFlowGraph.qllUpdates CFG adapter types.
csharp/​ql/​lib/​Linq/​Helpers.qllRenames LINQ classes and adds aliases.
csharp/​ql/​consistency-queries/​SsaConsistency.qlUpdates SSA consistency checks.

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

Comment threadcsharp/ql/lib/semmle/code/csharp/Stmt.qll
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C#no-change-note-requiredThis PR does not need a change note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@aschackmull