From a973a21ec61c8ed8ad3088e38762e1cc6f8a1309 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Thu, 16 May 2019 14:24:39 +0300 Subject: [PATCH] FIR2IR: support assignments of local variables --- .../kotlin/fir/backend/Fir2IrVisitor.kt | 5 +++++ .../localDelegatedProperties.fir.txt | 10 ++++++---- .../ir/irText/expressions/assignments.fir.txt | 8 ++++++-- .../expressions/augmentedAssignment1.fir.txt | 15 ++++++++++----- .../expressions/augmentedAssignment2.fir.txt | 15 ++++++++++----- .../augmentedAssignmentWithExpression.fir.txt | 7 ++++--- .../breakContinueInLoopHeader.fir.txt | 8 ++++++-- .../complexAugmentedAssignment.fir.txt | 8 ++++++-- .../expressions/incrementDecrement.fir.txt | 16 ++++++++++++---- .../ir/irText/expressions/kt24804.fir.txt | 3 ++- .../ir/irText/expressions/kt27933.fir.txt | 6 ++++-- .../ir/irText/expressions/kt30020.fir.txt | 15 ++++++++++----- .../ir/irText/expressions/whileDoWhile.fir.txt | 16 ++++++++++++---- .../ir/irText/lambdas/localFunction.fir.txt | 4 +++- .../ir/irText/regressions/coercionInLoop.fir.txt | 4 +++- 15 files changed, 99 insertions(+), 41 deletions(-) diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt index 138bc103e63..87000c7d0cb 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt @@ -786,6 +786,11 @@ internal class Fir2IrVisitor( generateErrorCallExpression(startOffset, endOffset, calleeReference) } } + is IrVariableSymbol -> { + IrSetVariableImpl( + startOffset, endOffset, symbol.owner.type, symbol, variableAssignment.rValue.toIrExpression(), null + ) + } else -> generateErrorCallExpression(startOffset, endOffset, calleeReference) } } else { diff --git a/compiler/testData/ir/irText/declarations/localDelegatedProperties.fir.txt b/compiler/testData/ir/irText/declarations/localDelegatedProperties.fir.txt index cab86ae3afa..14ab28f1b0c 100644 --- a/compiler/testData/ir/irText/declarations/localDelegatedProperties.fir.txt +++ b/compiler/testData/ir/irText/declarations/localDelegatedProperties.fir.txt @@ -7,10 +7,12 @@ FILE fqName: fileName:/localDelegatedProperties.kt FUN name:test2 visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY VAR name:x type:IrErrorType [var] - ERROR_CALL 'Unresolved reference: R|/x|' type=IrErrorType + SET_VAR 'var x: IrErrorType [var] declared in .test2' type=IrErrorType origin=null + CONST Int type=kotlin.Int value=0 VAR name: type:IrErrorType [val] GET_VAR 'var x: IrErrorType [var] declared in .test2' type=IrErrorType origin=null - ERROR_CALL 'Unresolved reference: R|/x|' type=IrErrorType + SET_VAR 'var x: IrErrorType [var] declared in .test2' type=IrErrorType origin=null + ERROR_CALL 'Unresolved reference: #' type=IrErrorType GET_VAR 'val : IrErrorType [val] declared in .test2' type=IrErrorType origin=null - ERROR_CALL 'Unresolved reference: R|/x|' type=IrErrorType - + SET_VAR 'var x: IrErrorType [var] declared in .test2' type=IrErrorType origin=null + CONST Int type=kotlin.Int value=1 diff --git a/compiler/testData/ir/irText/expressions/assignments.fir.txt b/compiler/testData/ir/irText/expressions/assignments.fir.txt index c2814d9ffef..cbbe8fa9e00 100644 --- a/compiler/testData/ir/irText/expressions/assignments.fir.txt +++ b/compiler/testData/ir/irText/expressions/assignments.fir.txt @@ -42,8 +42,12 @@ FILE fqName: fileName:/assignments.kt BLOCK_BODY VAR name:x type:kotlin.Int [var] CONST Int type=kotlin.Int value=0 - ERROR_CALL 'Unresolved reference: R|/x|' type=IrErrorType - ERROR_CALL 'Unresolved reference: R|/x|' type=IrErrorType + SET_VAR 'var x: kotlin.Int [var] declared in .test1' type=kotlin.Int origin=null + CONST Int type=kotlin.Int value=1 + SET_VAR 'var x: kotlin.Int [var] declared in .test1' type=kotlin.Int origin=null + CALL 'public final fun plus (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + $this: GET_VAR 'var x: kotlin.Int [var] declared in .test1' type=kotlin.Int origin=null + other: CONST Int type=kotlin.Int value=1 FUN name:test2 visibility:public modality:FINAL <> (r:.Ref) returnType:kotlin.Unit VALUE_PARAMETER name:r index:0 type:.Ref BLOCK_BODY diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignment1.fir.txt b/compiler/testData/ir/irText/expressions/augmentedAssignment1.fir.txt index 78b7156edff..40646efc851 100644 --- a/compiler/testData/ir/irText/expressions/augmentedAssignment1.fir.txt +++ b/compiler/testData/ir/irText/expressions/augmentedAssignment1.fir.txt @@ -18,11 +18,16 @@ FILE fqName: fileName:/augmentedAssignment1.kt BLOCK_BODY VAR name:x type:kotlin.Int [var] CONST Int type=kotlin.Int value=0 - ERROR_CALL 'Unresolved reference: R|/x|' type=IrErrorType - ERROR_CALL 'Unresolved reference: R|/x|' type=IrErrorType - ERROR_CALL 'Unresolved reference: R|/x|' type=IrErrorType - ERROR_CALL 'Unresolved reference: R|/x|' type=IrErrorType - ERROR_CALL 'Unresolved reference: R|/x|' type=IrErrorType + SET_VAR 'var x: kotlin.Int [var] declared in .testVariable' type=kotlin.Int origin=null + CONST Int type=kotlin.Int value=1 + SET_VAR 'var x: kotlin.Int [var] declared in .testVariable' type=kotlin.Int origin=null + CONST Int type=kotlin.Int value=2 + SET_VAR 'var x: kotlin.Int [var] declared in .testVariable' type=kotlin.Int origin=null + CONST Int type=kotlin.Int value=3 + SET_VAR 'var x: kotlin.Int [var] declared in .testVariable' type=kotlin.Int origin=null + CONST Int type=kotlin.Int value=4 + SET_VAR 'var x: kotlin.Int [var] declared in .testVariable' type=kotlin.Int origin=null + CONST Int type=kotlin.Int value=5 FUN name:testProperty visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.Int visibility:public [static] ' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignment2.fir.txt b/compiler/testData/ir/irText/expressions/augmentedAssignment2.fir.txt index 0d3a3dba1b6..d6103d42ecd 100644 --- a/compiler/testData/ir/irText/expressions/augmentedAssignment2.fir.txt +++ b/compiler/testData/ir/irText/expressions/augmentedAssignment2.fir.txt @@ -46,11 +46,16 @@ FILE fqName: fileName:/augmentedAssignment2.kt BLOCK_BODY VAR name:a type:.A [val] CONSTRUCTOR_CALL 'public constructor () [primary] declared in .A' type=.A origin=null - ERROR_CALL 'Unresolved reference: R|/a|' type=IrErrorType - ERROR_CALL 'Unresolved reference: R|/a|' type=IrErrorType - ERROR_CALL 'Unresolved reference: R|/a|' type=IrErrorType - ERROR_CALL 'Unresolved reference: R|/a|' type=IrErrorType - ERROR_CALL 'Unresolved reference: R|/a|' type=IrErrorType + SET_VAR 'val a: .A [val] declared in .testVariable' type=.A origin=null + CONST String type=kotlin.String value="+=" + SET_VAR 'val a: .A [val] declared in .testVariable' type=.A origin=null + CONST String type=kotlin.String value="-=" + SET_VAR 'val a: .A [val] declared in .testVariable' type=.A origin=null + CONST String type=kotlin.String value="*=" + SET_VAR 'val a: .A [val] declared in .testVariable' type=.A origin=null + CONST String type=kotlin.String value="/=" + SET_VAR 'val a: .A [val] declared in .testVariable' type=.A origin=null + CONST String type=kotlin.String value="*=" FUN name:testProperty visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:.A visibility:public [final,static] ' type=.A origin=null diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.fir.txt b/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.fir.txt index 781c4910d3b..0dfb1edf7be 100644 --- a/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.fir.txt +++ b/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.fir.txt @@ -37,11 +37,12 @@ FILE fqName: fileName:/augmentedAssignmentWithExpression.kt BLOCK_BODY VAR name: type:.Host [val] CALL 'public final fun foo (): .Host declared in ' type=.Host origin=null - ERROR_CALL 'Unresolved reference: R|/|' type=IrErrorType + SET_VAR 'val : .Host [val] declared in .test3' type=.Host origin=null + CONST Int type=kotlin.Int value=1 FUN name:test4 visibility:public modality:FINAL <> (a:kotlin.Function0<.Host>) returnType:kotlin.Unit VALUE_PARAMETER name:a index:0 type:kotlin.Function0<.Host> BLOCK_BODY VAR name: type:IrErrorType [val] ERROR_CALL 'Unresolved reference: #' type=IrErrorType - ERROR_CALL 'Unresolved reference: R|/|' type=IrErrorType - + SET_VAR 'val : IrErrorType [val] declared in .test4' type=IrErrorType origin=null + CONST Int type=kotlin.Int value=1 diff --git a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.txt b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.txt index f1cb6cbfcfa..7f21bbb459a 100644 --- a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.txt +++ b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.txt @@ -106,7 +106,9 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt body: BLOCK type=kotlin.Unit origin=null VAR name: type:kotlin.Int [val] GET_VAR 'var i: kotlin.Int [var] declared in .test5' type=kotlin.Int origin=null - ERROR_CALL 'Unresolved reference: R|/i|' type=IrErrorType + SET_VAR 'var i: kotlin.Int [var] declared in .test5' type=kotlin.Int origin=null + CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + $this: GET_VAR 'val : kotlin.Int [val] declared in .test5' type=kotlin.Int origin=null GET_VAR 'var i: kotlin.Int [var] declared in .test5' type=kotlin.Int origin=null VAR name:j type:kotlin.Int [var] CONST Int type=kotlin.Int value=0 @@ -114,7 +116,9 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt body: BLOCK type=kotlin.Int origin=null VAR name: type:kotlin.Int [val] GET_VAR 'var j: kotlin.Int [var] declared in .test5' type=kotlin.Int origin=null - ERROR_CALL 'Unresolved reference: R|/j|' type=IrErrorType + SET_VAR 'var j: kotlin.Int [var] declared in .test5' type=kotlin.Int origin=null + CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + $this: GET_VAR 'val : kotlin.Int [val] declared in .test5' type=kotlin.Int origin=null GET_VAR 'var j: kotlin.Int [var] declared in .test5' type=kotlin.Int origin=null condition: WHEN type=kotlin.Unit origin=IF BRANCH diff --git a/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.fir.txt b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.fir.txt index a6aa69400d5..e0d43187ed8 100644 --- a/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.fir.txt +++ b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.fir.txt @@ -124,14 +124,18 @@ FILE fqName: fileName:/complexAugmentedAssignment.kt index: BLOCK type=kotlin.Int origin=null VAR name: type:kotlin.Int [val] GET_VAR 'var i: kotlin.Int [var] declared in .test1' type=kotlin.Int origin=null - ERROR_CALL 'Unresolved reference: R|/i|' type=IrErrorType + SET_VAR 'var i: kotlin.Int [var] declared in .test1' type=kotlin.Int origin=null + CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + $this: GET_VAR 'val : kotlin.Int [val] declared in .test1' type=kotlin.Int origin=null GET_VAR 'val : kotlin.Int [val] declared in .test1' type=kotlin.Int origin=null CALL 'public final fun set (index: kotlin.Int, value: kotlin.Int): kotlin.Unit declared in kotlin.IntArray' type=kotlin.Unit origin=null $this: GET_VAR 'a: kotlin.IntArray declared in .test1' type=kotlin.IntArray origin=null index: BLOCK type=kotlin.Int origin=null VAR name: type:kotlin.Int [val] GET_VAR 'var i: kotlin.Int [var] declared in .test1' type=kotlin.Int origin=null - ERROR_CALL 'Unresolved reference: R|/i|' type=IrErrorType + SET_VAR 'var i: kotlin.Int [var] declared in .test1' type=kotlin.Int origin=null + CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + $this: GET_VAR 'val : kotlin.Int [val] declared in .test1' type=kotlin.Int origin=null GET_VAR 'val : kotlin.Int [val] declared in .test1' type=kotlin.Int origin=null value: CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null $this: GET_VAR 'val : kotlin.Int [val] declared in .test1' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/expressions/incrementDecrement.fir.txt b/compiler/testData/ir/irText/expressions/incrementDecrement.fir.txt index 93dbe5d3f49..9c4cbb7381f 100644 --- a/compiler/testData/ir/irText/expressions/incrementDecrement.fir.txt +++ b/compiler/testData/ir/irText/expressions/incrementDecrement.fir.txt @@ -34,13 +34,17 @@ FILE fqName: fileName:/incrementDecrement.kt BLOCK type=kotlin.Int origin=null VAR name: type:kotlin.Int [val] GET_VAR 'var x: kotlin.Int [var] declared in .testVarPrefix' type=kotlin.Int origin=null - ERROR_CALL 'Unresolved reference: R|/x|' type=IrErrorType + SET_VAR 'var x: kotlin.Int [var] declared in .testVarPrefix' type=kotlin.Int origin=null + CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + $this: GET_VAR 'val : kotlin.Int [val] declared in .testVarPrefix' type=kotlin.Int origin=null GET_VAR 'var x: kotlin.Int [var] declared in .testVarPrefix' type=kotlin.Int origin=null VAR name:x2 type:kotlin.Int [val] BLOCK type=kotlin.Int origin=null VAR name: type:kotlin.Int [val] GET_VAR 'var x: kotlin.Int [var] declared in .testVarPrefix' type=kotlin.Int origin=null - ERROR_CALL 'Unresolved reference: R|/x|' type=IrErrorType + SET_VAR 'var x: kotlin.Int [var] declared in .testVarPrefix' type=kotlin.Int origin=null + CALL 'public final fun dec (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + $this: GET_VAR 'val : kotlin.Int [val] declared in .testVarPrefix' type=kotlin.Int origin=null GET_VAR 'var x: kotlin.Int [var] declared in .testVarPrefix' type=kotlin.Int origin=null FUN name:testVarPostfix visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY @@ -50,13 +54,17 @@ FILE fqName: fileName:/incrementDecrement.kt BLOCK type=kotlin.Int origin=null VAR name: type:kotlin.Int [val] GET_VAR 'var x: kotlin.Int [var] declared in .testVarPostfix' type=kotlin.Int origin=null - ERROR_CALL 'Unresolved reference: R|/x|' type=IrErrorType + SET_VAR 'var x: kotlin.Int [var] declared in .testVarPostfix' type=kotlin.Int origin=null + CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + $this: GET_VAR 'val : kotlin.Int [val] declared in .testVarPostfix' type=kotlin.Int origin=null GET_VAR 'val : kotlin.Int [val] declared in .testVarPostfix' type=kotlin.Int origin=null VAR name:x2 type:kotlin.Int [val] BLOCK type=kotlin.Int origin=null VAR name: type:kotlin.Int [val] GET_VAR 'var x: kotlin.Int [var] declared in .testVarPostfix' type=kotlin.Int origin=null - ERROR_CALL 'Unresolved reference: R|/x|' type=IrErrorType + SET_VAR 'var x: kotlin.Int [var] declared in .testVarPostfix' type=kotlin.Int origin=null + CALL 'public final fun dec (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + $this: GET_VAR 'val : kotlin.Int [val] declared in .testVarPostfix' type=kotlin.Int origin=null GET_VAR 'val : kotlin.Int [val] declared in .testVarPostfix' type=kotlin.Int origin=null FUN name:testPropPrefix visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY diff --git a/compiler/testData/ir/irText/expressions/kt24804.fir.txt b/compiler/testData/ir/irText/expressions/kt24804.fir.txt index c6ae42eb116..d7f7386b0e8 100644 --- a/compiler/testData/ir/irText/expressions/kt24804.fir.txt +++ b/compiler/testData/ir/irText/expressions/kt24804.fir.txt @@ -11,7 +11,8 @@ FILE fqName: fileName:/kt24804.kt CONST Int type=kotlin.Int value=10 DO_WHILE label=l2 origin=DO_WHILE_LOOP body: BLOCK type=kotlin.String origin=null - ERROR_CALL 'Unresolved reference: R|/z|' type=IrErrorType + SET_VAR 'var z: kotlin.Int [var] declared in .run' type=kotlin.Int origin=null + CONST Int type=kotlin.Int value=1 WHEN type=kotlin.String origin=IF BRANCH if: ERROR_CALL 'Comparison of arguments with different types: kotlin/Int, kotlin/String' type=kotlin.Boolean diff --git a/compiler/testData/ir/irText/expressions/kt27933.fir.txt b/compiler/testData/ir/irText/expressions/kt27933.fir.txt index 8b28aa56ecd..a6455305e07 100644 --- a/compiler/testData/ir/irText/expressions/kt27933.fir.txt +++ b/compiler/testData/ir/irText/expressions/kt27933.fir.txt @@ -13,14 +13,16 @@ FILE fqName: fileName:/kt27933.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: BLOCK type=kotlin.Unit origin=null - ERROR_CALL 'Unresolved reference: R|/r|' type=IrErrorType + SET_VAR 'var r: kotlin.String [var] declared in .box' type=kotlin.String origin=null + CONST String type=kotlin.String value="O" WHEN type=kotlin.String origin=IF 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 'var r: kotlin.String [var] declared in .box' type=kotlin.String origin=null arg1: CONST String type=kotlin.String value="O" then: BLOCK type=kotlin.Unit origin=null - ERROR_CALL 'Unresolved reference: R|/r|' type=IrErrorType + SET_VAR 'var r: kotlin.String [var] declared in .box' type=kotlin.String origin=null + CONST String type=kotlin.String value="K" RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' GET_VAR 'var r: kotlin.String [var] declared in .box' type=kotlin.String origin=null diff --git a/compiler/testData/ir/irText/expressions/kt30020.fir.txt b/compiler/testData/ir/irText/expressions/kt30020.fir.txt index 6086cb12a8f..d92d69a7a83 100644 --- a/compiler/testData/ir/irText/expressions/kt30020.fir.txt +++ b/compiler/testData/ir/irText/expressions/kt30020.fir.txt @@ -28,17 +28,20 @@ FILE fqName: fileName:/kt30020.kt VAR name: type:kotlin.collections.MutableList [val] CALL 'public abstract fun f (): kotlin.collections.MutableList declared in .X' type=kotlin.collections.MutableList origin=null $this: GET_VAR 'x: .X declared in .test' type=.X origin=null - ERROR_CALL 'Unresolved reference: R|/|' type=IrErrorType + SET_VAR 'val : kotlin.collections.MutableList [val] declared in .test' type=kotlin.collections.MutableList origin=null + CONST Int type=kotlin.Int value=2 VAR name: type:kotlin.collections.MutableList [val] TYPE_OP type=kotlin.collections.MutableList origin=CAST typeOperand=kotlin.collections.MutableList CALL 'public abstract fun (): kotlin.collections.MutableList declared in .X' type=kotlin.collections.MutableList origin=null $this: GET_VAR 'x: .X declared in .test' type=.X origin=null - ERROR_CALL 'Unresolved reference: R|/|' type=IrErrorType + SET_VAR 'val : kotlin.collections.MutableList [val] declared in .test' type=kotlin.collections.MutableList origin=null + CONST Int type=kotlin.Int value=3 VAR name: type:kotlin.collections.MutableList [val] TYPE_OP type=kotlin.collections.MutableList origin=CAST typeOperand=kotlin.collections.MutableList CALL 'public abstract fun f (): kotlin.collections.MutableList declared in .X' type=kotlin.collections.MutableList origin=null $this: GET_VAR 'x: .X declared in .test' type=.X origin=null - ERROR_CALL 'Unresolved reference: R|/|' type=IrErrorType + SET_VAR 'val : kotlin.collections.MutableList [val] declared in .test' type=kotlin.collections.MutableList origin=null + CONST Int type=kotlin.Int value=4 VAR name: type:kotlin.collections.MutableList [val] BLOCK type=kotlin.collections.MutableList origin=EXCLEXCL VAR name: type:kotlin.collections.MutableList? [val] @@ -54,7 +57,8 @@ FILE fqName: fileName:/kt30020.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: GET_VAR 'val : kotlin.collections.MutableList? [val] declared in .test' type=kotlin.collections.MutableList? origin=null - ERROR_CALL 'Unresolved reference: R|/|' type=IrErrorType + SET_VAR 'val : kotlin.collections.MutableList [val] declared in .test' type=kotlin.collections.MutableList origin=null + CONST Int type=kotlin.Int value=5 VAR name: type:kotlin.collections.MutableList [val] BLOCK type=kotlin.collections.MutableList origin=EXCLEXCL VAR name: type:kotlin.collections.MutableList [val] @@ -70,7 +74,8 @@ FILE fqName: fileName:/kt30020.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: GET_VAR 'val : kotlin.collections.MutableList [val] declared in .test' type=kotlin.collections.MutableList origin=null - ERROR_CALL 'Unresolved reference: R|/|' type=IrErrorType + SET_VAR 'val : kotlin.collections.MutableList [val] declared in .test' type=kotlin.collections.MutableList origin=null + CONST Int type=kotlin.Int value=6 FUN name:testExtensionReceiver visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY ERROR_CALL 'Unresolved reference: this#' type=IrErrorType diff --git a/compiler/testData/ir/irText/expressions/whileDoWhile.fir.txt b/compiler/testData/ir/irText/expressions/whileDoWhile.fir.txt index ac39f5523ab..4fcbce7a113 100644 --- a/compiler/testData/ir/irText/expressions/whileDoWhile.fir.txt +++ b/compiler/testData/ir/irText/expressions/whileDoWhile.fir.txt @@ -11,14 +11,18 @@ FILE fqName: fileName:/whileDoWhile.kt body: BLOCK type=kotlin.Int origin=null VAR name: type:kotlin.Int [val] GET_VAR 'var x: kotlin.Int [var] declared in .test' type=kotlin.Int origin=null - ERROR_CALL 'Unresolved reference: R|/x|' type=IrErrorType + SET_VAR 'var x: kotlin.Int [var] declared in .test' type=kotlin.Int origin=null + CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + $this: GET_VAR 'val : kotlin.Int [val] declared in .test' type=kotlin.Int origin=null GET_VAR 'val : kotlin.Int [val] declared in .test' type=kotlin.Int origin=null WHILE label=null origin=WHILE_LOOP condition: ERROR_CALL 'Comparison of arguments with different types: kotlin/Int, kotlin/Unit' type=kotlin.Boolean body: BLOCK type=kotlin.Int origin=null VAR name: type:kotlin.Int [val] GET_VAR 'var x: kotlin.Int [var] declared in .test' type=kotlin.Int origin=null - ERROR_CALL 'Unresolved reference: R|/x|' type=IrErrorType + SET_VAR 'var x: kotlin.Int [var] declared in .test' type=kotlin.Int origin=null + CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + $this: GET_VAR 'val : kotlin.Int [val] declared in .test' type=kotlin.Int origin=null GET_VAR 'val : kotlin.Int [val] declared in .test' type=kotlin.Int origin=null DO_WHILE label=null origin=DO_WHILE_LOOP body: BLOCK type=kotlin.Unit origin=null @@ -27,14 +31,18 @@ FILE fqName: fileName:/whileDoWhile.kt body: BLOCK type=kotlin.Int origin=null VAR name: type:kotlin.Int [val] GET_VAR 'var x: kotlin.Int [var] declared in .test' type=kotlin.Int origin=null - ERROR_CALL 'Unresolved reference: R|/x|' type=IrErrorType + SET_VAR 'var x: kotlin.Int [var] declared in .test' type=kotlin.Int origin=null + CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + $this: GET_VAR 'val : kotlin.Int [val] declared in .test' type=kotlin.Int origin=null GET_VAR 'val : kotlin.Int [val] declared in .test' type=kotlin.Int origin=null condition: ERROR_CALL 'Comparison of arguments with different types: kotlin/Int, kotlin/Unit' type=kotlin.Boolean DO_WHILE label=null origin=DO_WHILE_LOOP body: BLOCK type=kotlin.Int origin=null VAR name: type:kotlin.Int [val] GET_VAR 'var x: kotlin.Int [var] declared in .test' type=kotlin.Int origin=null - ERROR_CALL 'Unresolved reference: R|/x|' type=IrErrorType + SET_VAR 'var x: kotlin.Int [var] declared in .test' type=kotlin.Int origin=null + CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + $this: GET_VAR 'val : kotlin.Int [val] declared in .test' type=kotlin.Int origin=null GET_VAR 'val : kotlin.Int [val] declared in .test' type=kotlin.Int origin=null condition: ERROR_CALL 'Comparison of arguments with different types: kotlin/Int, kotlin/Unit' type=kotlin.Boolean FUN name:testSmartcastInCondition visibility:public modality:FINAL <> () returnType:kotlin.Unit diff --git a/compiler/testData/ir/irText/lambdas/localFunction.fir.txt b/compiler/testData/ir/irText/lambdas/localFunction.fir.txt index 5734019191e..8488bd85174 100644 --- a/compiler/testData/ir/irText/lambdas/localFunction.fir.txt +++ b/compiler/testData/ir/irText/lambdas/localFunction.fir.txt @@ -7,7 +7,9 @@ FILE fqName: fileName:/localFunction.kt BLOCK_BODY VAR name: type:kotlin.Int [val] GET_VAR 'var x: kotlin.Int [var] declared in .outer' type=kotlin.Int origin=null - ERROR_CALL 'Unresolved reference: R|/x|' type=IrErrorType + SET_VAR 'var x: kotlin.Int [var] declared in .outer' type=kotlin.Int origin=null + CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + $this: GET_VAR 'val : kotlin.Int [val] declared in .outer.local' type=kotlin.Int origin=null GET_VAR 'val : kotlin.Int [val] declared in .outer.local' type=kotlin.Int origin=null CALL 'local final fun local (): kotlin.Unit declared in ' type=kotlin.Unit origin=null diff --git a/compiler/testData/ir/irText/regressions/coercionInLoop.fir.txt b/compiler/testData/ir/irText/regressions/coercionInLoop.fir.txt index eeacb895899..a1c1cfd12f3 100644 --- a/compiler/testData/ir/irText/regressions/coercionInLoop.fir.txt +++ b/compiler/testData/ir/irText/regressions/coercionInLoop.fir.txt @@ -28,7 +28,9 @@ FILE fqName: fileName:/coercionInLoop.kt GET_VAR 'var i: kotlin.Int [var] declared in .box' type=kotlin.Int origin=null VAR name: type:kotlin.Int [val] GET_VAR 'var i: kotlin.Int [var] declared in .box' type=kotlin.Int origin=null - ERROR_CALL 'Unresolved reference: R|/i|' type=IrErrorType + SET_VAR 'var i: kotlin.Int [var] declared in .box' type=kotlin.Int origin=null + CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null + $this: GET_VAR 'val : kotlin.Int [val] declared in .box' type=kotlin.Int origin=null GET_VAR 'val : kotlin.Int [val] declared in .box' type=kotlin.Int origin=null RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' CONST String type=kotlin.String value="OK"