File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -287,7 +287,7 @@ public func _swift_Foundation_getErrorDefaultUserInfo(_ error: Error)
287
287
extension NSError : Error {
288
288
public var _domain : String { return domain }
289
289
public var _code : Int { return code }
290
- public var _userInfo : Any ? { return userInfo }
290
+ public var _userInfo : AnyObject ? { return userInfo as NSDictionary }
291
291
292
292
/// The "embedded" NSError is itself.
293
293
public func _getEmbeddedNSError( ) -> AnyObject ? {
@@ -304,8 +304,8 @@ extension CFError : Error {
304
304
return CFErrorGetCode ( self )
305
305
}
306
306
307
- public var _userInfo : Any ? {
308
- return CFErrorCopyUserInfo ( self ) as Any
307
+ public var _userInfo : AnyObject ? {
308
+ return CFErrorCopyUserInfo ( self ) as AnyObject
309
309
}
310
310
311
311
/// The "embedded" NSError is itself.
Original file line number Diff line number Diff line change @@ -113,7 +113,11 @@ import SwiftShims
113
113
public protocol Error {
114
114
var _domain : String { get }
115
115
var _code : Int { get }
116
- var _userInfo : Any ? { get }
116
+
117
+ // Note: _userInfo is always an NSDictionary, but we cannot use that type here
118
+ // because the standard library cannot depend on Foundation. However, the
119
+ // underscore implies that we control all implementations of this requirement.
120
+ var _userInfo : AnyObject ? { get }
117
121
118
122
#if _runtime(_ObjC)
119
123
func _getEmbeddedNSError( ) -> AnyObject ?
@@ -203,7 +207,7 @@ extension Error {
203
207
return String ( reflecting: type ( of: self ) )
204
208
}
205
209
206
- public var _userInfo : Any ? {
210
+ public var _userInfo : AnyObject ? {
207
211
#if _runtime(_ObjC)
208
212
return _stdlib_getErrorDefaultUserInfo ( self )
209
213
#else
You can’t perform that action at this time.
0 commit comments