Skip to content

[SR-7436] Open-source Foundation is missing most AnyHashable representations #3723

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

Open
lorentey opened this issue Apr 14, 2018 · 6 comments
Assignees

Comments

@lorentey
Copy link
Member

Previous ID SR-7436
Radar rdar://problem/39434747
Original Reporter @lorentey
Type Bug
Status In Progress
Resolution
Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug
Assignee @lorentey
Priority Medium

md5: 4d3513cd1638ab2defe58f984baea9fe

Issue Description:

The open-source Foundation package currently doesn't define _HasCustomAnyHashableRepresentation conformances for the following types:

NSAffineTransform
NSArray
NSCalendar
NSCharacterSet
NSDate
NSDateComponents
NSDateInterval
NSDictionary
NSLocale
NSNotification
NSNumber
NSSet
NSString
NSTimeZone
NSURL
NSURLComponents
NSURLQueryItem
NSURLRequest

To improve consistency across platforms, we need to ensure these types hash the same way under AnyHashable as their corresponding Swift types.

@lorentey
Copy link
Member Author

@swift-ci create

@lorentey
Copy link
Member Author

This is a bit more difficult as it seems. While we can easily conform swift-corelibs-foundation types to _HasCustomAnyHashableRepresentation, it is currently pointless to do so, because such conformances have no effect unless the Objective-C runtime is present. (This seems like an artificial restriction to me, but I doubt I fully grok AnyHashable's runtime components yet.)

I believe AnyHashable should work the same way on all platforms; therefore, ideally we should implement support for _HCAHR everywhere.

@belkadan
Copy link

I don't think we'd originally wanted to do that for AnyHashable (there was no need). Now that we're investigating bridging on Linux, that decision may change. cc @jckarter, @millenomi

@jckarter
Copy link
Contributor

The only thing that makes custom AnyHashable representations necessary is bridging, yeah. If we do bridging on Linux we'd need to implement this, but as it stands it's not needed.

@lorentey
Copy link
Member Author

lorentey commented Aug 1, 2018

The Objective-C runtime requirement is now gone for AnyHashable, and bridging works on Linux.

All that remains to be done is adding the conformances, so I'll do that now.

@lorentey
Copy link
Member Author

lorentey commented Aug 2, 2018

PR with the fix is at #1649

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from swiftlang/swift May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants