Files
kotlin-fork/compiler/testData/codegen/box/inlineClasses/functionExpression.kt
T
Alexander Udalov d124239025 JVM IR: do not attempt to mangle function expressions
For some reasons, lambdas and function expressions are represented
slightly differently in psi2ir. Lambdas are translated to a block with a
function of origin LOCAL_FUNCTION_FOR_LAMBDA and name "<anonymous>", but
function expressions are translated to a block with DEFINED function
"<no name provided>".

Tweak the condition for detecting local functions a bit, to avoid
similar situation in the future if we add some other origins for local
functions.

 #KT-48207 Fixed
2021-08-12 13:50:23 +02:00

7 lines
154 B
Kotlin
Vendored

inline fun new(init: (Z) -> Unit): Z = Z(42)
inline class Z(val value: Int)
fun box(): String =
if (new(fun(z: Z) {}).value == 42) "OK" else "Fail"