Skip to content

NSNumber custom AnyHashable fix #11138

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

Conversation

itaiferber
Copy link
Contributor

What's in this pull request?
Resolves rdar://problem/33105735.

When we give NSNumber a custom AnyHashable representation, we want to give it as large a box as possible. When we want to compare it against other AnyHashable boxes such as Int or UInt, it's always possible to upcast the Int/UInt to a larger integer size like Int64 or UInt64 for the comparison. By eliminating the smaller boxes we create, we can maintain the existing behavior that _SwiftTypePreservingNSNumber gave us.

Itai Ferber added 3 commits July 24, 2017 12:22
When we give NSNumber a custom AnyHashable representation, we want to
give it as large a box as possible. When we want to compare it against
other AnyHashable boxes such as Int or UInt, it's always possible to
upcast the Int/UInt to a larger integer size like Int64 or UInt64 for
the comparison. By eliminating the smaller boxes we create, we can
maintain the existing behavior that _SwiftTypePreservingNSNumber gave
us.
@itaiferber itaiferber requested a review from parkera July 24, 2017 20:21
@itaiferber
Copy link
Contributor Author

@swift-ci Please test macOS

@itaiferber
Copy link
Contributor Author

@swift-ci Please smoke test Linux

@parkera
Copy link
Contributor

parkera commented Jul 24, 2017

cc @airspeedswift

@itaiferber itaiferber merged commit cb6b312 into swiftlang:master Jul 24, 2017
@itaiferber itaiferber deleted the nsnumber-custom-anyhashable-fix branch July 24, 2017 23:03
@airspeedswift
Copy link
Member

Thanks for fixing!

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.

3 participants