Files
kotlin-fork/backend.native/tests/codegen/inline/lateinitProperty_linkTest_lib.kt
T
Igor Chevdar 92cdf24d48 [IR] Run lowerings before the inliner on all inline functions
Since inlining is a cross-module operation (we need to know the bodies of
inline functions), all lowerings that are supposed to run before the inliner,
need to be run on all inline functions.
2020-04-13 10:20:49 +03:00

19 lines
501 B
Kotlin

/*
* Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
package a
fun IntArray.forEachNoInline(block: (Int) -> Unit) = this.forEach { block(it) }
inline fun foo(values: IntArray, crossinline block: (Int, Int, Int) -> Int): Int {
val o = object {
lateinit var s: String
var x: Int = 42
}
values.forEachNoInline {
o.x = block(o.x, o.s.length, it)
}
return o.x
}