Files
kotlin-fork/idea/jvm-debugger/jvm-debugger-test/testData/continuation/suspendLambda.kt
T
Vladimir Ilmov 3cd0eb0fca (CoroutineDebugger) Stack printing logic extracted to the single place
for DebugMetadata and CoroutinePanel, some corner cases fixed, test
cases added.
Added:
 - external maven dependencies in test scenarios
 - comparing stack traces + variables on breakpoint
2020-04-21 09:48:10 +02:00

26 lines
497 B
Kotlin
Vendored

package continuation
fun main() {
val a = "a"
fibonacci().take(10).toList()
}
fun nextSequence(terms: Pair<Int, Int>): Pair<Int, Int> {
val terms1 = Pair(terms.second, terms.first + terms.second)
if (terms1.first == 8) {
//Breakpoint!
return terms1
} else
return terms1
}
fun fibonacci() = sequence {
var terms = Pair(0, 1)
var step = 0
while (true) {
yield(terms.first)
terms = nextSequence(terms)
step++
}
}