Skip to content

Fix Enum.Equals folding for shared-generic nested enums - #134898

Merged
EgorBo merged 2 commits into
mainfrom
copilot/fix-enum-equals-folding-issue
Oct 1, 2026
Merged

EgorBo merged 2 commits into
mainfrom
copilot/fix-enum-equals-folding-issue

Conversation

Copilot AI commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Enum.Equals can incorrectly equate C<string>.E and C<object>.E because their canonical handles match despite distinct runtime types.

  • JIT: Reject shared-instance types before folding to a payload comparison, matching the Enum.HasFlag guard.
  • Regression coverage: Add parameterized cases for equal and unequal payloads across matching and differing shared/non-shared enum types.

@azure-pipelines

azure-pipelines Bot commented Sep 29, 2026 •

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

@EgorBo EgorBo added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Sep 29, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Co-authored-by: EgorBo <523221+EgorBo@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Enum.Equals folding for different shared-generic nested enum types Fix Enum.Equals folding for shared-generic nested enums Sep 29, 2026
Copilot AI requested a review from EgorBo September 29, 2026 23:27
@EgorBo
EgorBo marked this pull request as ready for review October 1, 2026 13:14
@EgorBo

EgorBo commented Oct 1, 2026

Copy link
Copy Markdown
Member

PTAL @jakobbotsch @dotnet/jit-contrib no diffs

@EgorBo

EgorBo commented Oct 1, 2026

Copy link
Copy Markdown
Member

/ba-g #135031

@EgorBo
EgorBo enabled auto-merge (squash) October 1, 2026 18:22
@EgorBo
EgorBo merged commit b74dfca into main Oct 1, 2026
139 of 141 checks passed
@EgorBo
EgorBo deleted the copilot/fix-enum-equals-folding-issue branch October 1, 2026 18:22
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JIT: (bug) Enum.Equals folding returns true for different shared-generic nested enum types

3 participants