FE: properly clear the deferred generator stack

Before this commit the stack wasn't cleared for read variable case.
#KT-47168 Fixed
This commit is contained in:
pyos
2021-06-09 11:36:25 +02:00
committed by teamcityserver
parent 2f632ada42
commit 1f9db7cf25
9 changed files with 60 additions and 7 deletions
+16
View File
@@ -0,0 +1,16 @@
// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts
// IGNORE_BACKEND: NATIVE
import kotlin.contracts.*
inline fun foo(x: () -> String, y: () -> String): String {
contract {
callsInPlace(x, InvocationKind.EXACTLY_ONCE)
callsInPlace(y, InvocationKind.EXACTLY_ONCE)
}
return x() + y()
}
fun box(): String {
val y = { "K" }
return foo({ "O" }, y)
}