Skip to content

Commit 7e99ee1

Browse files
jckartergribozavr
authored andcommitted
Make all _toAnyHashable() implements @nonobjc.
1 parent 2252850 commit 7e99ee1

19 files changed

+40
-0
lines changed

stdlib/public/SDK/Foundation/AffineTransform.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,8 @@ extension AffineTransform : _ObjectiveCBridgeable {
294294
}
295295

296296
extension NSAffineTransform : _HasCustomAnyHashableRepresentation {
297+
// Must be @nonobjc to avoid infinite recursion during bridging.
298+
@nonobjc
297299
public func _toCustomAnyHashable() -> AnyHashable? {
298300
return AnyHashable(self as AffineTransform)
299301
}

stdlib/public/SDK/Foundation/Calendar.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,6 +1129,8 @@ extension Calendar : _ObjectiveCBridgeable {
11291129
}
11301130

11311131
extension NSCalendar : _HasCustomAnyHashableRepresentation {
1132+
// Must be @nonobjc to avoid infinite recursion during bridging.
1133+
@nonobjc
11321134
public func _toCustomAnyHashable() -> AnyHashable? {
11331135
return AnyHashable(self as Calendar)
11341136
}

stdlib/public/SDK/Foundation/CharacterSet.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,8 @@ extension CharacterSet : _ObjectiveCBridgeable {
469469
}
470470

471471
extension NSCharacterSet : _HasCustomAnyHashableRepresentation {
472+
// Must be @nonobjc to avoid infinite recursion during bridging.
473+
@nonobjc
472474
public func _toCustomAnyHashable() -> AnyHashable? {
473475
return AnyHashable(self as CharacterSet)
474476
}

stdlib/public/SDK/Foundation/Data.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,8 @@ extension Data : _ObjectiveCBridgeable {
730730
}
731731

732732
extension NSData : _HasCustomAnyHashableRepresentation {
733+
// Must be @nonobjc to avoid infinite recursion during bridging.
734+
@nonobjc
733735
public func _toCustomAnyHashable() -> AnyHashable? {
734736
return AnyHashable(self as Data)
735737
}

stdlib/public/SDK/Foundation/Date.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,8 @@ extension Date : _ObjectiveCBridgeable {
263263
}
264264

265265
extension NSDate : _HasCustomAnyHashableRepresentation {
266+
// Must be @nonobjc to avoid infinite recursion during bridging.
267+
@nonobjc
266268
public func _toCustomAnyHashable() -> AnyHashable? {
267269
return AnyHashable(self as Date)
268270
}

stdlib/public/SDK/Foundation/DateComponents.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,8 @@ extension DateComponents : _ObjectiveCBridgeable {
346346
}
347347

348348
extension NSDateComponents : _HasCustomAnyHashableRepresentation {
349+
// Must be @nonobjc to avoid infinite recursion during bridging.
350+
@nonobjc
349351
public func _toCustomAnyHashable() -> AnyHashable? {
350352
return AnyHashable(self as DateComponents)
351353
}

stdlib/public/SDK/Foundation/DateInterval.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,8 @@ extension DateInterval : _ObjectiveCBridgeable {
222222

223223
@available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
224224
extension NSDateInterval : _HasCustomAnyHashableRepresentation {
225+
// Must be @nonobjc to avoid infinite recursion during bridging.
226+
@nonobjc
225227
public func _toCustomAnyHashable() -> AnyHashable? {
226228
return AnyHashable(self as DateInterval)
227229
}

stdlib/public/SDK/Foundation/Foundation.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,8 @@ extension Set : _ObjectiveCBridgeable {
934934
/*
935935
FIXME(id-as-any): uncomment this when we can cast NSSet to Set<AnyHashable>.
936936
extension NSSet : _HasCustomAnyHashableRepresentation {
937+
// Must be @nonobjc to avoid infinite recursion during bridging
938+
@nonobjc
937939
public func _toCustomAnyHashable() -> AnyHashable? {
938940
var builder = _SetBuilder<Element>(count: s!.count)
939941
// FIXME(id-as-any): how to get the Hashable conformance here?

stdlib/public/SDK/Foundation/IndexPath.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@ extension IndexPath : _ObjectiveCBridgeable {
241241
}
242242

243243
extension NSIndexPath : _HasCustomAnyHashableRepresentation {
244+
// Must be @nonobjc to avoid infinite recursion during bridging.
245+
@nonobjc
244246
public func _toCustomAnyHashable() -> AnyHashable? {
245247
return AnyHashable(self as IndexPath)
246248
}

stdlib/public/SDK/Foundation/IndexSet.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,8 @@ extension IndexSet : _ObjectiveCBridgeable {
885885
}
886886

887887
extension NSIndexSet : _HasCustomAnyHashableRepresentation {
888+
// Must be @nonobjc to avoid infinite recursion during bridging.
889+
@nonobjc
888890
public func _toCustomAnyHashable() -> AnyHashable? {
889891
return AnyHashable(self as IndexSet)
890892
}

stdlib/public/SDK/Foundation/Locale.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,8 @@ extension Locale : _ObjectiveCBridgeable {
483483
}
484484

485485
extension NSLocale : _HasCustomAnyHashableRepresentation {
486+
// Must be @nonobjc to avoid infinite recursion during bridging.
487+
@nonobjc
486488
public func _toCustomAnyHashable() -> AnyHashable? {
487489
return AnyHashable(self as Locale)
488490
}

stdlib/public/SDK/Foundation/Measurement.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,8 @@ FIXME(id-as-any): can't write this code because of:
294294

295295
@available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
296296
extension NSMeasurement : _HasCustomAnyHashableRepresentation {
297+
// Must be @nonobjc to avoid infinite recursion during bridging.
298+
@nonobjc
297299
public func _toCustomAnyHashable() -> AnyHashable? {
298300
return AnyHashable(self as Measurement)
299301
}

stdlib/public/SDK/Foundation/Notification.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ extension Notification : _ObjectiveCBridgeable {
153153
}
154154

155155
extension NSNotification : _HasCustomAnyHashableRepresentation {
156+
// Must be @nonobjc to avoid infinite recursion during bridging.
157+
@nonobjc
156158
public func _toCustomAnyHashable() -> AnyHashable? {
157159
return AnyHashable(self as Notification)
158160
}

stdlib/public/SDK/Foundation/PersonNameComponents.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ extension PersonNameComponents : _ObjectiveCBridgeable {
138138

139139
@available(OSX 10.11, iOS 9.0, *)
140140
extension NSPersonNameComponents : _HasCustomAnyHashableRepresentation {
141+
// Must be @nonobjc to avoid infinite recursion during bridging.
142+
@nonobjc
141143
public func _toCustomAnyHashable() -> AnyHashable? {
142144
return AnyHashable(self as PersonNameComponents)
143145
}

stdlib/public/SDK/Foundation/TimeZone.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,8 @@ extension TimeZone : _ObjectiveCBridgeable {
277277
}
278278

279279
extension NSTimeZone : _HasCustomAnyHashableRepresentation {
280+
// Must be @nonobjc to avoid infinite recursion during bridging.
281+
@nonobjc
280282
public func _toCustomAnyHashable() -> AnyHashable? {
281283
return AnyHashable(self as TimeZone)
282284
}

stdlib/public/SDK/Foundation/URL.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,6 +1168,8 @@ extension URL : CustomStringConvertible, CustomDebugStringConvertible {
11681168
}
11691169

11701170
extension NSURL : _HasCustomAnyHashableRepresentation {
1171+
// Must be @nonobjc to avoid infinite recursion during bridging.
1172+
@nonobjc
11711173
public func _toCustomAnyHashable() -> AnyHashable? {
11721174
return AnyHashable(self as URL)
11731175
}

stdlib/public/SDK/Foundation/URLComponents.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,8 @@ extension URLComponents : _ObjectiveCBridgeable {
371371
}
372372

373373
extension NSURLComponents : _HasCustomAnyHashableRepresentation {
374+
// Must be @nonobjc to avoid infinite recursion during bridging.
375+
@nonobjc
374376
public func _toCustomAnyHashable() -> AnyHashable? {
375377
return AnyHashable(self as URLComponents)
376378
}
@@ -463,6 +465,8 @@ extension URLQueryItem : _ObjectiveCBridgeable {
463465

464466
@available(OSX 10.10, iOS 8.0, *)
465467
extension NSURLQueryItem : _HasCustomAnyHashableRepresentation {
468+
// Must be @nonobjc to avoid infinite recursion during bridging.
469+
@nonobjc
466470
public func _toCustomAnyHashable() -> AnyHashable? {
467471
return AnyHashable(self as URLQueryItem)
468472
}

stdlib/public/SDK/Foundation/URLRequest.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,8 @@ extension URLRequest : _ObjectiveCBridgeable {
297297
}
298298

299299
extension NSURLRequest : _HasCustomAnyHashableRepresentation {
300+
// Must be @nonobjc to avoid infinite recursion during bridging.
301+
@nonobjc
300302
public func _toCustomAnyHashable() -> AnyHashable? {
301303
return AnyHashable(self as URLRequest)
302304
}

stdlib/public/SDK/Foundation/UUID.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ extension UUID : _ObjectiveCBridgeable {
141141
}
142142

143143
extension NSUUID : _HasCustomAnyHashableRepresentation {
144+
// Must be @nonobjc to avoid infinite recursion during bridging.
145+
@nonobjc
144146
public func _toCustomAnyHashable() -> AnyHashable? {
145147
return AnyHashable(self as UUID)
146148
}

0 commit comments

Comments
 (0)