Skip to content

Commit 5b5b3dd

Browse files
committed
[TypeChecker] NFC: Add a test-case for rdar://109381194
1 parent 878066b commit 5b5b3dd

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/Constraints/casts.swift

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,3 +718,26 @@ func isHashable_is(_ error: Error) -> Bool {
718718
func isHashable_composition(_ error: Error & AnyObject) -> Bool {
719719
error is AnyHashable // OK
720720
}
721+
722+
// rdar://109381194 - incorrect ambiguity while comparing collections
723+
do {
724+
class A : Hashable, Equatable {
725+
func hash(into hasher: inout Hasher) {
726+
}
727+
728+
static func == (lhs: A, rhs: A) -> Bool {
729+
false
730+
}
731+
}
732+
733+
class B : A {}
734+
735+
func test(a: [B], b: [String: B]) {
736+
assert(Set(a) == Set(b.values.map { $0 as A })) // ok
737+
}
738+
739+
func test(a: [A], b: [B]) {
740+
assert(Set(a) == Set(b.map { $0 as A })) // Ok
741+
assert(Set(b.map { $0 as A }) == Set(a)) // Ok
742+
}
743+
}

0 commit comments

Comments
 (0)