[FIR] Use type without smartcast for local variable with smartcasted initializer

This commit is contained in:
Dmitriy Novozhilov
2021-02-15 12:26:13 +03:00
parent 40e286b354
commit d4c26cca52
24 changed files with 253 additions and 159 deletions
@@ -22,7 +22,7 @@ fun test2() {
}
<set-x>(<set-?> = 0)
val <unary>: Int = <get-x>()
val <unary>: Int? = <get-x>()
<set-x>(<set-?> = <unary>.inc())
<unary> /*~> Unit */
<set-x>(<set-?> = <get-x>().plus(other = 1))
@@ -47,13 +47,13 @@ FILE fqName:<root> fileName:/localDelegatedProperties.kt
value: GET_VAR '<set-?>: kotlin.Int? declared in <root>.test2.<set-x>' type=kotlin.Int? origin=null
CALL 'local final fun <set-x> (<set-?>: kotlin.Int?): kotlin.Unit declared in <root>.test2' type=kotlin.Unit origin=EQ
<set-?>: CONST Int type=kotlin.Int value=0
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int [val]
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int? [val]
CALL 'local final fun <get-x> (): kotlin.Int? declared in <root>.test2' type=kotlin.Int? origin=GET_LOCAL_PROPERTY
CALL 'local final fun <set-x> (<set-?>: kotlin.Int?): kotlin.Unit declared in <root>.test2' type=kotlin.Unit origin=EQ
<set-?>: CALL 'public final fun inc (): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
$this: GET_VAR 'val tmp_0: kotlin.Int [val] declared in <root>.test2' type=kotlin.Int origin=null
$this: GET_VAR 'val tmp_0: kotlin.Int? [val] declared in <root>.test2' type=kotlin.Int? origin=null
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
GET_VAR 'val tmp_0: kotlin.Int [val] declared in <root>.test2' type=kotlin.Int origin=null
GET_VAR 'val tmp_0: kotlin.Int? [val] declared in <root>.test2' type=kotlin.Int? origin=null
CALL 'local final fun <set-x> (<set-?>: kotlin.Int?): kotlin.Unit declared in <root>.test2' type=kotlin.Unit origin=EQ
<set-?>: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
$this: CALL 'local final fun <get-x> (): kotlin.Int? declared in <root>.test2' type=kotlin.Int? origin=GET_LOCAL_PROPERTY