jvm-abi-gen: Mark all anonymous objects in inline function scope as public

Anonymous objects inside of a private inline function nested in a public
inline function can still escape.
This commit is contained in:
Steven Schäfer
2021-06-29 16:43:45 +02:00
committed by Alexander Udalov
parent d94817cfb6
commit 3ffe495346
11 changed files with 115 additions and 15 deletions
@@ -0,0 +1,10 @@
package app
import lib.*
fun runAppAndReturnOk(): String {
foo {
"OK"
}
return result
}
@@ -0,0 +1 @@
// IGNORE_BACKEND_LEGACY: JVM
@@ -0,0 +1,19 @@
package lib
var result = "fail"
inline fun foo(crossinline s: () -> String) {
object {
private inline fun test(crossinline z: () -> String) {
object {
fun run() {
result = z()
}
}.run()
}
fun foo() {
test { s() } // regenerated object should be marked as public abi
}
}.foo()
}