Conform LossLessStringConvertible for UUID#1303
Open
jevonmao wants to merge 3 commits intoswiftlang:mainfrom
Open
Conform LossLessStringConvertible for UUID#1303jevonmao wants to merge 3 commits intoswiftlang:mainfrom
LossLessStringConvertible for UUID#1303jevonmao wants to merge 3 commits intoswiftlang:mainfrom
Conversation
itingliu
reviewed
May 20, 2025
Contributor
itingliu
left a comment
There was a problem hiding this comment.
We need an accompanying API proposal since this is changing the public interface. Do you have one?
| /// 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 { |
Contributor
There was a problem hiding this comment.
This new conformance and the new init need to have the new availability annotation.
Contributor
Author
|
@itingliu I added the proposal. Could you abbreviated review for this? |
itingliu
previously approved these changes
Jun 20, 2025
Contributor
|
@swift-ci please test |
itingliu
reviewed
Jun 23, 2025
| XCTAssertTrue(uuid2 == uuid1) | ||
| } | ||
|
|
||
| func test_UUIDLosslessStringConvertible() { |
Contributor
There was a problem hiding this comment.
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.
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
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.
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