FIR2IR: support assignments of local variables

This commit is contained in:
Mikhail Glukhikh
2019-05-16 14:24:39 +03:00
parent 68da1a97d1
commit a973a21ec6
15 changed files with 99 additions and 41 deletions
@@ -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 {
@@ -7,10 +7,12 @@ FILE fqName:<root> 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|<local>/x|' type=IrErrorType
SET_VAR 'var x: IrErrorType [var] declared in <root>.test2' type=IrErrorType origin=null
CONST Int type=kotlin.Int value=0
VAR name:<unary> type:IrErrorType [val]
GET_VAR 'var x: IrErrorType [var] declared in <root>.test2' type=IrErrorType origin=null
ERROR_CALL 'Unresolved reference: R|<local>/x|' type=IrErrorType
SET_VAR 'var x: IrErrorType [var] declared in <root>.test2' type=IrErrorType origin=null
ERROR_CALL 'Unresolved reference: <Ambiguity: inc, [kotlin/inc, kotlin/inc]>#' type=IrErrorType
GET_VAR 'val <unary>: IrErrorType [val] declared in <root>.test2' type=IrErrorType origin=null
ERROR_CALL 'Unresolved reference: R|<local>/x|' type=IrErrorType
SET_VAR 'var x: IrErrorType [var] declared in <root>.test2' type=IrErrorType origin=null
CONST Int type=kotlin.Int value=1
@@ -42,8 +42,12 @@ FILE fqName:<root> fileName:/assignments.kt
BLOCK_BODY
VAR name:x type:kotlin.Int [var]
CONST Int type=kotlin.Int value=0
ERROR_CALL 'Unresolved reference: R|<local>/x|' type=IrErrorType
ERROR_CALL 'Unresolved reference: R|<local>/x|' type=IrErrorType
SET_VAR 'var x: kotlin.Int [var] declared in <root>.test1' type=kotlin.Int origin=null
CONST Int type=kotlin.Int value=1
SET_VAR 'var x: kotlin.Int [var] declared in <root>.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 <root>.test1' type=kotlin.Int origin=null
other: CONST Int type=kotlin.Int value=1
FUN name:test2 visibility:public modality:FINAL <> (r:<root>.Ref) returnType:kotlin.Unit
VALUE_PARAMETER name:r index:0 type:<root>.Ref
BLOCK_BODY
@@ -18,11 +18,16 @@ FILE fqName:<root> fileName:/augmentedAssignment1.kt
BLOCK_BODY
VAR name:x type:kotlin.Int [var]
CONST Int type=kotlin.Int value=0
ERROR_CALL 'Unresolved reference: R|<local>/x|' type=IrErrorType
ERROR_CALL 'Unresolved reference: R|<local>/x|' type=IrErrorType
ERROR_CALL 'Unresolved reference: R|<local>/x|' type=IrErrorType
ERROR_CALL 'Unresolved reference: R|<local>/x|' type=IrErrorType
ERROR_CALL 'Unresolved reference: R|<local>/x|' type=IrErrorType
SET_VAR 'var x: kotlin.Int [var] declared in <root>.testVariable' type=kotlin.Int origin=null
CONST Int type=kotlin.Int value=1
SET_VAR 'var x: kotlin.Int [var] declared in <root>.testVariable' type=kotlin.Int origin=null
CONST Int type=kotlin.Int value=2
SET_VAR 'var x: kotlin.Int [var] declared in <root>.testVariable' type=kotlin.Int origin=null
CONST Int type=kotlin.Int value=3
SET_VAR 'var x: kotlin.Int [var] declared in <root>.testVariable' type=kotlin.Int origin=null
CONST Int type=kotlin.Int value=4
SET_VAR 'var x: kotlin.Int [var] declared in <root>.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
@@ -46,11 +46,16 @@ FILE fqName:<root> fileName:/augmentedAssignment2.kt
BLOCK_BODY
VAR name:a type:<root>.A [val]
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.A' type=<root>.A origin=null
ERROR_CALL 'Unresolved reference: R|<local>/a|' type=IrErrorType
ERROR_CALL 'Unresolved reference: R|<local>/a|' type=IrErrorType
ERROR_CALL 'Unresolved reference: R|<local>/a|' type=IrErrorType
ERROR_CALL 'Unresolved reference: R|<local>/a|' type=IrErrorType
ERROR_CALL 'Unresolved reference: R|<local>/a|' type=IrErrorType
SET_VAR 'val a: <root>.A [val] declared in <root>.testVariable' type=<root>.A origin=null
CONST String type=kotlin.String value="+="
SET_VAR 'val a: <root>.A [val] declared in <root>.testVariable' type=<root>.A origin=null
CONST String type=kotlin.String value="-="
SET_VAR 'val a: <root>.A [val] declared in <root>.testVariable' type=<root>.A origin=null
CONST String type=kotlin.String value="*="
SET_VAR 'val a: <root>.A [val] declared in <root>.testVariable' type=<root>.A origin=null
CONST String type=kotlin.String value="/="
SET_VAR 'val a: <root>.A [val] declared in <root>.testVariable' type=<root>.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:<root>.A visibility:public [final,static] ' type=<root>.A origin=null
@@ -37,11 +37,12 @@ FILE fqName:<root> fileName:/augmentedAssignmentWithExpression.kt
BLOCK_BODY
VAR name:<complex-set> type:<root>.Host [val]
CALL 'public final fun foo (): <root>.Host declared in <root>' type=<root>.Host origin=null
ERROR_CALL 'Unresolved reference: R|<local>/<complex-set>|' type=IrErrorType
SET_VAR 'val <complex-set>: <root>.Host [val] declared in <root>.test3' type=<root>.Host origin=null
CONST Int type=kotlin.Int value=1
FUN name:test4 visibility:public modality:FINAL <> (a:kotlin.Function0<<root>.Host>) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:kotlin.Function0<<root>.Host>
BLOCK_BODY
VAR name:<complex-set> type:IrErrorType [val]
ERROR_CALL 'Unresolved reference: <Unresolved name: a>#' type=IrErrorType
ERROR_CALL 'Unresolved reference: R|<local>/<complex-set>|' type=IrErrorType
SET_VAR 'val <complex-set>: IrErrorType [val] declared in <root>.test4' type=IrErrorType origin=null
CONST Int type=kotlin.Int value=1
@@ -106,7 +106,9 @@ FILE fqName:<root> fileName:/breakContinueInLoopHeader.kt
body: BLOCK type=kotlin.Unit origin=null
VAR name:<unary> type:kotlin.Int [val]
GET_VAR 'var i: kotlin.Int [var] declared in <root>.test5' type=kotlin.Int origin=null
ERROR_CALL 'Unresolved reference: R|<local>/i|' type=IrErrorType
SET_VAR 'var i: kotlin.Int [var] declared in <root>.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 <unary>: kotlin.Int [val] declared in <root>.test5' type=kotlin.Int origin=null
GET_VAR 'var i: kotlin.Int [var] declared in <root>.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:<root> fileName:/breakContinueInLoopHeader.kt
body: BLOCK type=kotlin.Int origin=null
VAR name:<unary> type:kotlin.Int [val]
GET_VAR 'var j: kotlin.Int [var] declared in <root>.test5' type=kotlin.Int origin=null
ERROR_CALL 'Unresolved reference: R|<local>/j|' type=IrErrorType
SET_VAR 'var j: kotlin.Int [var] declared in <root>.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 <unary>: kotlin.Int [val] declared in <root>.test5' type=kotlin.Int origin=null
GET_VAR 'var j: kotlin.Int [var] declared in <root>.test5' type=kotlin.Int origin=null
condition: WHEN type=kotlin.Unit origin=IF
BRANCH
@@ -124,14 +124,18 @@ FILE fqName:<root> fileName:/complexAugmentedAssignment.kt
index: BLOCK type=kotlin.Int origin=null
VAR name:<unary> type:kotlin.Int [val]
GET_VAR 'var i: kotlin.Int [var] declared in <root>.test1' type=kotlin.Int origin=null
ERROR_CALL 'Unresolved reference: R|<local>/i|' type=IrErrorType
SET_VAR 'var i: kotlin.Int [var] declared in <root>.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 <unary>: kotlin.Int [val] declared in <root>.test1' type=kotlin.Int origin=null
GET_VAR 'val <unary>: kotlin.Int [val] declared in <root>.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 <root>.test1' type=kotlin.IntArray origin=null
index: BLOCK type=kotlin.Int origin=null
VAR name:<unary> type:kotlin.Int [val]
GET_VAR 'var i: kotlin.Int [var] declared in <root>.test1' type=kotlin.Int origin=null
ERROR_CALL 'Unresolved reference: R|<local>/i|' type=IrErrorType
SET_VAR 'var i: kotlin.Int [var] declared in <root>.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 <unary>: kotlin.Int [val] declared in <root>.test1' type=kotlin.Int origin=null
GET_VAR 'val <unary>: kotlin.Int [val] declared in <root>.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 <unary>: kotlin.Int [val] declared in <root>.test1' type=kotlin.Int origin=null
@@ -34,13 +34,17 @@ FILE fqName:<root> fileName:/incrementDecrement.kt
BLOCK type=kotlin.Int origin=null
VAR name:<unary> type:kotlin.Int [val]
GET_VAR 'var x: kotlin.Int [var] declared in <root>.testVarPrefix' type=kotlin.Int origin=null
ERROR_CALL 'Unresolved reference: R|<local>/x|' type=IrErrorType
SET_VAR 'var x: kotlin.Int [var] declared in <root>.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 <unary>: kotlin.Int [val] declared in <root>.testVarPrefix' type=kotlin.Int origin=null
GET_VAR 'var x: kotlin.Int [var] declared in <root>.testVarPrefix' type=kotlin.Int origin=null
VAR name:x2 type:kotlin.Int [val]
BLOCK type=kotlin.Int origin=null
VAR name:<unary> type:kotlin.Int [val]
GET_VAR 'var x: kotlin.Int [var] declared in <root>.testVarPrefix' type=kotlin.Int origin=null
ERROR_CALL 'Unresolved reference: R|<local>/x|' type=IrErrorType
SET_VAR 'var x: kotlin.Int [var] declared in <root>.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 <unary>: kotlin.Int [val] declared in <root>.testVarPrefix' type=kotlin.Int origin=null
GET_VAR 'var x: kotlin.Int [var] declared in <root>.testVarPrefix' type=kotlin.Int origin=null
FUN name:testVarPostfix visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
@@ -50,13 +54,17 @@ FILE fqName:<root> fileName:/incrementDecrement.kt
BLOCK type=kotlin.Int origin=null
VAR name:<unary> type:kotlin.Int [val]
GET_VAR 'var x: kotlin.Int [var] declared in <root>.testVarPostfix' type=kotlin.Int origin=null
ERROR_CALL 'Unresolved reference: R|<local>/x|' type=IrErrorType
SET_VAR 'var x: kotlin.Int [var] declared in <root>.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 <unary>: kotlin.Int [val] declared in <root>.testVarPostfix' type=kotlin.Int origin=null
GET_VAR 'val <unary>: kotlin.Int [val] declared in <root>.testVarPostfix' type=kotlin.Int origin=null
VAR name:x2 type:kotlin.Int [val]
BLOCK type=kotlin.Int origin=null
VAR name:<unary> type:kotlin.Int [val]
GET_VAR 'var x: kotlin.Int [var] declared in <root>.testVarPostfix' type=kotlin.Int origin=null
ERROR_CALL 'Unresolved reference: R|<local>/x|' type=IrErrorType
SET_VAR 'var x: kotlin.Int [var] declared in <root>.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 <unary>: kotlin.Int [val] declared in <root>.testVarPostfix' type=kotlin.Int origin=null
GET_VAR 'val <unary>: kotlin.Int [val] declared in <root>.testVarPostfix' type=kotlin.Int origin=null
FUN name:testPropPrefix visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
+2 -1
View File
@@ -11,7 +11,8 @@ FILE fqName:<root> 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|<local>/z|' type=IrErrorType
SET_VAR 'var z: kotlin.Int [var] declared in <root>.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
+4 -2
View File
@@ -13,14 +13,16 @@ FILE fqName:<root> fileName:/kt27933.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: BLOCK type=kotlin.Unit origin=null
ERROR_CALL 'Unresolved reference: R|<local>/r|' type=IrErrorType
SET_VAR 'var r: kotlin.String [var] declared in <root>.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 <root>.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|<local>/r|' type=IrErrorType
SET_VAR 'var r: kotlin.String [var] declared in <root>.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 <root>'
GET_VAR 'var r: kotlin.String [var] declared in <root>.box' type=kotlin.String origin=null
+10 -5
View File
@@ -28,17 +28,20 @@ FILE fqName:<root> fileName:/kt30020.kt
VAR name:<complex-set> type:kotlin.collections.MutableList<kotlin.Any> [val]
CALL 'public abstract fun f (): kotlin.collections.MutableList<kotlin.Any> declared in <root>.X' type=kotlin.collections.MutableList<kotlin.Any> origin=null
$this: GET_VAR 'x: <root>.X declared in <root>.test' type=<root>.X origin=null
ERROR_CALL 'Unresolved reference: R|<local>/<complex-set>|' type=IrErrorType
SET_VAR 'val <complex-set>: kotlin.collections.MutableList<kotlin.Any> [val] declared in <root>.test' type=kotlin.collections.MutableList<kotlin.Any> origin=null
CONST Int type=kotlin.Int value=2
VAR name:<complex-set> type:kotlin.collections.MutableList<kotlin.Int> [val]
TYPE_OP type=kotlin.collections.MutableList<kotlin.Int> origin=CAST typeOperand=kotlin.collections.MutableList<kotlin.Int>
CALL 'public abstract fun <get-xs> (): kotlin.collections.MutableList<kotlin.Any> declared in <root>.X' type=kotlin.collections.MutableList<kotlin.Any> origin=null
$this: GET_VAR 'x: <root>.X declared in <root>.test' type=<root>.X origin=null
ERROR_CALL 'Unresolved reference: R|<local>/<complex-set>|' type=IrErrorType
SET_VAR 'val <complex-set>: kotlin.collections.MutableList<kotlin.Int> [val] declared in <root>.test' type=kotlin.collections.MutableList<kotlin.Int> origin=null
CONST Int type=kotlin.Int value=3
VAR name:<complex-set> type:kotlin.collections.MutableList<kotlin.Int> [val]
TYPE_OP type=kotlin.collections.MutableList<kotlin.Int> origin=CAST typeOperand=kotlin.collections.MutableList<kotlin.Int>
CALL 'public abstract fun f (): kotlin.collections.MutableList<kotlin.Any> declared in <root>.X' type=kotlin.collections.MutableList<kotlin.Any> origin=null
$this: GET_VAR 'x: <root>.X declared in <root>.test' type=<root>.X origin=null
ERROR_CALL 'Unresolved reference: R|<local>/<complex-set>|' type=IrErrorType
SET_VAR 'val <complex-set>: kotlin.collections.MutableList<kotlin.Int> [val] declared in <root>.test' type=kotlin.collections.MutableList<kotlin.Int> origin=null
CONST Int type=kotlin.Int value=4
VAR name:<complex-set> type:kotlin.collections.MutableList<kotlin.Any> [val]
BLOCK type=kotlin.collections.MutableList<kotlin.Any> origin=EXCLEXCL
VAR name:<bangbang> type:kotlin.collections.MutableList<kotlin.Any>? [val]
@@ -54,7 +57,8 @@ FILE fqName:<root> fileName:/kt30020.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: GET_VAR 'val <bangbang>: kotlin.collections.MutableList<kotlin.Any>? [val] declared in <root>.test' type=kotlin.collections.MutableList<kotlin.Any>? origin=null
ERROR_CALL 'Unresolved reference: R|<local>/<complex-set>|' type=IrErrorType
SET_VAR 'val <complex-set>: kotlin.collections.MutableList<kotlin.Any> [val] declared in <root>.test' type=kotlin.collections.MutableList<kotlin.Any> origin=null
CONST Int type=kotlin.Int value=5
VAR name:<complex-set> type:kotlin.collections.MutableList<kotlin.Any> [val]
BLOCK type=kotlin.collections.MutableList<kotlin.Any> origin=EXCLEXCL
VAR name:<bangbang> type:kotlin.collections.MutableList<kotlin.Any> [val]
@@ -70,7 +74,8 @@ FILE fqName:<root> fileName:/kt30020.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: GET_VAR 'val <bangbang>: kotlin.collections.MutableList<kotlin.Any> [val] declared in <root>.test' type=kotlin.collections.MutableList<kotlin.Any> origin=null
ERROR_CALL 'Unresolved reference: R|<local>/<complex-set>|' type=IrErrorType
SET_VAR 'val <complex-set>: kotlin.collections.MutableList<kotlin.Any> [val] declared in <root>.test' type=kotlin.collections.MutableList<kotlin.Any> 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
@@ -11,14 +11,18 @@ FILE fqName:<root> fileName:/whileDoWhile.kt
body: BLOCK type=kotlin.Int origin=null
VAR name:<unary> type:kotlin.Int [val]
GET_VAR 'var x: kotlin.Int [var] declared in <root>.test' type=kotlin.Int origin=null
ERROR_CALL 'Unresolved reference: R|<local>/x|' type=IrErrorType
SET_VAR 'var x: kotlin.Int [var] declared in <root>.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 <unary>: kotlin.Int [val] declared in <root>.test' type=kotlin.Int origin=null
GET_VAR 'val <unary>: kotlin.Int [val] declared in <root>.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:<unary> type:kotlin.Int [val]
GET_VAR 'var x: kotlin.Int [var] declared in <root>.test' type=kotlin.Int origin=null
ERROR_CALL 'Unresolved reference: R|<local>/x|' type=IrErrorType
SET_VAR 'var x: kotlin.Int [var] declared in <root>.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 <unary>: kotlin.Int [val] declared in <root>.test' type=kotlin.Int origin=null
GET_VAR 'val <unary>: kotlin.Int [val] declared in <root>.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:<root> fileName:/whileDoWhile.kt
body: BLOCK type=kotlin.Int origin=null
VAR name:<unary> type:kotlin.Int [val]
GET_VAR 'var x: kotlin.Int [var] declared in <root>.test' type=kotlin.Int origin=null
ERROR_CALL 'Unresolved reference: R|<local>/x|' type=IrErrorType
SET_VAR 'var x: kotlin.Int [var] declared in <root>.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 <unary>: kotlin.Int [val] declared in <root>.test' type=kotlin.Int origin=null
GET_VAR 'val <unary>: kotlin.Int [val] declared in <root>.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:<unary> type:kotlin.Int [val]
GET_VAR 'var x: kotlin.Int [var] declared in <root>.test' type=kotlin.Int origin=null
ERROR_CALL 'Unresolved reference: R|<local>/x|' type=IrErrorType
SET_VAR 'var x: kotlin.Int [var] declared in <root>.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 <unary>: kotlin.Int [val] declared in <root>.test' type=kotlin.Int origin=null
GET_VAR 'val <unary>: kotlin.Int [val] declared in <root>.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
+3 -1
View File
@@ -7,7 +7,9 @@ FILE fqName:<root> fileName:/localFunction.kt
BLOCK_BODY
VAR name:<unary> type:kotlin.Int [val]
GET_VAR 'var x: kotlin.Int [var] declared in <root>.outer' type=kotlin.Int origin=null
ERROR_CALL 'Unresolved reference: R|<local>/x|' type=IrErrorType
SET_VAR 'var x: kotlin.Int [var] declared in <root>.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 <unary>: kotlin.Int [val] declared in <root>.outer.local' type=kotlin.Int origin=null
GET_VAR 'val <unary>: kotlin.Int [val] declared in <root>.outer.local' type=kotlin.Int origin=null
CALL 'local final fun local (): kotlin.Unit declared in <local>' type=kotlin.Unit origin=null
@@ -28,7 +28,9 @@ FILE fqName:<root> fileName:/coercionInLoop.kt
GET_VAR 'var i: kotlin.Int [var] declared in <root>.box' type=kotlin.Int origin=null
VAR name:<unary> type:kotlin.Int [val]
GET_VAR 'var i: kotlin.Int [var] declared in <root>.box' type=kotlin.Int origin=null
ERROR_CALL 'Unresolved reference: R|<local>/i|' type=IrErrorType
SET_VAR 'var i: kotlin.Int [var] declared in <root>.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 <unary>: kotlin.Int [val] declared in <root>.box' type=kotlin.Int origin=null
GET_VAR 'val <unary>: kotlin.Int [val] declared in <root>.box' type=kotlin.Int origin=null
RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
CONST String type=kotlin.String value="OK"