14
14
// Convenience APIs for Set<AnyHashable>
15
15
//===----------------------------------------------------------------------===//
16
16
17
- // FIXME(ABI)#36 (Overload resolution): remove these trampolines when extensions below can be
18
- // properly expressed in the language.
19
- extension Set {
20
- @inline(__always)
21
- internal mutating func _concreteElement_insert(
22
- _ newMember: Element
23
- ) -> (inserted: Bool, memberAfterInsert: Element) {
24
- return insert(newMember)
25
- }
26
-
27
- @inline(__always)
28
- internal mutating func _concreteElement_update(
29
- with newMember: Element
30
- ) -> Element? {
31
- return update(with: newMember)
32
- }
33
-
34
- @inline(__always)
35
- internal mutating func _concreteElement_remove(
36
- _ member: Element
37
- ) -> Element? {
38
- return remove(member)
39
- }
40
- }
41
-
42
17
extension Set where Element == AnyHashable {
43
18
public mutating func insert<ConcreteElement : Hashable>(
44
19
_ newMember: ConcreteElement
45
20
) -> (inserted: Bool, memberAfterInsert: ConcreteElement) {
46
21
let (inserted, memberAfterInsert) =
47
- _concreteElement_insert (AnyHashable(newMember))
22
+ insert (AnyHashable(newMember))
48
23
return (
49
24
inserted: inserted,
50
25
memberAfterInsert: memberAfterInsert.base as! ConcreteElement)
@@ -54,15 +29,15 @@ extension Set where Element == AnyHashable {
54
29
public mutating func update<ConcreteElement : Hashable>(
55
30
with newMember: ConcreteElement
56
31
) -> ConcreteElement? {
57
- return _concreteElement_update (with: AnyHashable(newMember))
32
+ return update (with: AnyHashable(newMember))
58
33
.map { $0.base as! ConcreteElement }
59
34
}
60
35
61
36
@discardableResult
62
37
public mutating func remove<ConcreteElement : Hashable>(
63
38
_ member: ConcreteElement
64
39
) -> ConcreteElement? {
65
- return _concreteElement_remove (AnyHashable(member))
40
+ return remove (AnyHashable(member))
66
41
.map { $0.base as! ConcreteElement }
67
42
}
68
43
}
@@ -71,57 +46,30 @@ extension Set where Element == AnyHashable {
71
46
// Convenience APIs for Dictionary<AnyHashable, *>
72
47
//===----------------------------------------------------------------------===//
73
48
74
- // FIXME(ABI)#38 (Overload resolution): remove these trampolines when extensions below can be
75
- // properly expressed in the language.
76
- extension Dictionary {
77
- internal subscript(_concreteKey key: Key) -> Value? {
78
- @inline(__always)
79
- get {
80
- return self[key]
81
- }
82
- @inline(__always)
83
- set(newValue) {
84
- self[key] = newValue
85
- }
86
- }
87
-
88
- @inline(__always)
89
- internal mutating func _concreteKey_updateValue(
90
- _ value: Value, forKey key: Key
91
- ) -> Value? {
92
- return updateValue(value, forKey: key)
93
- }
94
-
95
- @inline(__always)
96
- internal mutating func _concreteKey_removeValue(forKey key: Key) -> Value? {
97
- return removeValue(forKey: key)
98
- }
99
- }
100
-
101
49
extension Dictionary where Key == AnyHashable {
102
50
public subscript(_ key: _Hashable) -> Value? {
103
51
// FIXME(ABI)#40 (Generic subscripts): replace this API with a
104
52
// generic subscript.
105
53
get {
106
- return self[_concreteKey: key._toAnyHashable()]
54
+ return self[key._toAnyHashable()]
107
55
}
108
56
set {
109
- self[_concreteKey: key._toAnyHashable()] = newValue
57
+ self[key._toAnyHashable()] = newValue
110
58
}
111
59
}
112
60
113
61
@discardableResult
114
62
public mutating func updateValue<ConcreteKey : Hashable>(
115
63
_ value: Value, forKey key: ConcreteKey
116
64
) -> Value? {
117
- return _concreteKey_updateValue (value, forKey: AnyHashable(key))
65
+ return updateValue (value, forKey: AnyHashable(key))
118
66
}
119
67
120
68
@discardableResult
121
69
public mutating func removeValue<ConcreteKey : Hashable>(
122
70
forKey key: ConcreteKey
123
71
) -> Value? {
124
- return _concreteKey_removeValue (forKey: AnyHashable(key))
72
+ return removeValue (forKey: AnyHashable(key))
125
73
}
126
74
}
127
75
0 commit comments