Closed Noobish1 closed 8 years ago
Thanks so much for the PR. Looks good. A few questions/remarks:
associatedtype
. Not an issue, because the 3.x version is stable and people will probably migrate to Swift 2.2 soon anyway.If you agree, can you update your PR accordingly? Thanks again!
Your comments are totally valid, i've bumped the podspec to 4.0.0-beta.1.
Btw, i'm not sure what you wanted to do with this:
extension NoError: Equatable { }
public func ==(lhs: NoError, rhs: NoError) -> Bool {
return true
}
If a type T
in the forest has no values, is T: Equatable
sound?
Hmm, that code looks strange indeed. I'm not sure, but I might have written it to be able to implement equals for BrightFuturesError<NoError>
. I think there are some tests that depend on being able to compare errors of that type.
yea that's where it's used.
I think what we should do is have another overload of == that accepts two BrightFuturesErrors<NoError>
s.
Makes sense to me, that'd be instead of the current one right?
I've removed the NoError extension and == overload and added an == overload for two BrightFuturesError
Sorry for not replying sooner. I think the implementation of the ==
overload should be different. Right now it would mean that .NoSuchElement
is equal to InvalidationTokenInvalidated
. I think it should look like this:
/// Returns `true` if `left` and `right` are both of the same case ignoring .External associated value
public func ==(lhs: BrightFuturesError<NoError>, rhs: BrightFuturesError<NoError>) -> Bool {
switch (lhs, rhs) {
case (.NoSuchElement, .NoSuchElement): return true
case (.InvalidationTokenInvalidated, .InvalidationTokenInvalidated): return true
case (.External(let lhs), .External(let rhs)): return true // this cannot happen because NoError cannot be instantiated
default: return false
}
}
Can you fix this. After that, the PR is ready for merging. Thanks again!
That makes sense, done.
Thanks so much, merged it in!
I believe this is all the necessary changes for Swift 2.2/Xcode 7.3.