@@ -344,18 +344,34 @@ public protocol _BridgedStoredNSError :
344
344
345
345
/// Various helper implementations for _BridgedStoredNSError
346
346
public extension _BridgedStoredNSError
347
- where Code: RawRepresentable , Code. RawValue == Int {
348
- // FIXME: Generalize based on the Integer protocol once SE-0104 is
349
- // implemented.
347
+ where Code: RawRepresentable , Code. RawValue: SignedInteger {
348
+ // FIXME: Generalize to Integer.
350
349
public var code : Code {
351
- return Code ( rawValue: _nsError. code) !
350
+ return Code ( rawValue: numericCast ( _nsError. code) ) !
352
351
}
353
352
354
353
/// Initialize an error within this domain with the given ``code``
355
354
/// and ``userInfo``.
356
355
public init ( _ code: Code , userInfo: [ String : AnyObject ] = [ : ] ) {
357
356
self . init ( _nsError: NSError ( domain: Self . _nsErrorDomain,
358
- code: code. rawValue,
357
+ code: numericCast ( code. rawValue) ,
358
+ userInfo: userInfo) )
359
+ }
360
+ }
361
+
362
+ /// Various helper implementations for _BridgedStoredNSError
363
+ public extension _BridgedStoredNSError
364
+ where Code: RawRepresentable , Code. RawValue: UnsignedInteger {
365
+ // FIXME: Generalize to Integer.
366
+ public var code : Code {
367
+ return Code ( rawValue: numericCast ( _nsError. code) ) !
368
+ }
369
+
370
+ /// Initialize an error within this domain with the given ``code``
371
+ /// and ``userInfo``.
372
+ public init ( _ code: Code , userInfo: [ String : AnyObject ] = [ : ] ) {
373
+ self . init ( _nsError: NSError ( domain: Self . _nsErrorDomain,
374
+ code: numericCast ( code. rawValue) ,
359
375
userInfo: userInfo) )
360
376
}
361
377
}
0 commit comments