-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Migrate ExtendedLayout test types from IL to C# #123276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
|
@copilot address the feedback from my review |
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
src/tests/Loader/classloader/ExtendedLayout/ExtendedLayoutTypes.il
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR migrates ExtendedLayout test type definitions from IL to C# now that the C# compiler supports the ExtendedLayoutAttribute. The migration moves type definitions to C# where possible while retaining IL types that require features C# cannot express.
Changes:
- Migrated 9 CStruct types and 9 CUnion types from IL to C# using the
ExtendedLayoutAttribute - Retained 9 IL types that require dual attributes or test invalid type scenarios
- Added shared helper types (
NestedSequentialType,NestedAutoLayoutType) in CStruct.cs for use across both test files
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| ExtendedLayoutTypes.il | Removed migrated types; retained invalid test types and types requiring both ExtendedLayout and StructLayout/FieldOffset attributes |
| CStruct.cs | Added 9 CStruct type definitions and 2 shared nested helper types using ExtendedLayoutAttribute |
| CUnion.cs | Added 9 CUnion type definitions using ExtendedLayoutAttribute |
Description
The C# compiler now supports the
ExtendedLayoutAttribute. Migrated CStruct and CUnion type definitions from IL to C# where possible, keeping types that require bothStructLayoutandExtendedLayoutattributes in IL.Changes
CStruct.cs
[ExtendedLayout(ExtendedLayoutKind.CStruct)][StructLayout(LayoutKind.Auto)]onNestedAutoLayoutType), empty structs, and byref-like structsCUnion.cs
[ExtendedLayout(ExtendedLayoutKind.CUnion)]ExtendedLayoutTypes.il
NoExtendedAttributeOnType- tests missing attributeInlineArrayOnExtendedLayout- tests invalid attribute combinationExtendedLayoutInvalidKind- tests invalid enum valueExtendedLayoutandStructLayout/FieldOffsetattributes:CStructWithOffsets,CStructWithSize,CStructWithPackCUnionWithOffsets,CUnionWithSize,CUnionWithPackExample migration:
All existing tests remain unchanged - they reference the same type names, now defined in C# where possible and in IL where dual attributes are required.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.