Skip to content

Commit 27a4ea8

Browse files
authored
Merge pull request #73604 from tbkka/tbkka-127839540-6.0
[6.0] Make SwiftValue == support unconditional
2 parents ad1d9ff + 0ee4d0b commit 27a4ea8

File tree

3 files changed

+0
-26
lines changed

3 files changed

+0
-26
lines changed

stdlib/public/runtime/SwiftValue.mm

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -430,11 +430,6 @@ - (BOOL)isEqual:(id)other {
430430
}
431431
}
432432

433-
if (runtime::bincompat::useLegacySwiftObjCHashing()) {
434-
// Legacy behavior only proxies isEqual: for Hashable, not Equatable
435-
return NO;
436-
}
437-
438433
if (auto equatableConformance = selfHeader->getEquatableConformance()) {
439434
if (auto selfEquatableBaseType = selfHeader->getEquatableBaseType()) {
440435
auto otherEquatableBaseType = otherHeader->getEquatableBaseType();
@@ -464,11 +459,6 @@ - (NSUInteger)hash {
464459
selfHeader->type, hashableConformance);
465460
}
466461

467-
if (runtime::bincompat::useLegacySwiftObjCHashing()) {
468-
// Legacy behavior doesn't honor Equatable conformance, only Hashable
469-
return (NSUInteger)self;
470-
}
471-
472462
// If Swift type is Equatable but not Hashable,
473463
// we have to return something here that is compatible
474464
// with the `isEqual:` above.

test/stdlib/BridgeEquatableToObjC.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,7 @@ BridgeEquatableToObjC.test("Bridge equatable struct") {
3232
let objcResult = objcA.isEqual(objcB)
3333

3434
expectEqual(swiftResult, true)
35-
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(visionOS)
36-
// Apple platforms use old semantics for now...
37-
expectEqual(objcResult, false)
38-
#else
3935
expectEqual(objcResult, true)
40-
#endif
4136
}
4237

4338
BridgeEquatableToObjC.test("Bridge non-equatable struct") {

test/stdlib/SwiftValueNSObject.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,7 @@ func TestHashableEquals<T: Equatable>(_ e1: T, _ e2: T) {
9090
// This has not always been true for Equatable value types
9191
func TestEquatableEquals<T: Equatable>(_ e1: T, _ e2: T) {
9292
if e1 == e2 {
93-
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(visionOS)
94-
// Legacy: Swift Equatable is not used in ObjC
95-
TestSwiftValueNSObjectNotEquals(e1 as AnyObject, e2 as AnyObject)
96-
#else
9793
TestSwiftValueNSObjectEquals(e1 as AnyObject, e2 as AnyObject)
98-
#endif
9994
} else {
10095
TestSwiftValueNSObjectNotEquals(e1 as AnyObject, e2 as AnyObject)
10196
}
@@ -114,14 +109,8 @@ func TestHashable<T: Hashable>(_ h: T)
114109
// Test Obj-C hashValue for Swift types that are Equatable but not Hashable
115110
func TestEquatableHash<T: Equatable>(_ e: T)
116111
{
117-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(visionOS)
118-
// Legacy behavior used the pointer value, which is
119-
// incompatible with user-defined equality.
120-
TestSwiftValueNSObjectDefaultHashValue(e as AnyObject)
121-
#else
122112
// New behavior uses a constant hash value in this case
123113
TestSwiftValueNSObjectHashValue(e as AnyObject, 1)
124-
#endif
125114
}
126115

127116
func TestNonEquatableHash<T>(_ e: T)

0 commit comments

Comments
 (0)