Skip to content

Commit 87a2466

Browse files
committed
Test array equality fix
1 parent 8659fc3 commit 87a2466

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

apollo-ios/Sources/ApolloAPI/SelectionSet+Equatable.swift

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ public extension SelectionSet {
2222
}
2323

2424
@inlinable
25-
internal static func equatableCheck<T: Hashable>(
26-
_ lhs: [T: any Hashable],
27-
_ rhs: [T: any Hashable]
25+
internal static func equatableCheck(
26+
_ lhs: [String: any Hashable],
27+
_ rhs: [String: any Hashable]
2828
) -> Bool {
2929
guard lhs.keys == rhs.keys else { return false }
3030

@@ -37,18 +37,18 @@ public extension SelectionSet {
3737
}
3838
}
3939

40+
@_disfavoredOverload
4041
@inlinable
4142
internal static func equatableCheck<T: Hashable>(
4243
_ lhs: T,
4344
_ rhs: any Hashable
4445
) -> Bool {
45-
if lhs != rhs as? T {
46-
print("""
47-
equatableCheck failure on \(String(describing: self))
48-
T: \(String(describing: T.self))
49-
lhs: \(lhs)
50-
rhs: \(rhs), as? T: \(rhs as? T)
51-
""")
46+
if let lhs = lhs as? [any Hashable],
47+
let rhs = rhs as? [any Hashable] {
48+
49+
return lhs.elementsEqual(rhs) { l, r in
50+
equatableCheck(l, r)
51+
}
5252
}
5353

5454
return lhs == rhs as? T
@@ -61,7 +61,6 @@ public extension SelectionSet {
6161

6262
} else {
6363
self.addFulfilledSelections(of: type(of: self), to: &fields)
64-
6564
}
6665

6766
return fields

0 commit comments

Comments
 (0)