Reactivecocoa: Xcode 7.3 beta 5 miscompiles `SignalProducerType.combineLatestWith` on ARM64

Created on 4 Mar 2016  路  13Comments  路  Source: ReactiveCocoa/ReactiveCocoa

I hate to incovenience you all, but we have a bug in the 7.3 betas that causes us to miscompile the currying of Signal.combineLatestWith here:

    public func combineLatestWith<U>(otherProducer: SignalProducer<U, Error>) -> SignalProducer<(Value, U), Error> {
        return liftRight(Signal.combineLatestWith)(otherProducer)
    }

I'm investigating a fix right now. In case we don't fix it in time for 7.3 final, I recommend hand-inlining the liftRight combinator here as a workaround,

    public func combineLatestWith<U>(otherProducer: SignalProducer<U, Error>) -> SignalProducer<(Value, U), Error> {    
        return SignalProducer { observer, outerDisposable in
            self.startWithSignal { signal, disposable in
                outerDisposable.addDisposable(disposable)

                otherProducer.startWithSignal { otherSignal, otherDisposable in
                    outerDisposable.addDisposable(otherDisposable)

                    signal.combineLatestWith(otherSignal).observe(observer)
                }
            }
        }
    }

The bug on our side is rdar://problem/24960559, for reference.

bug

All 13 comments

I can't even begin to express how excited I am to see a Swift contributor open an issue, not only explaining the bug but offering a workaround :heart_eyes:

If it's not fixed by the GM we can temporarily make this change in #2684, since we'll likely need to change other things for Swift 2.2 anyway.

Thanks a lot @jckarter :smile:

I can't even begin to express how excited I am to see a Swift contributor open an issue, not only explaining the bug but offering a workaround

Yes! Thank you!!! :heart_eyes:

@jckarter Is there an issue on bugs.swift.org that we can follow as well?

Not that I know of. The radar unfortunately contains a private project I can't post publicly.

@calebd reports that this is still an issue on the final 7.3.

I'm finishing the download now. I'll make a branch with Swift 2.2 changes (probably including this _hopefully_ temporary workaround) and try to make a release by EOD today.

Confirmed, this crashes when running tests with -O. I added a workaround in #2760: 6f63eb6569772a90f0b4358acb33b93a4f8105b2.

Fixed by #2760.

Let's keep this open so that we remember to get rid of the workaround once this is fixed in Swift :)

@jckarter Any idea if this will be fixed in the 2.2.x milestone?

We'll try, at least. We're looking into it.

Looks like @eeckstein has a fix on the way: https://github.com/apple/swift/pull/1916

It seems that this is fixed by https://github.com/apple/swift/pull/1937 and Xcode 7.3.1 / Swift 2.2.1 contains the fix.

https://github.com/apple/swift/releases/tag/swift-2.2.1-RELEASE

The workarounds have been removed for Swift 3!

Was this page helpful?
0 / 5 - 0 ratings