Skip to content

Fix IL2080 for conditional tuple deconstruction - #133971

Draft
jtschuster with Copilot wants to merge 2 commits into
mainfrom
copilot/il2080-from-deconstruction-assignment
Draft

jtschuster with Copilot wants to merge 2 commits into
mainfrom
copilot/il2080-from-deconstruction-assignment

Conversation

Copilot AI commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Conditional tuple deconstruction lost element-level dataflow across Roslyn flow captures, causing known Type values to be modeled as unannotated ValueTuple.ItemN fields and emit false IL2080 warnings.

Changes

  • Track captured tuple elements by capture ID and nested element path.
  • Merge branch values through the existing local-state lattice.
  • Apply captured values only to compiler-distributed conditional deconstruction; materialized tuples and switch expressions retain field-based analysis.
  • Preserve diagnostics for genuine annotation mismatches.
(var methodName, var type) = condition
    ? ("First", typeof(FirstType))
    : ("Second", typeof(SecondType));

_ = type.GetMethod(methodName); // No false IL2080

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
16 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

Co-authored-by: jtschuster <36744439+jtschuster@users.noreply.github.com>
@dotnet-policy-service dotnet-policy-service Bot added the linkable-framework Issues associated with delivering a linker friendly framework label Sep 15, 2026
Copilot AI changed the title [WIP] Fix IL2080 issue from deconstruction assignment using ValueTuple Fix IL2080 for conditional tuple deconstruction Sep 15, 2026
Copilot AI requested a review from jtschuster September 15, 2026 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Infrastructure linkable-framework Issues associated with delivering a linker friendly framework

Projects

Status: No status
Status: No status

Development

Successfully merging this pull request may close these issues.

IL2080 from deconstruction assignment "using" ValueTuple

2 participants