JVM: rename this$0 when regenerating nested objects too
In the old backend, this was unnecessary because nested objects would reference their lambdas' captures through the original this$0. On JVM_IR, using loose capture fields means a name/descriptor clash can occur on any level of nesting, not just the top.
This commit is contained in:
+14
@@ -0,0 +1,14 @@
|
||||
// FILE: 1.kt
|
||||
package test
|
||||
|
||||
class C(val x: String) {
|
||||
fun f(y: String) = C(y).g { x }
|
||||
|
||||
inline fun g(crossinline h: () -> String) =
|
||||
{ { h() + x }() }()
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
import test.*
|
||||
|
||||
fun box() = C("O").f("K")
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
// FILE: 1.kt
|
||||
package test
|
||||
|
||||
class C(val x: String) {
|
||||
inline fun f(crossinline h: () -> String) = C("").g { x + h() }
|
||||
|
||||
inline fun g(crossinline h: () -> String) =
|
||||
{ { h() + x }() }()
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
import test.*
|
||||
|
||||
fun box() = C("O").f { "K" }
|
||||
Reference in New Issue
Block a user