FIR: Fix codegen test data after safe-call refactoring

^KT-38444 In Progress
This commit is contained in:
Denis Zharkov
2020-06-01 16:02:41 +03:00
parent 080565e482
commit 409e90e7de
10 changed files with 74 additions and 48 deletions
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun f(a : Int?, b : Int.(Int)->Int) = a?.b(1)
fun box(): String {
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class Bar {
}
@@ -1,5 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
interface Base
class Derived: Base
class Another: Base
@@ -15,8 +15,7 @@ FILE fqName:<root> fileName:/localDelegatedProperties.kt
SET_VAR 'var x: IrErrorType [var] declared in <root>.test2' type=kotlin.Unit origin=EQ
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
TYPE_OP type=IrErrorType origin=IMPLICIT_CAST typeOperand=IrErrorType
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
SET_VAR 'var x: IrErrorType [var] declared in <root>.test2' type=kotlin.Unit origin=EQ
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
@@ -141,13 +141,11 @@ FILE fqName:<root> fileName:/caoWithAdaptationForSam.kt
GET_VAR 'fn: kotlin.Function1<kotlin.Int, kotlin.Unit> declared in <root>.test4' type=kotlin.Function1<kotlin.Int, kotlin.Unit> origin=null
CALL 'public final fun set (i: <root>.IFoo, newValue: kotlin.Int): kotlin.Unit [operator] declared in <root>' type=kotlin.Unit origin=null
$receiver: GET_VAR 'val tmp_2: <root>.A [val] declared in <root>.test4' type=<root>.A origin=null
i: TYPE_OP type=kotlin.Function1<kotlin.Int, kotlin.Unit> origin=IMPLICIT_CAST typeOperand=kotlin.Function1<kotlin.Int, kotlin.Unit>
GET_VAR 'val tmp_3: <root>.IFoo [val] declared in <root>.test4' type=<root>.IFoo origin=null
i: GET_VAR 'val tmp_3: <root>.IFoo [val] declared in <root>.test4' type=<root>.IFoo origin=null
newValue: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
$this: CALL 'public final fun get (i: <root>.IFoo): kotlin.Int [operator] declared in <root>' type=kotlin.Int origin=null
$receiver: GET_VAR 'val tmp_2: <root>.A [val] declared in <root>.test4' type=<root>.A origin=null
i: TYPE_OP type=kotlin.Function1<kotlin.Int, kotlin.Unit> origin=IMPLICIT_CAST typeOperand=kotlin.Function1<kotlin.Int, kotlin.Unit>
GET_VAR 'val tmp_3: <root>.IFoo [val] declared in <root>.test4' type=<root>.IFoo origin=null
i: GET_VAR 'val tmp_3: <root>.IFoo [val] declared in <root>.test4' type=<root>.IFoo origin=null
other: CONST Int type=kotlin.Int value=1
FUN name:test5 visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:kotlin.Any
@@ -1,13 +1,13 @@
FILE fqName:<root> fileName:/extFunSafeInvoke.kt
FUN name:test visibility:public modality:FINAL <> (receiver:kotlin.Any?, fn:kotlin.Function3<kotlin.Any, kotlin.Int, kotlin.String, kotlin.Unit>) returnType:IrErrorType
FUN name:test visibility:public modality:FINAL <> (receiver:kotlin.Any?, fn:kotlin.Function3<kotlin.Any, kotlin.Int, kotlin.String, kotlin.Unit>) returnType:kotlin.Unit?
VALUE_PARAMETER name:receiver index:0 type:kotlin.Any?
VALUE_PARAMETER name:fn index:1 type:kotlin.Function3<kotlin.Any, kotlin.Int, kotlin.String, kotlin.Unit>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test (receiver: kotlin.Any?, fn: kotlin.Function3<kotlin.Any, kotlin.Int, kotlin.String, kotlin.Unit>): IrErrorType declared in <root>'
BLOCK type=IrErrorType origin=SAFE_CALL
RETURN type=kotlin.Nothing from='public final fun test (receiver: kotlin.Any?, fn: kotlin.Function3<kotlin.Any, kotlin.Int, kotlin.String, kotlin.Unit>): kotlin.Unit? declared in <root>'
BLOCK type=kotlin.Unit? origin=SAFE_CALL
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Any? [val]
GET_VAR 'receiver: kotlin.Any? declared in <root>.test' type=kotlin.Any? origin=null
WHEN type=IrErrorType origin=null
WHEN type=kotlin.Unit? origin=null
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: kotlin.Any? [val] declared in <root>.test' type=kotlin.Any? origin=null
@@ -15,6 +15,8 @@ FILE fqName:<root> fileName:/extFunSafeInvoke.kt
then: CONST Null type=kotlin.Nothing? value=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [kotlin/Function3.invoke]>#' type=IrErrorType
CONST Int type=kotlin.Int value=42
CONST String type=kotlin.String value="Hello"
then: CALL 'public abstract fun invoke (p1: P1 of kotlin.Function3, p2: P2 of kotlin.Function3, p3: P3 of kotlin.Function3): R of kotlin.Function3 [operator] declared in kotlin.Function3' type=kotlin.Unit origin=INVOKE
$this: GET_VAR 'fn: kotlin.Function3<kotlin.Any, kotlin.Int, kotlin.String, kotlin.Unit> declared in <root>.test' type=kotlin.Function3<kotlin.Any, kotlin.Int, kotlin.String, kotlin.Unit> origin=null
p1: GET_VAR 'val tmp_0: kotlin.Any? [val] declared in <root>.test' type=kotlin.Any? origin=null
p2: CONST Int type=kotlin.Int value=42
p3: CONST String type=kotlin.String value="Hello"
@@ -41,6 +41,17 @@ FILE fqName:<root> fileName:/safeAssignment.kt
FUN name:test visibility:public modality:FINAL <> (nc:<root>.C?) returnType:kotlin.Unit
VALUE_PARAMETER name:nc index:0 type:<root>.C?
BLOCK_BODY
CALL 'public final fun <set-x> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>.C' type=kotlin.Unit origin=EQ
$this: GET_VAR 'nc: <root>.C? declared in <root>.test' type=<root>.C? origin=null
<set-?>: CONST Int type=kotlin.Int value=42
BLOCK type=kotlin.Unit? origin=SAFE_CALL
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:<root>.C? [val]
GET_VAR 'nc: <root>.C? declared in <root>.test' type=<root>.C? origin=null
WHEN type=kotlin.Unit? origin=null
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: <root>.C? [val] declared in <root>.test' type=<root>.C? origin=null
arg1: CONST Null type=kotlin.Nothing? value=null
then: CONST Null type=kotlin.Nothing? value=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun <set-x> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>.C' type=kotlin.Unit origin=EQ
$this: GET_VAR 'val tmp_0: <root>.C? [val] declared in <root>.test' type=<root>.C? origin=null
<set-?>: CONST Int type=kotlin.Int value=42
@@ -75,45 +75,56 @@ FILE fqName:test fileName:/safeCallWithIncrementDecrement.kt
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun <get-p> (): kotlin.Int declared in test' type=kotlin.Int origin=GET_PROPERTY
$receiver: GET_VAR 'val tmp_2: test.C? [val] declared in test.testProperty' type=test.C? origin=null
CALL 'public final fun <set-p> (value: kotlin.Int): kotlin.Unit declared in test' type=kotlin.Unit origin=EQ
$receiver: GET_VAR 'nc: test.C? declared in test.testProperty' type=test.C? origin=null
value: CALL 'public final fun inc (): kotlin.Int? [operator] declared in test' type=kotlin.Int? origin=null
$receiver: GET_VAR 'val tmp_1: kotlin.Int? [val] declared in test.testProperty' type=kotlin.Int? origin=null
BLOCK type=kotlin.Unit? origin=SAFE_CALL
VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:test.C? [val]
GET_VAR 'nc: test.C? declared in test.testProperty' type=test.C? origin=null
WHEN type=kotlin.Unit? origin=null
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: test.C? [val] declared in test.testProperty' type=test.C? origin=null
arg1: CONST Null type=kotlin.Nothing? value=null
then: CONST Null type=kotlin.Nothing? value=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun <set-p> (value: kotlin.Int): kotlin.Unit declared in test' type=kotlin.Unit origin=EQ
$receiver: GET_VAR 'val tmp_3: test.C? [val] declared in test.testProperty' type=test.C? origin=null
value: CALL 'public final fun inc (): kotlin.Int? [operator] declared in test' type=kotlin.Int? origin=null
$receiver: GET_VAR 'val tmp_1: kotlin.Int? [val] declared in test.testProperty' type=kotlin.Int? origin=null
GET_VAR 'val tmp_1: kotlin.Int? [val] declared in test.testProperty' type=kotlin.Int? origin=null
FUN name:testArrayAccess visibility:public modality:FINAL <> (nc:test.C?) returnType:kotlin.Unit
VALUE_PARAMETER name:nc index:0 type:test.C?
BLOCK_BODY
VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:kotlin.Int [val]
VAR IR_TEMPORARY_VARIABLE name:tmp_4 type:kotlin.Int [val]
CALL 'public final fun get (index: kotlin.Int): kotlin.Int [operator] declared in test' type=kotlin.Int origin=null
$receiver: BLOCK type=kotlin.Int? origin=SAFE_CALL
VAR IR_TEMPORARY_VARIABLE name:tmp_4 type:test.C? [val]
VAR IR_TEMPORARY_VARIABLE name:tmp_5 type:test.C? [val]
GET_VAR 'nc: test.C? declared in test.testArrayAccess' type=test.C? origin=null
WHEN type=kotlin.Int? origin=null
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_4: test.C? [val] declared in test.testArrayAccess' type=test.C? origin=null
arg0: GET_VAR 'val tmp_5: test.C? [val] declared in test.testArrayAccess' type=test.C? origin=null
arg1: CONST Null type=kotlin.Nothing? value=null
then: CONST Null type=kotlin.Nothing? value=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun <get-p> (): kotlin.Int declared in test' type=kotlin.Int origin=GET_PROPERTY
$receiver: GET_VAR 'val tmp_4: test.C? [val] declared in test.testArrayAccess' type=test.C? origin=null
$receiver: GET_VAR 'val tmp_5: test.C? [val] declared in test.testArrayAccess' type=test.C? origin=null
index: CONST Int type=kotlin.Int value=0
CALL 'public final fun set (index: kotlin.Int, value: kotlin.Int): kotlin.Unit [operator] declared in test' type=kotlin.Unit origin=null
$receiver: BLOCK type=kotlin.Int? origin=SAFE_CALL
VAR IR_TEMPORARY_VARIABLE name:tmp_5 type:test.C? [val]
VAR IR_TEMPORARY_VARIABLE name:tmp_6 type:test.C? [val]
GET_VAR 'nc: test.C? declared in test.testArrayAccess' type=test.C? origin=null
WHEN type=kotlin.Int? origin=null
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: test.C? [val] declared in test.testArrayAccess' type=test.C? origin=null
arg0: GET_VAR 'val tmp_6: test.C? [val] declared in test.testArrayAccess' type=test.C? origin=null
arg1: CONST Null type=kotlin.Nothing? value=null
then: CONST Null type=kotlin.Nothing? value=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun <get-p> (): kotlin.Int declared in test' type=kotlin.Int origin=GET_PROPERTY
$receiver: GET_VAR 'val tmp_5: test.C? [val] declared in test.testArrayAccess' type=test.C? origin=null
$receiver: GET_VAR 'val tmp_6: test.C? [val] declared in test.testArrayAccess' type=test.C? origin=null
index: CONST Int type=kotlin.Int value=0
value: CALL 'public final fun inc (): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
$this: GET_VAR 'val tmp_3: kotlin.Int [val] declared in test.testArrayAccess' type=kotlin.Int origin=null
GET_VAR 'val tmp_3: kotlin.Int [val] declared in test.testArrayAccess' type=kotlin.Int origin=null
$this: GET_VAR 'val tmp_4: kotlin.Int [val] declared in test.testArrayAccess' type=kotlin.Int origin=null
GET_VAR 'val tmp_4: kotlin.Int [val] declared in test.testArrayAccess' type=kotlin.Int origin=null
+22 -11
View File
@@ -116,28 +116,39 @@ FILE fqName:<root> fileName:/safeCalls.kt
FUN name:test4 visibility:public modality:FINAL <> (x:<root>.Ref?) returnType:kotlin.Unit
VALUE_PARAMETER name:x index:0 type:<root>.Ref?
BLOCK_BODY
CALL 'public final fun <set-value> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>.Ref' type=kotlin.Unit origin=EQ
$this: GET_VAR 'x: <root>.Ref? declared in <root>.test4' type=<root>.Ref? origin=null
<set-?>: CONST Int type=kotlin.Int value=0
BLOCK type=kotlin.Unit? origin=SAFE_CALL
VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:<root>.Ref? [val]
GET_VAR 'x: <root>.Ref? declared in <root>.test4' type=<root>.Ref? origin=null
WHEN type=kotlin.Unit? origin=null
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: <root>.Ref? [val] declared in <root>.test4' type=<root>.Ref? origin=null
arg1: CONST Null type=kotlin.Nothing? value=null
then: CONST Null type=kotlin.Nothing? value=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun <set-value> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>.Ref' type=kotlin.Unit origin=EQ
$this: GET_VAR 'val tmp_3: <root>.Ref? [val] declared in <root>.test4' type=<root>.Ref? origin=null
<set-?>: CONST Int type=kotlin.Int value=0
FUN name:test5 visibility:public modality:FINAL <> ($receiver:<root>.IHost, s:kotlin.String?) returnType:kotlin.Int?
$receiver: VALUE_PARAMETER name:<this> type:<root>.IHost
VALUE_PARAMETER name:s index:0 type:kotlin.String?
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test5 (s: kotlin.String?): kotlin.Int? declared in <root>'
BLOCK type=kotlin.Int? origin=SAFE_CALL
VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:kotlin.String? [val]
VAR IR_TEMPORARY_VARIABLE name:tmp_4 type:kotlin.String? [val]
GET_VAR 's: kotlin.String? declared in <root>.test5' type=kotlin.String? origin=null
WHEN type=kotlin.Int? origin=null
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: kotlin.String? [val] declared in <root>.test5' type=kotlin.String? origin=null
arg0: GET_VAR 'val tmp_4: kotlin.String? [val] declared in <root>.test5' type=kotlin.String? origin=null
arg1: CONST Null type=kotlin.Nothing? value=null
then: CONST Null type=kotlin.Nothing? value=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public open fun extLength (): kotlin.Int declared in <root>.IHost' type=kotlin.Int origin=null
$this: GET_VAR '<this>: <root>.IHost declared in <root>.test5' type=<root>.IHost origin=null
$receiver: GET_VAR 'val tmp_3: kotlin.String? [val] declared in <root>.test5' type=kotlin.String? origin=null
$receiver: GET_VAR 'val tmp_4: kotlin.String? [val] declared in <root>.test5' type=kotlin.String? origin=null
FUN name:foo visibility:public modality:FINAL <> ($receiver:kotlin.Int) returnType:kotlin.Int
$receiver: VALUE_PARAMETER name:<this> type:kotlin.Int
BLOCK_BODY
@@ -145,16 +156,16 @@ FILE fqName:<root> fileName:/safeCalls.kt
CONST Int type=kotlin.Int value=239
FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
BLOCK type=kotlin.Int? origin=SAFE_CALL
VAR IR_TEMPORARY_VARIABLE name:tmp_4 type:kotlin.Int [val]
BLOCK type=kotlin.Int origin=SAFE_CALL
VAR IR_TEMPORARY_VARIABLE name:tmp_5 type:kotlin.Int [val]
CONST Int type=kotlin.Int value=42
WHEN type=kotlin.Int? origin=null
WHEN type=kotlin.Int origin=null
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_4: kotlin.Int [val] declared in <root>.box' type=kotlin.Int origin=null
arg0: GET_VAR 'val tmp_5: kotlin.Int [val] declared in <root>.box' type=kotlin.Int origin=null
arg1: CONST Null type=kotlin.Nothing? value=null
then: CONST Null type=kotlin.Nothing? value=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun foo (): kotlin.Int declared in <root>' type=kotlin.Int origin=null
$receiver: GET_VAR 'val tmp_4: kotlin.Int [val] declared in <root>.box' type=kotlin.Int origin=null
$receiver: GET_VAR 'val tmp_5: kotlin.Int [val] declared in <root>.box' type=kotlin.Int origin=null
@@ -53,9 +53,7 @@ FILE fqName:<root> fileName:/smartCastsWithDestructuring.kt
GET_VAR 'x: <root>.I1 declared in <root>.test' type=<root>.I1 origin=null
VAR name:c1 type:kotlin.Int [val]
CALL 'public final fun component1 (): kotlin.Int [operator] declared in <root>' type=kotlin.Int origin=null
$receiver: TYPE_OP type=<root>.I1 origin=IMPLICIT_CAST typeOperand=<root>.I1
GET_VAR 'val tmp_0: <root>.I2 [val] declared in <root>.test' type=<root>.I2 origin=null
$receiver: GET_VAR 'val tmp_0: <root>.I2 [val] declared in <root>.test' type=<root>.I2 origin=null
VAR name:c2 type:kotlin.String [val]
CALL 'public final fun component2 (): kotlin.String [operator] declared in <root>' type=kotlin.String origin=null
$receiver: TYPE_OP type=<root>.I1 origin=IMPLICIT_CAST typeOperand=<root>.I1
GET_VAR 'val tmp_0: <root>.I2 [val] declared in <root>.test' type=<root>.I2 origin=null
$receiver: GET_VAR 'val tmp_0: <root>.I2 [val] declared in <root>.test' type=<root>.I2 origin=null