Skip to content

[4.0] NSNumber custom AnyHashable fix #11152

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

Conversation

itaiferber
Copy link
Contributor

Cherry-picks #11138 to swift-4.0-branch.

Explanation: 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.

Scope: Affects NSDictionary bridging with numeric keys
Radar: rdar://problem/33105735
Risk: Low
Testing: Adds unit tests to confirm expected behavior.

Itai Ferber added 3 commits July 24, 2017 16:05
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
Copy link
Contributor Author

@swift-ci Please test macOS

@itaiferber
Copy link
Contributor Author

@swift-ci Please smoke test Linux

@itaiferber
Copy link
Contributor Author

@swift-ci Please test Linux

@itaiferber itaiferber merged commit 75b7e05 into swiftlang:swift-4.0-branch Jul 25, 2017
@itaiferber itaiferber deleted the 4.0-nsnumber-custom-anyhashable-fix branch July 25, 2017 02:37
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.

1 participant