[Test] Add test for KT-35314

This commit is contained in:
Dmitriy Novozhilov
2023-07-04 09:55:54 +03:00
committed by Space Team
parent 5d6328a706
commit 38533977f0
7 changed files with 61 additions and 0 deletions
@@ -0,0 +1 @@
java.lang.StackOverflowError
@@ -0,0 +1,30 @@
// FIR_IDENTICAL
// ISSUE: KT-35314
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract
class Foo {
fun bar() {
try {
myLet {
if (false) {
return
}
}
} finally {
try {
} finally {
}
}
}
}
@OptIn(ExperimentalContracts::class)
inline fun myLet(block: () -> Unit) {
contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
}
return block()
}