-
Notifications
You must be signed in to change notification settings - Fork 542
[RGen] Allow to generate a 'new' syntax using a known type. #23028
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
Conversation
There are some types that are known and we want to create a new instance for using new rather than GetINativeObject/GetNSObject. Add a new overload of the New method that allows to pass directly a TypeSyntax.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ [CI Build #b5ab1b8] Build passed (Build packages) ✅Pipeline on Agent |
✅ [PR Build #b5ab1b8] Build passed (Detect API changes) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
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 adds support for directly generating object creation syntax from a known TypeSyntax
rather than TypeInfo
, introduces two new known type entries, and covers this new path with a unit test.
- Introduce a
New(TypeSyntax, ImmutableArray<ArgumentSyntax>)
overload inBindingSyntaxFactory.Runtime
. - Add
AudioBuffers
andCMSampleBuffer
toBindingSyntaxFactory.KnownTypes
. - Add
NewTestsKnownType
to verify the new overload with a known type.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
tests/.../BindingSyntaxFactoryRuntimeTests.cs | Added a test (NewTestsKnownType ) for generating new from a known type |
src/.../BindingSyntaxFactory.Runtime.cs | Added New overload accepting TypeSyntax and updated docs |
src/.../BindingSyntaxFactory.KnownTypes.cs | Defined AudioBuffers and CMSampleBuffer as reusable TypeSyntax |
Comments suppressed due to low confidence (3)
src/rgen/Microsoft.Macios.Generator/Emitters/BindingSyntaxFactory.Runtime.cs:500
- The
<param name="type">
description refers toTypeInfo
but this overload accepts aTypeSyntax
. Please update the description to reflect that it represents the syntax node for the type.
/// <param name="type">The information of the type of object to be created.</param>
tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryRuntimeTests.cs:525
- [nitpick] The test name
NewTestsKnownType
deviates from the existingNewTests
naming convention. Consider renaming it toNewTests_KnownType
or similar to match the suite.
void NewTestsKnownType ()
src/rgen/Microsoft.Macios.Generator/Emitters/BindingSyntaxFactory.KnownTypes.cs:161
- You added a
CMSampleBuffer
known type but didn't include a corresponding unit test. Consider adding a test similar toNewTestsKnownType
to cover this new entry.
/// <summary>
src/rgen/Microsoft.Macios.Generator/Emitters/BindingSyntaxFactory.Runtime.cs
Outdated
Show resolved
Hide resolved
src/rgen/Microsoft.Macios.Generator/Emitters/BindingSyntaxFactory.KnownTypes.cs
Outdated
Show resolved
Hide resolved
✅ API diff for current PR / commit.NET ( No breaking changes )✅ API diff vs stable.NET ( No breaking changes )ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
✅ [CI Build #b5ab1b8] Build passed (Build macOS tests) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
💻 [CI Build #b5ab1b8] Tests on macOS X64 - Mac Sonoma (14) passed 💻✅ All tests on macOS X64 - Mac Sonoma (14) passed. Pipeline on Agent |
💻 [CI Build #b5ab1b8] Tests on macOS M1 - Mac Monterey (12) passed 💻✅ All tests on macOS M1 - Mac Monterey (12) passed. Pipeline on Agent |
💻 [CI Build #b5ab1b8] Tests on macOS arm64 - Mac Sequoia (15) passed 💻✅ All tests on macOS arm64 - Mac Sequoia (15) passed. Pipeline on Agent |
💻 [CI Build #b5ab1b8] Tests on macOS M1 - Mac Ventura (13) passed 💻✅ All tests on macOS M1 - Mac Ventura (13) passed. Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
🚀 [CI Build #7747cec] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 115 tests passed 🎉 Tests counts✅ cecil: All 1 tests passed. Html Report (VSDrops) Download Pipeline on Agent |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There are some types that are known and we want to create a new instance for using new rather than GetINativeObject/GetNSObject. Add a new
overload of the New method that allows to pass directly a TypeSyntax.