[box-tests] Added a couple of reproducers for KT-52795

This commit is contained in:
Igor Chevdar
2022-07-20 14:54:40 +03:00
committed by Space
parent 412f07c55b
commit 8981eb85de
16 changed files with 220 additions and 0 deletions
@@ -0,0 +1,20 @@
// NO_CHECK_LAMBDA_INLINING
// FILE: 1.kt
inline fun <T> mrun(block: () -> T) = block()
// FILE: 2.kt
fun bar(o: String): String {
val callable = mrun {
fun localAnonymousFun(k: String): String {
val obj = object {
fun foo() = o + k
}
return obj.foo()
}
::localAnonymousFun
}
return callable("K")
}
fun box() = bar("O")
@@ -0,0 +1,34 @@
// NO_CHECK_LAMBDA_INLINING
// IGNORE_BACKEND: JVM, WASM
// IGNORE_BACKEND_MULTI_MODULE: JVM, JVM_MULTI_MODULE_OLD_AGAINST_IR
import kotlin.IllegalStateException
// FILE: 1.kt
inline fun <T> mrun(block: () -> T) = block()
inline fun <T> mrunTwice(block: () -> T) : T {
val first = block()
val second = block()
if (first!!::class != second!!::class)
throw IllegalStateException("${first!!::class} != ${second!!::class}")
return first
}
// FILE: 2.kt
fun bar(o: String): String {
val callable = mrun {
fun localAnonymousFun(k: String): String {
fun localAnonymousFunLevel2() = mrunTwice {
object {
fun foo() = o + k
}
}
return localAnonymousFunLevel2().foo()
}
::localAnonymousFun
}
return callable("K")
}
fun box() = bar("O")