Put default value to vars iff they are not boxed

#KT-24672 Fixed
This commit is contained in:
Ilmir Usmanov
2019-01-14 15:47:18 +03:00
parent 62322dec5c
commit 76e9b574cd
12 changed files with 235 additions and 11 deletions
@@ -0,0 +1,25 @@
// IGNORE_BACKEND: JVM_IR
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract
@ExperimentalContracts
fun test(): Char {
var c: Char
doIt {
c = ' '
}
return c
}
@ExperimentalContracts
fun doIt(block: () -> Unit) {
contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
}
block()
}
// 0 ISTORE 0
// 1 LOCALVARIABLE c Lkotlin/jvm/internal/Ref\$CharRef; L1 L3 0