Publishers.CombineLatest bug involving double Optionals

I think I found a bug in Combine.

Consider the following code:

import Combine

class Main {
    @Published var doubleOptional: String??
    var subscriptions: Set<AnyCancellable> = []
    init() {
            .sink { print("value from direct sink: \(String(describing: $0))") }
            .store(in: &subscriptions)
            .sink { print("value after combine latest: \(String(describing: $0.0))") }
            .store(in: &subscriptions)

let main: Main = .init()

Output is

value from direct sink: nil
value after combine latest: Optional(nil)

when I think it should give the same value (nil).

Terms of Service

Privacy Policy

Cookie Policy