Files
kotlin-fork/compiler/testData/codegen/box/closures/capturedVarsOptimization/kt17200.kt
T
Mikhael Bogdanov b51cb9a911 Delete clean reference instructions on dereferencing captured variables
Codegen generates clean instructions for ref values (captured vars)
on block exit so we should delete them on dereferencing captured values.

  #KT-17200 FIXED
2017-04-10 16:35:03 +05:00

26 lines
356 B
Kotlin
Vendored

inline fun inlineCall(action: () -> Unit) {
action()
}
fun test() {
var width = 1
inlineCall {
width += width
}
}
fun test2() {
var width = 1L
val newValue = 1;
val newValue2 = "123";
val newValue3 = 2.0;
inlineCall {
width += width
}
}
fun box(): String {
test()
test2()
return "OK"
}