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:
committed by
Alexander Udalov
parent
d94817cfb6
commit
3ffe495346
@@ -0,0 +1,10 @@
|
||||
package app
|
||||
|
||||
import lib.*
|
||||
|
||||
fun runAppAndReturnOk(): String {
|
||||
foo {
|
||||
"K"
|
||||
}
|
||||
return result
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package lib
|
||||
|
||||
var result = "fail"
|
||||
|
||||
inline fun foo(crossinline s: () -> String) {
|
||||
object {
|
||||
private inline fun test(crossinline z: () -> String) {
|
||||
result = object { //should be marked as public abi as there is no regenerated abject on inline
|
||||
fun run(): String {
|
||||
return "O"
|
||||
}
|
||||
}.run() + z()
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
test { s() }
|
||||
}
|
||||
}.foo()
|
||||
}
|
||||
@@ -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()
|
||||
}
|
||||
Reference in New Issue
Block a user