Skip to content

Commit

Permalink
[AnyError] Remove Equatable conformance
Browse files Browse the repository at this point in the history
  • Loading branch information
ikesyo committed Nov 15, 2016
1 parent fd89d0e commit 3cafe3e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 1 addition & 6 deletions Result/Result.swift
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public enum NoError: Swift.Error { }

/// A type-erased error which wraps an arbitrary error instance. This should be
/// useful for generic contexts.
public struct AnyError: Swift.Error, ErrorProtocolConvertible, Equatable, CustomStringConvertible {
public struct AnyError: Swift.Error, ErrorProtocolConvertible, CustomStringConvertible {
/// The underlying error.
public let error: Swift.Error

Expand All @@ -202,11 +202,6 @@ public struct AnyError: Swift.Error, ErrorProtocolConvertible, Equatable, Custom
return AnyError(error)
}

public static func ==(lhs: AnyError, rhs: AnyError) -> Bool {
return lhs.error._code == rhs.error._code
&& lhs.error._domain == rhs.error._domain
}

public var description: String {
return String(describing: error)
}
Expand Down
7 changes: 7 additions & 0 deletions Tests/ResultTests/ResultTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,13 @@ let failure2 = Result<String, AnyError>.failure(error2)

// MARK: - Helpers

extension AnyError: Equatable {
public static func ==(lhs: AnyError, rhs: AnyError) -> Bool {
return lhs.error._code == rhs.error._code
&& lhs.error._domain == rhs.error._domain
}
}

#if !os(Linux)

func attempt<T>(_ value: T, succeed: Bool, error: NSErrorPointer) -> T? {
Expand Down

0 comments on commit 3cafe3e

Please sign in to comment.