FIR2IR: Do not add implicit casts for types with different nullability

For smart casts, elvises, etc., there are no implicit casts in psi2fir
in changed test data
This commit is contained in:
Denis.Zharkov
2021-01-28 16:38:41 +03:00
parent 5c62ee4ba8
commit 1e0d9f4075
46 changed files with 106 additions and 264 deletions
@@ -22,8 +22,8 @@ fun test2() {
}
<set-x>(<set-?> = 0)
val <unary>: Int = <get-x>() /*as Int */
val <unary>: Int = <get-x>()
<set-x>(<set-?> = <unary>.inc())
<unary> /*~> Unit */
<set-x>(<set-?> = <get-x>() /*as Int */.plus(other = 1))
<set-x>(<set-?> = <get-x>().plus(other = 1))
}
@@ -48,8 +48,7 @@ FILE fqName:<root> fileName:/localDelegatedProperties.kt
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]
TYPE_OP type=kotlin.Int origin=IMPLICIT_CAST typeOperand=kotlin.Int
CALL 'local final fun <get-x> (): kotlin.Int? declared in <root>.test2' type=kotlin.Int? origin=GET_LOCAL_PROPERTY
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
@@ -57,6 +56,5 @@ FILE fqName:<root> fileName:/localDelegatedProperties.kt
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: TYPE_OP type=kotlin.Int origin=IMPLICIT_CAST typeOperand=kotlin.Int
CALL 'local final fun <get-x> (): kotlin.Int? declared in <root>.test2' type=kotlin.Int? origin=GET_LOCAL_PROPERTY
$this: CALL 'local final fun <get-x> (): kotlin.Int? declared in <root>.test2' type=kotlin.Int? origin=GET_LOCAL_PROPERTY
other: CONST Int type=kotlin.Int value=1