Skip to content

Commit

Permalink
Reimplement Zip to fix reference crash issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle-Ye committed Dec 20, 2023
1 parent 0cd6e02 commit 3cc1601
Show file tree
Hide file tree
Showing 4 changed files with 608 additions and 617 deletions.
49 changes: 0 additions & 49 deletions RemainingCombineInterface.swift
Original file line number Diff line number Diff line change
Expand Up @@ -901,52 +901,3 @@ extension Publishers.MergeMany : Equatable where Upstream : Equatable {
/// - rhs: Another value to compare.
public static func == (lhs: Publishers.MergeMany<Upstream>, rhs: Publishers.MergeMany<Upstream>) -> Bool
}

extension Publishers.Zip : Equatable where A : Equatable, B : Equatable {

/// Returns a Boolean value that indicates whether two publishers are equivalent.
///
/// - Parameters:
/// - lhs: A zip publisher to compare for equality.
/// - rhs: Another zip publisher to compare for equality.
/// - Returns: `true` if the corresponding upstream publishers of each zip publisher are equal, `false` otherwise.
public static func == (lhs: Publishers.Zip<A, B>, rhs: Publishers.Zip<A, B>) -> Bool
}

/// Returns a Boolean value that indicates whether two publishers are equivalent.
///
/// - Parameters:
/// - lhs: A zip publisher to compare for equality.
/// - rhs: Another zip publisher to compare for equality.
/// - Returns: `true` if the corresponding upstream publishers of each zip publisher are equal, `false` otherwise.
extension Publishers.Zip3 : Equatable where A : Equatable, B : Equatable, C : Equatable {

/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (lhs: Publishers.Zip3<A, B, C>, rhs: Publishers.Zip3<A, B, C>) -> Bool
}

/// Returns a Boolean value that indicates whether two publishers are equivalent.
///
/// - Parameters:
/// - lhs: A zip publisher to compare for equality.
/// - rhs: Another zip publisher to compare for equality.
/// - Returns: `true` if the corresponding upstream publishers of each zip publisher are equal, `false` otherwise.
extension Publishers.Zip4 : Equatable where A : Equatable, B : Equatable, C : Equatable, D : Equatable {

/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (lhs: Publishers.Zip4<A, B, C, D>, rhs: Publishers.Zip4<A, B, C, D>) -> Bool
}
6 changes: 6 additions & 0 deletions Sources/OpenCombine/Helpers/Violations.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,10 @@ extension Subscribers.Demand {
precondition(rawValue <= Subscribers.Demand.unlimited.rawValue)
precondition(rawValue > Subscribers.Demand.none.rawValue)
}

@_transparent
@inline(__always)
internal func assertValid() {
precondition(rawValue <= Subscribers.Demand.unlimited.rawValue)
}
}
Loading

0 comments on commit 3cc1601

Please sign in to comment.