Skip to content

stdlib: remove AnyHashable APIs on Dictionary and Set #4082

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
Aug 7, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,6 @@ extension AnyHashable : _AnyHashableProtocol {}
// FIXME: remove these trampolines when extensions below can be
// properly expressed in the language.
extension Set {
@inline(__always)
internal func _concreteElement_contains(_ member: Element) -> Bool {
return contains(member)
}

@inline(__always)
internal func _concreteElement_index(of member: Element) -> Index? {
return index(of: member)
}

@inline(__always)
internal mutating func _concreteElement_insert(
_ newMember: Element
Expand All @@ -61,18 +51,6 @@ extension Set {

// FIXME(ABI)(compiler limitation): replace with `where Element == AnyHashable`.
extension Set where Element : _AnyHashableProtocol {
public func contains<ConcreteElement : Hashable>(
_ member: ConcreteElement
) -> Bool {
return _concreteElement_contains(AnyHashable(member) as! Element)
}

public func index<ConcreteElement : Hashable>(
of member: ConcreteElement
) -> SetIndex<Element>? {
return _concreteElement_index(of: AnyHashable(member) as! Element)
}

public mutating func insert<ConcreteElement : Hashable>(
_ newMember: ConcreteElement
) -> (inserted: Bool, memberAfterInsert: ConcreteElement) {
Expand Down Expand Up @@ -107,11 +85,6 @@ extension Set where Element : _AnyHashableProtocol {
// FIXME: remove these trampolines when extensions below can be
// properly expressed in the language.
extension Dictionary {
@inline(__always)
internal func _concreteKey_index(forKey key: Key) -> Index? {
return index(forKey: key)
}

internal subscript(_concreteKey key: Key) -> Value? {
@inline(__always)
get {
Expand All @@ -138,12 +111,6 @@ extension Dictionary {

// FIXME(ABI)(compiler limitation): replace with `where Element == AnyHashable`.
extension Dictionary where Key : _AnyHashableProtocol {
public func index<ConcreteKey : Hashable>(forKey key: ConcreteKey)
-> DictionaryIndex<Key, Value>?
{
return _concreteKey_index(forKey: AnyHashable(key) as! Key)
}

public subscript(_ key: _Hashable) -> Value? {
// FIXME(ABI)(compiler limitation): replace this API with a
// generic subscript.
Expand Down