Skip to content

Fix a merge conflict on main-next. #627

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 2 commits into from
Aug 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions Sources/Testing/Parameterization/TypeInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,7 @@ extension TypeInfo: Hashable {
public static func ==(lhs: Self, rhs: Self) -> Bool {
switch (lhs._kind, rhs._kind) {
case let (.type(lhs), .type(rhs)):
// == and ObjectIdentifier do not support move-only metatypes, so compare
// the bits of the types directly. SEE: rdar://134276458
return unsafeBitCast(lhs, to: UnsafeRawPointer.self) == unsafeBitCast(rhs, to: UnsafeRawPointer.self)
return ObjectIdentifier(lhs) == ObjectIdentifier(rhs)
default:
return lhs.fullyQualifiedNameComponents == rhs.fullyQualifiedNameComponents
}
Expand All @@ -325,6 +323,21 @@ extension TypeInfo: Hashable {
}
}

// MARK: - ObjectIdentifier support

extension ObjectIdentifier {
/// Initialize an instance of this type from a type reference.
///
/// - Parameters:
/// - type: The type to initialize this instance from.
///
/// - Bug: The standard library should support this conversion.
/// ([134276458](rdar://134276458), [134415960](rdar://134415960))
fileprivate init(_ type: any ~Copyable.Type) {
self.init(unsafeBitCast(type, to: Any.Type.self))
}
}

// MARK: - Codable

extension TypeInfo: Codable {
Expand Down