Skip to content

Fix crash in NSValue.isEqual() when it is passed an NSNumber #619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 4, 2016

Conversation

gribozavr
Copy link
Contributor

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 of NSValue.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).

NSNumbers are not added to the side table, so we can't find them.
@gribozavr
Copy link
Contributor Author

@phausler @itaiferber Could you review, please?

@gribozavr
Copy link
Contributor Author

@swift-ci Please test

@phausler phausler merged commit accc9e6 into master Sep 4, 2016
@gribozavr gribozavr deleted the fix-crash-in-NSValue.isEqual branch September 4, 2016 18:05
moiseev pushed a commit to moiseev/swift-corelibs-foundation that referenced this pull request Sep 13, 2016
…ng#619)

NSNumbers are not added to the side table, so we can't find them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants