-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Add Equatable and Hashable conformance to GUID.
#84792
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
Merged
Merged
Conversation
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
On Windows, `GUID` is a currency type and (along with its various typedefs) is used pervasively Windows offers `IsEqualGUID()` and `UuidHash()` for comparing and hashing them, respectively, but `IsEqualGUID()` is a macro in C mode and `UuidHash()` only provides a 16-bit hash. We should provide conformance to these protocols in the WinSDK overlay to provide equivalent functionality in Swift.
9fd42ec to
baf4506
Compare
compnerd
reviewed
Oct 9, 2025
compnerd
reviewed
Oct 9, 2025
compnerd
approved these changes
Oct 9, 2025
Contributor
Author
|
@swift-ci test |
2 tasks
Contributor
Author
|
@swift-ci test |
Contributor
Author
|
@swift-ci test macOS |
Contributor
Author
|
@swift-ci test Windows |
Contributor
Author
|
@swift-ci smoke test |
Contributor
Author
|
@swift-ci smoke test macOS |
This was referenced Oct 10, 2025
dendiz
pushed a commit
to dendiz/swift
that referenced
this pull request
Oct 21, 2025
On Windows, `GUID` is a currency type and (along with its various typedefs) is used pervasively Windows offers `IsEqualGUID()` and `UuidHash()` for comparing and hashing them, respectively, but `IsEqualGUID()` is a macro in C mode and `UuidHash()` only provides a 16-bit hash. We should provide conformance to these protocols in the WinSDK overlay to provide equivalent functionality in Swift.
speednoisemovement
pushed a commit
to speednoisemovement/swift
that referenced
this pull request
Oct 29, 2025
On Windows, `GUID` is a currency type and (along with its various typedefs) is used pervasively Windows offers `IsEqualGUID()` and `UuidHash()` for comparing and hashing them, respectively, but `IsEqualGUID()` is a macro in C mode and `UuidHash()` only provides a 16-bit hash. We should provide conformance to these protocols in the WinSDK overlay to provide equivalent functionality in Swift.
grynspan
added a commit
that referenced
this pull request
Nov 11, 2025
In #84792 we have added implementation to `Equatable` and `Hashable` there are two issues with this. 1. Uses of type `GUID` would be emitted in the `swiftinterface` file as `_GUIDDef._GUID` since it is an external type. but the type name in the imported header file is `GUID` and not `_GUID` 2. When compiling using `-cxx-interoperability-mode=default`, there are duplicate definition errors for `==` since the c++ header file defines the same operator. Proposed changes: 1. Add a type alias `typealias _GUID = GUID` to address the naming mismatch in the generated interface file 2. Add conditional definitions of the equatable implementation to avoid duplicate definitions. --------- Co-authored-by: Jonathan Grynspan <[email protected]>
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.
On Windows,
GUIDis a currency type and (along with its various typedefs) is used pervasively Windows offersIsEqualGUID()andUuidHash()for comparing and hashing them, respectively, butIsEqualGUID()is a macro in C mode andUuidHash()only provides a 16-bit hash. We should provide conformance to these protocols in the WinSDK overlay to provide equivalent functionality in Swift.