-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Introduce SwiftSelf<T>
and SwiftIndirectResult
structs
#102717
Merged
kotlarmilos
merged 6 commits into
dotnet:main
from
kotlarmilos:feature/swift-struct-handling
Jun 7, 2024
Merged
Introduce SwiftSelf<T>
and SwiftIndirectResult
structs
#102717
kotlarmilos
merged 6 commits into
dotnet:main
from
kotlarmilos:feature/swift-struct-handling
Jun 7, 2024
Conversation
This file contains 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
kotlarmilos
requested review from
lambdageek,
jkoritzinsky,
jakobbotsch,
AaronRobinsonMSFT,
matouskozak and
jkurdek
May 27, 2024 11:33
Note regarding the
|
matouskozak
reviewed
May 27, 2024
src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Swift/SwiftTypes.cs
Outdated
Show resolved
Hide resolved
…pServices/Swift/SwiftTypes.cs Co-authored-by: Matous Kozak <55735845+matouskozak@users.noreply.github.com>
src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Swift/SwiftTypes.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Swift/SwiftTypes.cs
Outdated
Show resolved
Hide resolved
…pServices/Swift/SwiftTypes.cs Co-authored-by: Aaron Robinson <arobins@microsoft.com>
…pServices/Swift/SwiftTypes.cs Co-authored-by: Aaron Robinson <arobins@microsoft.com>
jaredpar
reviewed
Jun 5, 2024
@@ -13904,6 +13904,19 @@ namespace System.Runtime.InteropServices.Swift | |||
public unsafe SwiftSelf(void* value) { throw null; } | |||
public unsafe void* Value { get { throw null; } } | |||
} | |||
public readonly partial struct SwiftSelf<T> where T: unmanaged | |||
{ | |||
private readonly int _dummyPrimitive; |
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.
Suggested change
private readonly int _dummyPrimitive; | |
private readonly T _dummyPrimitive; |
Using T
here allows the C# compiler to detect infinite generic expansion at build time.
AaronRobinsonMSFT
approved these changes
Jun 5, 2024
This was referenced Jun 5, 2024
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Description
This PR introduces
SwiftSelf<T>
andSwiftIndirectResult
structs to facilitate interop with Swift structs. Runtime support along with the corresponding test cases (#102079 and #102082) will be added in subsequent PRs.The idea is to keep both
SwiftSelf
andSwiftSelf<T>
for now, asSwiftSelf
will be utilized for class support and closure context.Fixes #100543