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
This commit is contained in:
Mikhael Bogdanov
2017-04-07 11:47:18 +02:00
parent f3e2abfd5f
commit b51cb9a911
6 changed files with 81 additions and 0 deletions
@@ -0,0 +1,26 @@
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"
}