Commit Graph

3 Commits

Author SHA1 Message Date
Jordan Rose
01cb554387 Re-apply "Make all CF types Equatable and Hashable." (#4568)
Like NSObject, CFType has primitive operations CFEqual and CFHash,
so Swift should allow those types to show up in Hashable positions
(like dictionaries). The most general way to do this was to
introduce a new protocol, _CFObject, and then have the importer
automatically make all CF types conform to it.

This did require one additional change: the == implementation that
calls through to CFEqual is in a new CoreFoundation overlay, but the
conformance is in the underlying Clang module. Therefore, operator
lookup for conformances has been changed to look in the overlay for
an imported declaration (if there is one).

This re-applies 361ab62454, reverted in
f50b1e73dc, after a /very/ long interval
where we decided if it was worth breaking people who've added these
conformances on their own. Since the workaround isn't too difficult---
use `#if swift(>=3.2)` to guard the extension introducing the
conformance---it was deemed acceptable.

https://bugs.swift.org/browse/SR-2388
2017-05-08 14:05:11 -07:00
Greg Parker
f50b1e73dc Revert "Make all CF types Equatable and Hashable." 2016-08-20 04:33:55 -07:00
Jordan Rose
361ab62454 Make all CF types Equatable and Hashable. (#4394)
Like NSObject, CFType has primitive operations CFEqual and CFHash,
so Swift should allow those types to show up in Hashable positions
(like dictionaries). The most general way to do this was to
introduce a new protocol, _CFObject, and then have the importer
automatically make all CF types conform to it.

This did require one additional change: the == implementation that
calls through to CFEqual is in a new CoreFoundation overlay, but the
conformance is in the underlying Clang module. Therefore, operator
lookup for conformances has been changed to look in the overlay for
an imported declaration (if there is one).

https://bugs.swift.org/browse/SR-2388
2016-08-19 13:21:24 -07:00