Skip to content

Commit b78fc1b

Browse files
committed
Foundation: Manually define hashValue witnesses for CocoaError, URLError, POSIXError and MachError
1 parent c92b1f9 commit b78fc1b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Darwin/Foundation-swiftoverlay/NSError.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,10 @@ public struct CocoaError : _BridgedStoredNSError {
568568

569569
public static var errorDomain: String { return NSCocoaErrorDomain }
570570

571+
public var hashValue: Int {
572+
return _nsError.hashValue
573+
}
574+
571575
/// The error code itself.
572576
public struct Code : RawRepresentable, Hashable, _ErrorCodeProtocol {
573577
public typealias _ErrorType = CocoaError
@@ -1795,6 +1799,10 @@ public struct URLError : _BridgedStoredNSError {
17951799

17961800
public static var errorDomain: String { return NSURLErrorDomain }
17971801

1802+
public var hashValue: Int {
1803+
return _nsError.hashValue
1804+
}
1805+
17981806
/// The error code itself.
17991807
public struct Code : RawRepresentable, Hashable, _ErrorCodeProtocol {
18001808
public typealias _ErrorType = URLError
@@ -2451,6 +2459,10 @@ public struct POSIXError : _BridgedStoredNSError {
24512459

24522460
public static var errorDomain: String { return NSPOSIXErrorDomain }
24532461

2462+
public var hashValue: Int {
2463+
return _nsError.hashValue
2464+
}
2465+
24542466
public typealias Code = POSIXErrorCode
24552467
}
24562468

@@ -2937,6 +2949,10 @@ public struct MachError : _BridgedStoredNSError {
29372949

29382950
public static var errorDomain: String { return NSMachErrorDomain }
29392951

2952+
public var hashValue: Int {
2953+
return _nsError.hashValue
2954+
}
2955+
29402956
public typealias Code = MachErrorCode
29412957
}
29422958

0 commit comments

Comments
 (0)