C#: Prepare for pattern flow. - #22711
Merged
michaelnebel merged 5 commits intoOct 2, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
It changes foundational C# assignable, SSA, and local data-flow semantics that warrant final human validation.
Review effort: Balanced
Findings: None
What changed in this PR
Refactors C# pattern definitions and tuple-pattern flow to distinguish top-level matches from sub-pattern reads.
Changes:
- Adds
TuplePatternExprand limits direct flow to top-level tuple patterns. - Represents nested pattern declarations as
PatternDefinition. - Updates dependent analyses and generated test expectations.
| File | Description |
|---|---|
Tuples.cs |
Normalizes the final line. |
tuples/PrintAst.expected |
Updates tuple-pattern AST expectations. |
DataFlowStep.expected |
Removes unwanted pattern-flow edges. |
csharp8/PrintAst.expected |
Updates tuple-pattern classifications. |
DeadStoreOfLocal.ql |
Retains top-level pattern semantics. |
Expr.qll |
Adds TuplePatternExpr. |
Nullness.qll |
Restricts non-null definitions to top-level patterns. |
DataFlowPrivate.qll |
Refines tuple-pattern flow and read steps. |
Assignable.qll |
Extends pattern definitions to nested declarations. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
michaelnebel
marked this pull request as ready for review
October 1, 2026 07:33
hvitved
approved these changes
Oct 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In this PR we re-factor parts of the C# specific data flow and assignable definition.
It turns out that the existing logic contains some unwanted flow steps.
isexpressionsand switch/casestatements to any sub-tuple pattern. However, there should only be a flow step to the immediate top-level pattern in match - flow to sub patterns should be handled as read steps.PatternDefinitionAssignable definition has been modified to include all sub pattern variable declarations. This will be needed in a subsequent PR.DCA looks good.