Skip to content

Commit 675c2a4

Browse files
authored
Better extension conflict resolution from upstream
1 parent d08db62 commit 675c2a4

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

Foundation/NSError.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -296,23 +296,13 @@ extension CustomNSError where Self: RawRepresentable, Self.RawValue: SignedInteg
296296
public var errorCode: Int {
297297
return numericCast(self.rawValue)
298298
}
299-
300-
// conflict resolution
301-
public var _code: Int {
302-
return errorCode
303-
}
304299
}
305300

306301
extension CustomNSError where Self: RawRepresentable, Self.RawValue: UnsignedInteger {
307302
// The error code of Error with integral raw values is the raw value.
308303
public var errorCode: Int {
309304
return numericCast(self.rawValue)
310305
}
311-
312-
// conflict resolution
313-
public var _code: Int {
314-
return errorCode
315-
}
316306
}
317307

318308
public extension Error where Self : CustomNSError {
@@ -323,6 +313,16 @@ public extension Error where Self : CustomNSError {
323313
var _code: Int { return self.errorCode }
324314
}
325315

316+
public extension Error where Self: CustomNSError, Self: RawRepresentable, Self.RawValue: SignedInteger {
317+
/// Default implementation for customized NSErrors.
318+
var _code: Int { return self.errorCode }
319+
}
320+
321+
public extension Error where Self: CustomNSError, Self: RawRepresentable, Self.RawValue: UnsignedInteger {
322+
/// Default implementation for customized NSErrors.
323+
var _code: Int { return self.errorCode }
324+
}
325+
326326
public extension Error {
327327
/// Retrieve the localized description for this error.
328328
var localizedDescription: String {

0 commit comments

Comments
 (0)