Skip to content

JIT: Correct typeof(void).IsPrimitive constant folding - #133967

Merged
EgorBo merged 2 commits into
mainfrom
copilot/fix-constant-folding-issue
Sep 16, 2026
Merged

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

Conversation

Copilot AI commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

The JIT folds typeof(void).IsPrimitive to true, disagreeing with reflection’s false.

  • Importer: Exclude CORINFO_TYPE_VOID from primitive classification while preserving enum handling.
  • Regression coverage: Add typeof(void) to the existing TypeIntrinsics non-primitive assertions.

@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: EgorBo <523221+EgorBo@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix constant-folding of typeof(void).IsPrimitive to return false JIT: Correct typeof(void).IsPrimitive constant folding Sep 15, 2026
Copilot AI requested a review from EgorBo September 15, 2026 17:39
@EgorBo

EgorBo commented Sep 15, 2026

Copy link
Copy Markdown
Member

PTAL @dotnet/jit-contrib

No diffs

@EgorBo
EgorBo requested a review from a team September 15, 2026 19:48
@EgorBo
EgorBo marked this pull request as ready for review September 15, 2026 19:48
Copilot AI lite review requested due to automatic review settings September 15, 2026 19:48
@azure-pipelines

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.

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.

🟢 Approval recommended

The fix and regression coverage address the reported behavior.

Pull request overview

Fixes JIT constant folding so typeof(void).IsPrimitive matches reflection.

Changes:

  • Excludes CORINFO_TYPE_VOID from primitive classification.
  • Adds regression coverage for typeof(void).IsPrimitive.
File summaries
File Description
src/tests/JIT/Intrinsics/TypeIntrinsics.cs Verifies typeof(void).IsPrimitive is false.
src/coreclr/jit/importercalls.cpp Corrects IsPrimitive constant folding.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

@EgorBo
EgorBo enabled auto-merge (squash) September 16, 2026 10:08
@EgorBo

EgorBo commented Sep 16, 2026

Copy link
Copy Markdown
Member

/ba-g MonoTests failure

@EgorBo
EgorBo merged commit 2e8cb61 into main Sep 16, 2026
145 of 147 checks passed
@EgorBo
EgorBo deleted the copilot/fix-constant-folding-issue branch September 16, 2026 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

JIT: (bug) constant-folds typeof(void).IsPrimitive to true

4 participants