<@U3LJPAECC> To give an explanation: SAM conversio...
# random
k
@sliskicode To give an explanation: SAM conversion has two parts: 1) synthetic constructors for SAMs. Example:
val function = BiFunction { it: String, it2: String -> "$it $it2" }
2) synthetic overloads for functions taking SAM types that accept function types. Example:
File.list(FilenameFilter)
gets a synthetic overload
File.list((File, String) -> Boolean)
The limitation with case 2) is that only one overload is generated for each signature where every SAM type is replaced with the respective function type. Now, the function
Observable.combineLatest
has the signature
Copy code
Observable#combineLatest(ObservableSource<? extends T1>, ObservableSource<? extends T2>, BiFunction<? super T1,? super T2,? extends R>)
As it turns out,
ObservableSource
is a SAM type itself (
Observable
implements it) and the synthetic overload that is generated is
Copy code
Observable#combineLatest((Observer<in T1>) -> Unit, (Observer<in T2>) -> Unit, (T1, T2) -> R)
Unfortunately, this is not the signature you're looking for. What you need is a signature where the first two parameters are not SAM converted, but the third is. This is currently not supported
👍 11