NSObject
conformance to Equatable
is stealthy
#72797
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
triage needed
This issue needs more specific labels
Description
NSObject
has a conformance toEquatable
which delegates to-[isEqual:]
.On the face of it, this is not a bad idea: use Objective-C's conventions where applicable.
However, most classes do not override
-[isEqual:]
and use the default implementation, causing all sorts of unexpected bugs.While it's impractical to warn users of default implementation pitfalls in each case, it might be useful to provide a diagnostic where this is possible. For example, #72765 is caused by such a default conformance.
Reproduction
Expected behavior
Some kind of warning about the default conformance undermining the user's intent.
Environment
swift-driver version: 1.87.3 Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)
Target: arm64-apple-macosx14.0
Additional information
No response
The text was updated successfully, but these errors were encountered: