Files
kotlin/compiler/testData/codegen/boxInline/simple/inlineCallInInlineLambda.kt
pyos 6d19eb1853 JVM_IR: sidestep defective getMethodAsmFlags when inlining lambdas
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.
2019-05-28 08:38:16 +02:00

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"
}