Deji
06/22/2021, 8:10 PMinterface Base
data class Derived(val value: String): Base
fun getDerived(): Mono<Derived> = TODO()
fun getBase(): Mono<Base> = getDerived() // this line does not compile
fun getBase2(): Mono<Base> = getDerived().map { it } // this compiles fine
I am new to kotlin so I might be missing something. But is it possible to get the 4th line to compile without mapping it again?
If this isn’t the right place to ask this please let me know the appropriate channel. Thanks!Tristan Blakers
06/23/2021, 3:55 AMjush
06/23/2021, 5:50 AMfun getBase(): Mono<Base> = getDerived() // this line does not compile
to:
fun getBase(): Mono<out Base> = getDerived()
Deji
06/23/2021, 9:00 PM