@@ -27,7 +27,7 @@ internal protocol PackageIdentityProvider: CustomStringConvertible {
27
27
}
28
28
29
29
/// The canonical identifier for a package, based on its source location.
30
- public struct PackageIdentity : Hashable , CustomStringConvertible {
30
+ public struct PackageIdentity : CustomStringConvertible {
31
31
/// The underlying type used to create package identities.
32
32
internal static var provider : PackageIdentityProvider . Type = LegacyPackageIdentity . self
33
33
@@ -59,9 +59,27 @@ public struct PackageIdentity: Hashable, CustomStringConvertible {
59
59
}
60
60
}
61
61
62
- extension PackageIdentity : Comparable {
62
+ extension PackageIdentity : Equatable , Comparable {
63
+ private func compare( to other: PackageIdentity ) -> ComparisonResult {
64
+ return self . description. caseInsensitiveCompare ( other. description)
65
+ }
66
+
67
+ public static func == ( lhs: PackageIdentity , rhs: PackageIdentity ) -> Bool {
68
+ return lhs. compare ( to: rhs) == . orderedSame
69
+ }
70
+
63
71
public static func < ( lhs: PackageIdentity , rhs: PackageIdentity ) -> Bool {
64
- return lhs. description < rhs. description
72
+ return lhs. compare ( to: rhs) == . orderedAscending
73
+ }
74
+
75
+ public static func > ( lhs: PackageIdentity , rhs: PackageIdentity ) -> Bool {
76
+ return lhs. compare ( to: rhs) == . orderedDescending
77
+ }
78
+ }
79
+
80
+ extension PackageIdentity : Hashable {
81
+ public func hash( into hasher: inout Hasher ) {
82
+ hasher. combine ( description. lowercased ( ) )
65
83
}
66
84
}
67
85
0 commit comments