Skip to content

Commit 37c0f41

Browse files
committed
Reduce the diff to track the regression
1 parent 3743bda commit 37c0f41

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

Sources/PackageGraph/Resolution/ResolvedTarget.swift

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import func TSCBasic.topologicalSort
1717
/// Represents a fully resolved target. All the dependencies for the target are resolved.
1818
public final class ResolvedTarget {
1919
/// Represents dependency of a resolved target.
20-
public enum Dependency: Hashable {
20+
public enum Dependency {
2121
/// Direct dependency of the target. This target is in the same package and should be statically linked.
2222
case target(_ target: ResolvedTarget, conditions: [PackageCondition])
2323

@@ -171,6 +171,30 @@ extension ResolvedTarget: CustomStringConvertible {
171171
}
172172
}
173173

174+
extension ResolvedTarget.Dependency: Equatable {
175+
public static func == (lhs: ResolvedTarget.Dependency, rhs: ResolvedTarget.Dependency) -> Bool {
176+
switch (lhs, rhs) {
177+
case (.target(let lhsTarget, _), .target(let rhsTarget, _)):
178+
return lhsTarget == rhsTarget
179+
case (.product(let lhsProduct, _), .product(let rhsProduct, _)):
180+
return lhsProduct == rhsProduct
181+
case (.product, .target), (.target, .product):
182+
return false
183+
}
184+
}
185+
}
186+
187+
extension ResolvedTarget.Dependency: Hashable {
188+
public func hash(into hasher: inout Hasher) {
189+
switch self {
190+
case .target(let target, _):
191+
hasher.combine(target)
192+
case .product(let product, _):
193+
hasher.combine(product)
194+
}
195+
}
196+
}
197+
174198
extension ResolvedTarget.Dependency: CustomStringConvertible {
175199
public var description: String {
176200
var str = "<ResolvedTarget.Dependency: "

0 commit comments

Comments
 (0)