Hi Sean Yes, I was bitten by that too, very, very recently, when I was translating a few files into Swift and I got warning when I didn’t use an optional for the object of the method.
Actually, I suspect that’s a bug in the headers, or probably that’s a non-audited header for nullability. Although isEqual: is part of the NSObject protocol and isEqualTo: is part of the NSComparisonMethods protocol of NSObject, the latter expects a nullable receiver (check that in NSScriptWhoseTests.h). Check the Swift version of it and you will see that isEqual(to: Any?) expects an optional. Therefore, I suspect that the same is true for isEqual: and that this API has not yet been audited for nullability. Perhaps you should file a bug against that header. João > > > NSObject.h declares: > > - (BOOL)isEqual:(id)object; > > Note the parameter is not nullable. And yet, I'm seeing nil passed to one of > my class's overrides of isEqual: when I invoke Edit>Undo. Backtrace: > > #4 -[RRLookupTable isEqual:] > #5 -[NSManagedObject(_NSInternalMethods) _updateFromUndoSnapshot:] () > #6 -[NSManagedObjectContext(_NSInternalChangeProcessing) _undoInsertions:] > () > #7 -[_NSUndoStack popAndInvoke] () > #8 -[NSUndoManager undoNestedGroup] () > #9 _os_activity_initiate () > #10 -[NSApplication(NSResponder) sendAction:to:from:] () > #11 -[NSMenuItem _corePerformAction] () > #12 -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] () > #13 _os_activity_initiate () > #14 -[NSMenu performKeyEquivalent:] () > #15 routeKeyEquivalent () > #16 -[NSApplication(NSEvent) sendEvent:] () > #17 -[NSApplication run] () > #18 NSApplicationMain () > #19 main > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com