https://kotlinlang.org logo
e

elizarov

12/24/2016, 3:58 PM
Here is a similar problem with
asyncGenerate
(its initial continuation is not reentrant properly). Produces stack overflow (correct behavior -- should just wait):
Copy code
class X {
    fun s(): AsyncIterator<Int> = asyncGenerate<Int> { t().next() }.iterator()
    fun t(): AsyncIterator<Int> = asyncGenerate<Int> { s().next() }.iterator()
}

fun main(args: Array<String>) {
    async { X().s().next() }.get()
}