-
Notifications
You must be signed in to change notification settings - Fork 195
Conform LossLessStringConvertible
for UUID
#1303
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
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.
We need an accompanying API proposal since this is changing the public interface. Do you have one?
@@ -16,7 +16,7 @@ public typealias uuid_string_t = (Int8, Int8, Int8, Int8, Int8, Int8, Int8, Int8 | |||
|
|||
/// Represents UUID strings, which can be used to uniquely identify types, interfaces, and other items. | |||
@available(macOS 10.8, iOS 6.0, tvOS 9.0, watchOS 2.0, *) | |||
public struct UUID : Hashable, Equatable, CustomStringConvertible, Sendable { | |||
public struct UUID : Hashable, Equatable, CustomStringConvertible, Sendable, LosslessStringConvertible { |
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.
This new conformance and the new init
need to have the new availability annotation.
@itingliu I added the proposal. Could you abbreviated review for this? |
@swift-ci please test |
@@ -115,4 +115,19 @@ final class UUIDTests : XCTestCase { | |||
XCTAssertFalse(uuid2 > uuid1) | |||
XCTAssertTrue(uuid2 == uuid1) | |||
} | |||
|
|||
func test_UUIDLosslessStringConvertible() { |
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.
Actually we just recently switched to use swift-testing two weeks ago. Do you mind rebasing main and updating this test to swift-testing?
I left a comment asking if we could switch to swift-testing from XCTest. Dismissing this review so my comment doesn't get lost.
As discussed in Swift Forums and implemented in several frameworks like Vapor, UUID meets the semantic contract of
LosslessStringConvertible
. This PR adds conformance of UUID toLosslessStringConvertible
.Closes #1292