Fix Swift 5 compiler #ifdefs

This commit is contained in:
Alan Zeino 2019-03-25 10:55:12 -07:00 committed by Krunoslav Zaher
parent 6f918cd22b
commit bd084821c3
5 changed files with 57 additions and 19 deletions

View File

@ -171,14 +171,14 @@ extension Bag {
}
extension BagKey: Hashable {
#if !swift(>=4.2.2)
var hashValue: Int {
return rawValue.hashValue
}
#else
#if swift(>=4.2)
func hash(into hasher: inout Hasher) {
hasher.combine(rawValue)
}
#else
var hashValue: Int {
return rawValue.hashValue
}
#endif
}

View File

@ -71,9 +71,13 @@ final class ZipSink2_<E1, E2, O: ObserverType> : ZipSink<O> {
rxFatalError("Unhandled case (Function)")
}
#if !swift(>=4.2.2)
#if swift(>=4.2)
#if !compiler(>=5.0)
return false
#endif
#else
return false
#endif
}
func run() -> Disposable {
@ -185,9 +189,13 @@ final class ZipSink3_<E1, E2, E3, O: ObserverType> : ZipSink<O> {
rxFatalError("Unhandled case (Function)")
}
#if !swift(>=4.2.2)
#if swift(>=4.2)
#if !compiler(>=5.0)
return false
#endif
#else
return false
#endif
}
func run() -> Disposable {
@ -307,9 +315,13 @@ final class ZipSink4_<E1, E2, E3, E4, O: ObserverType> : ZipSink<O> {
rxFatalError("Unhandled case (Function)")
}
#if !swift(>=4.2.2)
#if swift(>=4.2)
#if !compiler(>=5.0)
return false
#endif
#else
return false
#endif
}
func run() -> Disposable {
@ -437,9 +449,13 @@ final class ZipSink5_<E1, E2, E3, E4, E5, O: ObserverType> : ZipSink<O> {
rxFatalError("Unhandled case (Function)")
}
#if !swift(>=4.2.2)
#if swift(>=4.2)
#if !compiler(>=5.0)
return false
#endif
#else
return false
#endif
}
func run() -> Disposable {
@ -575,9 +591,13 @@ final class ZipSink6_<E1, E2, E3, E4, E5, E6, O: ObserverType> : ZipSink<O> {
rxFatalError("Unhandled case (Function)")
}
#if !swift(>=4.2.2)
#if swift(>=4.2)
#if !compiler(>=5.0)
return false
#endif
#else
return false
#endif
}
func run() -> Disposable {
@ -721,9 +741,13 @@ final class ZipSink7_<E1, E2, E3, E4, E5, E6, E7, O: ObserverType> : ZipSink<O>
rxFatalError("Unhandled case (Function)")
}
#if !swift(>=4.2.2)
#if swift(>=4.2)
#if !compiler(>=5.0)
return false
#endif
#else
return false
#endif
}
func run() -> Disposable {
@ -875,9 +899,13 @@ final class ZipSink8_<E1, E2, E3, E4, E5, E6, E7, E8, O: ObserverType> : ZipSink
rxFatalError("Unhandled case (Function)")
}
#if !swift(>=4.2.2)
#if swift(>=4.2)
#if !compiler(>=5.0)
return false
#endif
#else
return false
#endif
}
func run() -> Disposable {

View File

@ -71,9 +71,13 @@ final class ZipSink<%= i %>_<<%= (Array(1...i).map { "E\($0)" }).joined(separato
rxFatalError("Unhandled case \(index)")
}
#if !swift(>=4.2.2)
#if swift(>=4.2)
#if !compiler(>=5.0)
return false
#endif
#else
return false
#endif
}
func run() -> Disposable {

View File

@ -38,15 +38,15 @@ extension Subscription
: Hashable
, Equatable {
/// The hash value.
#if !swift(>=4.2.2)
public var hashValue: Int {
return self.subscribe.hashValue ^ self.unsubscribe.hashValue
}
#else
#if swift(>=4.2)
public func hash(into hasher: inout Hasher) {
hasher.combine(self.subscribe)
hasher.combine(self.unsubscribe)
}
#else
public var hashValue: Int {
return self.subscribe.hashValue ^ self.unsubscribe.hashValue
}
#endif
}

View File

@ -558,7 +558,13 @@ extension CompletableTest {
}
}
#if !swift(>=4.2.2)
#if swift(>=4.2)
#if !compiler(>=5.0)
extension Never: Equatable {
}
#endif
#else
extension Never: Equatable {
}