Skip to content

[stdlib] _BridgedStoredNSError should conform to CustomStringConvertible #24149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion stdlib/public/Darwin/Foundation/NSError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ extension _BridgedNSError where Self.RawValue: FixedWidthInteger {
/// Describes a bridged error that stores the underlying NSError, so
/// it can be queried.
public protocol _BridgedStoredNSError :
_ObjectiveCBridgeableError, CustomNSError, Hashable {
_ObjectiveCBridgeableError, CustomNSError, Hashable, CustomStringConvertible {
/// The type of an error code.
associatedtype Code: _ErrorCodeProtocol, RawRepresentable
where Code.RawValue: FixedWidthInteger
Expand All @@ -433,6 +433,12 @@ public protocol _BridgedStoredNSError :
init(_nsError error: NSError)
}

public extension _BridgedStoredNSError {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind moving the conformance here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot due to compiler error, please check swiftlang/swift-corelibs-foundation#2140 (comment)

var description: String {
return _nsError.description
}
}

/// Various helper implementations for _BridgedStoredNSError
extension _BridgedStoredNSError {
public var code: Code {
Expand Down