mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-13 08:31:31 +00:00
It uses isStaticMethod to determine whether to set ACC_STATIC, which is not correct (see PR #2341). This results in using incorrectly typed opcodes (as all arguments are shifted by 1) when modifying the inlined lambda's bytecode. For example, in the test added by this commit, these opcodes are inserted to spill the stack into locals before calling another inline function. Because getMethodAsmFlags is used by the non-IR backend (see PR #2341 again for why changing stuff might not be a good idea), the proposed solution is to ditch it completely and override generateLambdaBody in IrExpressionLambdaImpl to use FunctionCodegen's IR-based flag computation logic.
17 lines
225 B
Kotlin
Vendored
17 lines
225 B
Kotlin
Vendored
// FILE: 1.kt
|
|
|
|
package test
|
|
|
|
inline fun f(g: (Int) -> Int) = g(2)
|
|
|
|
inline fun h() = 1
|
|
|
|
// FILE: 2.kt
|
|
|
|
import test.*
|
|
|
|
fun box(): String {
|
|
val result = f { it + h() }
|
|
return if (result == 3) "OK" else "fail: $result"
|
|
}
|