Fix crash in NSValue.isEqual() when it is passed an NSNumber #619
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
NSNumbers are not added to the side table, so we can't find them.
I don't think that
NSValue.isEqual()
is correct in general, but this gets us closer to the correct implementation and unblocks swiftlang/swift#4621 . For example, subclasses that have custom storage -- like NSNumber -- should compare equal to an NSValue as long as they have the same bytes and the same type, but the current implementation ofNSValue.isEqual()
can only return true if two references are equal.Note: this issue blocks swiftlang/swift#4621 (after we change the hashing algorithm, the test TestNSKeyedArchiver.test_archive_set starts to compare NSValue to NSNumber where it previously wasn't doing that just because we got lucky in the hash table order).