Last active
February 16, 2016 19:18
-
-
Save bclymer/f540da5ce2984218da98 to your computer and use it in GitHub Desktop.
Kotlin RxJava Nullable Bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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