Skip to content

Commit 46b860b

Browse files
authored
[stdlib] returning false in case where comparison cannot succeed in SwiftValue (#4813)
1 parent 04b7201 commit 46b860b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

stdlib/public/runtime/SwiftValue.mm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ - (BOOL)isEqual:(id)other {
305305
}
306306

307307
if (![other isKindOfClass:getSwiftValueClass()]) {
308-
return self == other;
308+
return NO;
309309
}
310310

311311
auto selfHeader = getSwiftValueHeader(self);
@@ -314,12 +314,12 @@ - (BOOL)isEqual:(id)other {
314314
auto hashableBaseType = selfHeader->getHashableBaseType();
315315
if (!hashableBaseType ||
316316
otherHeader->getHashableBaseType() != hashableBaseType) {
317-
return self == other;
317+
return NO;
318318
}
319319

320320
auto hashableConformance = selfHeader->getHashableConformance();
321321
if (!hashableConformance) {
322-
return self == other;
322+
return NO;
323323
}
324324

325325
return swift_stdlib_Hashable_isEqual_indirect(

0 commit comments

Comments
 (0)