[FIR] Fix creating DefinitelyNotNullTypes

Also fix substitutions to them
This commit is contained in:
Dmitriy Novozhilov
2020-01-27 16:59:08 +03:00
parent 4303cd2fc7
commit 57a1342aac
28 changed files with 117 additions and 94 deletions
@@ -27,7 +27,7 @@ FILE fqName:<root> fileName:/implicitCastToNonNull.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public abstract fun <get-length> (): kotlin.Int declared in kotlin.CharSequence' type=kotlin.Int origin=null
$this: GET_VAR 'x: T of <root>.test2 declared in <root>.test2' type=kotlin.Any origin=null
$this: GET_VAR 'x: T of <root>.test2 declared in <root>.test2' type=T of <root>.test2 origin=null
FUN name:test3 visibility:public modality:FINAL <T> (x:kotlin.Any) returnType:kotlin.Int [inline]
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.CharSequence?]
VALUE_PARAMETER name:x index:0 type:kotlin.Any
@@ -70,4 +70,4 @@ FILE fqName:<root> fileName:/implicitCastToNonNull.kt
arg1: CONST Null type=kotlin.Nothing? value=null
then: CALL 'public abstract fun invoke (p1: S of <root>.test5): kotlin.Unit [operator] declared in kotlin.Function1' type=kotlin.Unit origin=null
$this: GET_VAR 'fn: kotlin.Function1<S of <root>.test5, kotlin.Unit> declared in <root>.test5' type=kotlin.Function1<S of <root>.test5, kotlin.Unit> origin=null
p1: GET_VAR 'x: T of <root>.test5 declared in <root>.test5' type=kotlin.Any origin=null
p1: GET_VAR 'x: T of <root>.test5 declared in <root>.test5' type=T of <root>.test5 origin=null
+30 -30
View File
@@ -11,10 +11,10 @@ FILE fqName:<root> fileName:/kt30796.kt
VALUE_PARAMETER name:value2 index:1 type:T of <root>.test
BLOCK_BODY
VAR name:x1 type:kotlin.Any [val]
BLOCK type=kotlin.Any origin=ELVIS
BLOCK type=T of <root>.test origin=ELVIS
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:T of <root>.test [val]
GET_VAR 'value: T of <root>.test declared in <root>.test' type=T of <root>.test origin=null
WHEN type=kotlin.Any origin=ELVIS
WHEN type=T of <root>.test origin=ELVIS
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'val tmp_0: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
@@ -22,20 +22,20 @@ FILE fqName:<root> fileName:/kt30796.kt
then: CONST Int type=kotlin.Int value=42
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: GET_VAR 'val tmp_0: T of <root>.test [val] declared in <root>.test' type=kotlin.Any origin=null
then: GET_VAR 'val tmp_0: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
VAR name:x2 type:kotlin.Any [val]
BLOCK type=kotlin.Any origin=ELVIS
BLOCK type=T of <root>.test origin=ELVIS
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:T of <root>.test [val]
GET_VAR 'value: T of <root>.test declared in <root>.test' type=T of <root>.test origin=null
WHEN type=kotlin.Any origin=ELVIS
WHEN type=T of <root>.test origin=ELVIS
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'val tmp_1: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
arg1: CONST Null type=kotlin.Nothing? value=null
then: BLOCK type=kotlin.Any origin=ELVIS
then: BLOCK type=T of <root>.test origin=ELVIS
VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:T of <root>.test [val]
GET_VAR 'value2: T of <root>.test declared in <root>.test' type=T of <root>.test origin=null
WHEN type=kotlin.Any origin=ELVIS
WHEN type=T of <root>.test origin=ELVIS
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'val tmp_2: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
@@ -43,12 +43,12 @@ FILE fqName:<root> fileName:/kt30796.kt
then: CONST Int type=kotlin.Int value=42
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: GET_VAR 'val tmp_2: T of <root>.test [val] declared in <root>.test' type=kotlin.Any origin=null
then: GET_VAR 'val tmp_2: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: GET_VAR 'val tmp_1: T of <root>.test [val] declared in <root>.test' type=kotlin.Any origin=null
then: GET_VAR 'val tmp_1: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
VAR name:x3 type:kotlin.Any [val]
BLOCK type=kotlin.Any origin=ELVIS
BLOCK type=T of <root>.test origin=ELVIS
VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:T of <root>.test [val]
BLOCK type=T of <root>.test origin=ELVIS
VAR IR_TEMPORARY_VARIABLE name:tmp_4 type:T of <root>.test [val]
@@ -61,8 +61,8 @@ FILE fqName:<root> fileName:/kt30796.kt
then: GET_VAR 'value2: T of <root>.test declared in <root>.test' type=T of <root>.test origin=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: GET_VAR 'val tmp_4: T of <root>.test [val] declared in <root>.test' type=kotlin.Any origin=null
WHEN type=kotlin.Any origin=ELVIS
then: GET_VAR 'val tmp_4: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
WHEN type=T of <root>.test origin=ELVIS
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'val tmp_3: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
@@ -70,9 +70,9 @@ FILE fqName:<root> fileName:/kt30796.kt
then: CONST Int type=kotlin.Int value=42
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: GET_VAR 'val tmp_3: T of <root>.test [val] declared in <root>.test' type=kotlin.Any origin=null
then: GET_VAR 'val tmp_3: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
VAR name:x4 type:kotlin.Any [val]
BLOCK type=kotlin.Any origin=ELVIS
BLOCK type=T of <root>.test origin=ELVIS
VAR IR_TEMPORARY_VARIABLE name:tmp_5 type:T of <root>.test [val]
BLOCK type=T of <root>.test origin=ELVIS
VAR IR_TEMPORARY_VARIABLE name:tmp_6 type:T of <root>.test [val]
@@ -85,8 +85,8 @@ FILE fqName:<root> fileName:/kt30796.kt
then: GET_VAR 'value2: T of <root>.test declared in <root>.test' type=T of <root>.test origin=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: GET_VAR 'val tmp_6: T of <root>.test [val] declared in <root>.test' type=kotlin.Any origin=null
WHEN type=kotlin.Any origin=ELVIS
then: GET_VAR 'val tmp_6: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
WHEN type=T of <root>.test origin=ELVIS
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'val tmp_5: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
@@ -94,7 +94,7 @@ FILE fqName:<root> fileName:/kt30796.kt
then: CONST Int type=kotlin.Int value=42
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: GET_VAR 'val tmp_5: T of <root>.test [val] declared in <root>.test' type=kotlin.Any origin=null
then: GET_VAR 'val tmp_5: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
VAR name:x5 type:kotlin.Any [val]
BLOCK type=kotlin.Int origin=ELVIS
VAR IR_TEMPORARY_VARIABLE name:tmp_7 type:kotlin.Nothing [val]
@@ -110,32 +110,32 @@ FILE fqName:<root> fileName:/kt30796.kt
if: CONST Boolean type=kotlin.Boolean value=true
then: GET_VAR 'val tmp_7: kotlin.Nothing [val] declared in <root>.test' type=kotlin.Nothing origin=null
VAR name:x6 type:kotlin.Any [val]
BLOCK type=kotlin.Any origin=ELVIS
VAR IR_TEMPORARY_VARIABLE name:tmp_8 type:kotlin.Any [val]
BLOCK type=kotlin.Any origin=ELVIS
BLOCK type=T of <root>.test origin=ELVIS
VAR IR_TEMPORARY_VARIABLE name:tmp_8 type:T of <root>.test [val]
BLOCK type=T of <root>.test origin=ELVIS
VAR IR_TEMPORARY_VARIABLE name:tmp_9 type:T of <root>.test [val]
GET_VAR 'value: T of <root>.test declared in <root>.test' type=T of <root>.test origin=null
WHEN type=kotlin.Any origin=ELVIS
WHEN type=T of <root>.test origin=ELVIS
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'val tmp_9: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
arg1: CONST Null type=kotlin.Nothing? value=null
then: CALL 'public final fun magic <T> (): T of <root>.magic declared in <root>' type=kotlin.Any origin=null
<T>: kotlin.Any
then: CALL 'public final fun magic <T> (): T of <root>.magic declared in <root>' type=T of <root>.test origin=null
<T>: T of <root>.test
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: GET_VAR 'val tmp_9: T of <root>.test [val] declared in <root>.test' type=kotlin.Any origin=null
WHEN type=kotlin.Any origin=ELVIS
then: GET_VAR 'val tmp_9: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
WHEN type=T of <root>.test origin=ELVIS
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'val tmp_8: kotlin.Any [val] declared in <root>.test' type=kotlin.Any origin=null
arg0: GET_VAR 'val tmp_8: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
arg1: CONST Null type=kotlin.Nothing? value=null
then: CONST Int type=kotlin.Int value=42
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: GET_VAR 'val tmp_8: kotlin.Any [val] declared in <root>.test' type=kotlin.Any origin=null
then: GET_VAR 'val tmp_8: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
VAR name:x7 type:kotlin.Any [val]
BLOCK type=kotlin.Any origin=ELVIS
BLOCK type=T of <root>.test origin=ELVIS
VAR IR_TEMPORARY_VARIABLE name:tmp_10 type:T of <root>.test [val]
BLOCK type=T of <root>.test origin=ELVIS
VAR IR_TEMPORARY_VARIABLE name:tmp_11 type:kotlin.Nothing [val]
@@ -150,7 +150,7 @@ FILE fqName:<root> fileName:/kt30796.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: GET_VAR 'val tmp_11: kotlin.Nothing [val] declared in <root>.test' type=kotlin.Nothing origin=null
WHEN type=kotlin.Any origin=ELVIS
WHEN type=T of <root>.test origin=ELVIS
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'val tmp_10: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null
@@ -158,4 +158,4 @@ FILE fqName:<root> fileName:/kt30796.kt
then: CONST Int type=kotlin.Int value=42
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: GET_VAR 'val tmp_10: T of <root>.test [val] declared in <root>.test' type=kotlin.Any origin=null
then: GET_VAR 'val tmp_10: T of <root>.test [val] declared in <root>.test' type=T of <root>.test origin=null