Short description of the issue:
Calling the distinctUntilChanged() method on any observable sequence with an optional value will cause a compiler error complaining about ambiguous methods.
Expected outcome:
That the code compiles.
What actually happens:
Code does not compile, and yields error:
Ambiguous use of 'distinctUntilChanged()'
Self contained code example that reproduces the issue:
let stringObservable: Observable<String?> = Observable<String?>.from(optional: nil)
stringObservable.distinctUntilChanged()
RxSwift/RxCocoa/RxBlocking/RxTest version/commit
RxSwift 4.1.2
Platform/Environment
How easy is to reproduce? (chances of successful reproduce after running the self contained code)
Xcode version:
Xcode 9.3 release version
Current workaround is to use:
.distinctUntilChanged({ $0 == $1 })
Proposed fix in RxSwift:
Conditional compilation for older swift versions than 4.1 for distinctUntilChanged() definition in Driver+Optional.swift and Observable+Optional.swift
@Nailer we don't have Driver+Optional.swift and Observable+Optional.swift files here.
Those seem to be part of RxOptional, not RxSwift after all. And it was fixed, but not tagged.
My mistake! I didn't check this before submitting.
Closing the issue since it's fixed in RxOptional
Most helpful comment
Current workaround is to use:
.distinctUntilChanged({ $0 == $1 })Proposed fix in RxSwift:
Conditional compilation for older swift versions than 4.1 for distinctUntilChanged() definition in Driver+Optional.swift and Observable+Optional.swift