Put default value (null or zero) to slot for uninitialized values

This way range of the variable is correct in LVT.
 #KT-24672 Fixed
This commit is contained in:
Ilmir Usmanov
2018-12-26 17:56:44 +03:00
parent 8ab9226805
commit a52f430d8f
14 changed files with 360 additions and 0 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 {
val c: Char
doIt {
c = ' '
}
return c
}
@ExperimentalContracts
fun doIt(block: () -> Unit) {
contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
}
block()
}
// 2 FCONST 0
// 1 LOCALVARIABLE c Lkotlin/jvm/internal/Ref$CharRef; L1 L10 0