Remove primitive value type concept and normalize enum/primitive category flags#127894
Draft
Remove primitive value type concept and normalize enum/primitive category flags#127894
Conversation
…gory to enum Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/5e928e4d-026c-49f8-a093-001b6bf1d69c Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/5e928e4d-026c-49f8-a093-001b6bf1d69c Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
jkotas
reviewed
May 7, 2026
| // Enums have Category_Enum in their MethodTable flags and their | ||
| // InternalCorElementType is a primitive type (I1, U1, I2, U2, I4, U4, I8, U8), | ||
| // not ValueType. Regular primitive value types (IntPtr/UIntPtr) have Category_TruePrimitive. | ||
| // not ValueType. IntPtr/UIntPtr continue to use Category_TruePrimitive. |
Member
There was a problem hiding this comment.
Suggested change
| // not ValueType. IntPtr/UIntPtr continue to use Category_TruePrimitive. | |
| // not ValueType. |
Contributor
Author
There was a problem hiding this comment.
Updated in fbca1de: this comment now reads // not ValueType. as suggested.
| // Enums have Category_Enum in their MethodTable flags and their | ||
| // InternalCorElementType is a primitive type (I1, U1, I2, U2, I4, U4, I8, U8), | ||
| // not ValueType. Regular primitive value types (IntPtr/UIntPtr) have Category_TruePrimitive. | ||
| // not ValueType. IntPtr/UIntPtr continue to use Category_TruePrimitive. |
Member
There was a problem hiding this comment.
Suggested change
| // not ValueType. IntPtr/UIntPtr continue to use Category_TruePrimitive. | |
| // not ValueType. |
Contributor
Author
There was a problem hiding this comment.
Updated in fbca1de: this comment now reads // not ValueType. as suggested.
Comment on lines
853
to
854
| private const uint enum_flag_Category_Enum = 0x00060000; // sub-category of ValueType, Enum | ||
| private const uint enum_flag_Category_TruePrimitive = 0x00070000; // sub-category of ValueType, Primitive (ELEMENT_TYPE_I, etc.) |
Member
There was a problem hiding this comment.
Suggested change
| private const uint enum_flag_Category_Enum = 0x00060000; // sub-category of ValueType, Enum | |
| private const uint enum_flag_Category_TruePrimitive = 0x00070000; // sub-category of ValueType, Primitive (ELEMENT_TYPE_I, etc.) | |
| private const uint enum_flag_Category_Primitive = 0x00060000; // sub-category of ValueType, Primitive (ELEMENT_TYPE_I, etc.) | |
| private const uint enum_flag_Category_Enum = 0x00070000; // sub-category of ValueType, Enum |
Let's swap these values and rename enum_flag_Category_TruePrimitive to just enum_flag_Category_Primitive so that things make more sense
Contributor
Author
Contributor
|
Tagging subscribers to this area: @agocke |
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/a5ef9c79-9897-4019-af57-7543f1af7c54 Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/a5ef9c79-9897-4019-af57-7543f1af7c54 Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/a5ef9c79-9897-4019-af57-7543f1af7c54 Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Copilot
AI
changed the title
Delete primitive value type category concept from runtime
Remove primitive value type concept and normalize enum/primitive category flags
May 7, 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.
Note
This PR description was generated with AI assistance.
Summary
GetVerifierCorElementTypefrom CoreCLR and replaces all call sites withGetInternalCorElementTypeenum_flag_Category_PrimitiveValueTypeto enum/primitive-specific categoriesPrimitive = 0x00060000andEnum = 0x00070000enum_flag_Category_TruePrimitivetoenum_flag_Category_Primitiveand updates dependent CoreCLR logic// not ValueType.suggestions), cDAC runtime type system contract/doc/test references, and primitive checks inRuntimeHelpers.CoreCLR.csValidation
./build.sh clr+libs+hostcd src/libraries/System.Runtime && dotnet build /t:test ./tests/System.Runtime.Tests/System.Runtime.Tests.csproj -p:OuterLoop=falsedotnet build src/native/managed/cdac/testsdotnet test src/native/managed/cdac/tests --no-buildparallel_validation(CodeQL: no alerts; code review feedback addressed in follow-up commits)