Skip to content

Instantly share code, notes, and snippets.

@bclymer
Last active February 16, 2016 19:18
Show Gist options
  • Save bclymer/f540da5ce2984218da98 to your computer and use it in GitHub Desktop.
Save bclymer/f540da5ce2984218da98 to your computer and use it in GitHub Desktop.
Kotlin RxJava Nullable Bug
import rx.Observable
data class TestUser(val name: String)
fun getTestUser(): Observable<TestUser> {
return Observable.just(TestUser("Brian")).flatMap { getUser() } // this compiles
}
fun getTestUser2(): Observable<TestUser> {
val observable = Observable.just(TestUser("Brian")).flatMap { getUser() }
return observable // this does not compile
}
fun getUser(): Observable<TestUser?> {
return Observable.just(null)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment