diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt index 2143fb24f24..e210fc2608e 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt @@ -20,9 +20,7 @@ import org.jetbrains.kotlin.fir.declarations.synthetic.FirSyntheticProperty import org.jetbrains.kotlin.fir.declarations.utils.isInline import org.jetbrains.kotlin.fir.declarations.utils.isJava import org.jetbrains.kotlin.fir.declarations.utils.visibility -import org.jetbrains.kotlin.fir.expressions.FirAnnotation -import org.jetbrains.kotlin.fir.expressions.FirConstExpression -import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccess +import org.jetbrains.kotlin.fir.expressions.* import org.jetbrains.kotlin.fir.extensions.declarationGenerators import org.jetbrains.kotlin.fir.extensions.extensionService import org.jetbrains.kotlin.fir.references.FirErrorNamedReference @@ -44,10 +42,7 @@ import org.jetbrains.kotlin.ir.IrElement import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET import org.jetbrains.kotlin.ir.builders.declarations.UNDEFINED_PARAMETER_INDEX import org.jetbrains.kotlin.ir.declarations.* -import org.jetbrains.kotlin.ir.expressions.IrConst -import org.jetbrains.kotlin.ir.expressions.IrConstKind -import org.jetbrains.kotlin.ir.expressions.IrExpression -import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin +import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.impl.* import org.jetbrains.kotlin.ir.symbols.* import org.jetbrains.kotlin.ir.symbols.impl.IrValueParameterSymbolImpl @@ -56,6 +51,7 @@ import org.jetbrains.kotlin.ir.types.impl.IrErrorTypeImpl import org.jetbrains.kotlin.ir.util.SymbolTable import org.jetbrains.kotlin.ir.util.functions import org.jetbrains.kotlin.name.SpecialNames +import org.jetbrains.kotlin.name.StandardClassIds import org.jetbrains.kotlin.psi.KtQualifiedExpression import org.jetbrains.kotlin.psi.psiUtil.endOffset import org.jetbrains.kotlin.psi.psiUtil.startOffsetSkippingComments @@ -606,3 +602,36 @@ fun FirDeclaration?.computeIrOrigin(predefinedOrigin: IrDeclarationOrigin? = nul ?: (this?.origin as? FirDeclarationOrigin.Plugin)?.let { IrPluginDeclarationOrigin(it.key) } ?: IrDeclarationOrigin.DEFINED } + +fun FirVariableAssignment.getIrAssignmentOrigin(): IrStatementOrigin { + val calleeReferenceSymbol = calleeReference.toResolvedCallableSymbol() ?: return IrStatementOrigin.EQ + val rValue = rValue + if (rValue is FirFunctionCall && calleeReferenceSymbol.callableId.isLocal) { + val callableId = rValue.calleeReference.toResolvedCallableSymbol()?.callableId + if (callableId?.classId == StandardClassIds.Int) { + val callableName = callableId.callableName + if (callableName == OperatorNameConventions.INC) { + return if (source?.elementType == KtNodeTypes.PREFIX_EXPRESSION) + IrStatementOrigin.PREFIX_INCR + else + IrStatementOrigin.POSTFIX_INCR + } else if (callableName == OperatorNameConventions.DEC) { + return if (source?.elementType == KtNodeTypes.PREFIX_EXPRESSION) + IrStatementOrigin.PREFIX_DECR + else + IrStatementOrigin.POSTFIX_DECR + } + + if (calleeReference.source?.kind is FirFakeSourceElementKind && + calleeReferenceSymbol == rValue.explicitReceiver?.toResolvedCallableSymbol() + ) { + if (callableName == OperatorNameConventions.PLUS) { + return IrStatementOrigin.PLUSEQ + } else if (callableName == OperatorNameConventions.MINUS) { + return IrStatementOrigin.MINUSEQ + } + } + } + } + return IrStatementOrigin.EQ +} 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 9acdfd6bf59..b4ab8a8860a 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 @@ -239,7 +239,10 @@ class Fir2IrVisitor( override fun visitAnonymousFunction(anonymousFunction: FirAnonymousFunction, data: Any?): IrElement { return anonymousFunction.convertWithOffsets { startOffset, endOffset -> val irFunction = declarationStorage.createIrFunction( - anonymousFunction, irParent = conversionScope.parent(), predefinedOrigin = IrDeclarationOrigin.LOCAL_FUNCTION_FOR_LAMBDA, isLocal = true + anonymousFunction, + irParent = conversionScope.parent(), + predefinedOrigin = IrDeclarationOrigin.LOCAL_FUNCTION_FOR_LAMBDA, + isLocal = true ) conversionScope.withFunction(irFunction) { memberGenerator.convertFunctionContent(irFunction, anonymousFunction, containingClass = null) @@ -567,8 +570,10 @@ class Fir2IrVisitor( return convertToIrExpression(firStatement) } } - val type = if (origin?.isLoop == true) irBuiltIns.unitType - else (statements.lastOrNull() as? FirExpression)?.typeRef?.toIrType() ?: irBuiltIns.unitType + val type = if (origin?.isLoop == true) + irBuiltIns.unitType + else + (statements.lastOrNull() as? FirExpression)?.typeRef?.toIrType() ?: irBuiltIns.unitType return convertWithOffsets { startOffset, endOffset -> if (origin == IrStatementOrigin.DO_WHILE_LOOP) { IrCompositeImpl( @@ -577,13 +582,38 @@ class Fir2IrVisitor( ) } else { IrBlockImpl( - startOffset, endOffset, type, origin, + startOffset, endOffset, type, getBlockOrigin() ?: origin, mapToIrStatements().filterNotNull() ) } } } + private fun FirBlock.getBlockOrigin(): IrStatementOrigin? { + if (source?.kind !is FirFakeSourceElementKind.DesugaredIncrementOrDecrement) return null + + val isPrefix: Boolean + val incrementStatement = when (statements.size) { + 2 -> { + isPrefix = true + statements[0] + } + 3 -> { + isPrefix = false + statements[1] + } + else -> return null + } + + if (incrementStatement !is FirVariableAssignment) return null + + val origin = incrementStatement.getIrAssignmentOrigin(isPrefix) + return if (origin == IrStatementOrigin.EQ) + null + else + origin + } + override fun visitErrorExpression(errorExpression: FirErrorExpression, data: Any?): IrElement { return errorExpression.convertWithOffsets { startOffset, endOffset -> IrErrorExpressionImpl( diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt index 621bad5cd00..d7826ba3ea9 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt @@ -46,7 +46,6 @@ import org.jetbrains.kotlin.ir.types.* import org.jetbrains.kotlin.ir.util.isFunctionTypeOrSubtype import org.jetbrains.kotlin.ir.util.isInterface import org.jetbrains.kotlin.ir.util.render -import org.jetbrains.kotlin.name.StandardClassIds import org.jetbrains.kotlin.psi2ir.generators.hasNoSideEffects import org.jetbrains.kotlin.psi2ir.generators.isUnchanging import org.jetbrains.kotlin.types.AbstractTypeChecker @@ -317,7 +316,7 @@ class CallAndReferenceGenerator( val calleeReference = variableAssignment.calleeReference val symbol = calleeReference.toSymbolForCall(session, classifierStorage, declarationStorage, conversionScope, preferGetter = false) - val origin = getIrStatementOrigin(variableAssignment) + val origin = variableAssignment.getIrAssignmentOrigin() return variableAssignment.convertWithOffsets { startOffset, endOffset -> val assignedValue = visitor.convertToIrExpression(variableAssignment.rValue) @@ -386,34 +385,6 @@ class CallAndReferenceGenerator( } } - private fun getIrStatementOrigin(variableAssignment: FirVariableAssignment): IrStatementOriginImpl { - val rValue = variableAssignment.rValue - if (rValue is FirFunctionCall) { - val resolvedSymbol = rValue.calleeReference.toResolvedCallableSymbol() - val callableId = resolvedSymbol?.callableId - if (callableId?.classId == StandardClassIds.Int && - variableAssignment.calleeReference.toResolvedCallableSymbol() == rValue.explicitReceiver?.toResolvedCallableSymbol() - ) { - val callableName = callableId.callableName.asString() - if (callableName == "inc") { - return IrStatementOrigin.PREFIX_INCR - } else if (callableName == "dec") { - return IrStatementOrigin.PREFIX_DECR - } else { - val argument = ((rValue.arguments.singleOrNull() as? FirConstExpression<*>)?.value as? Long) - if (argument != null) { - if (callableName == "plus" && argument >= -128 && argument <= 127) { - return IrStatementOrigin.PREFIX_INCR - } else if (callableName == "minus" && argument >= -127 && argument <= 128) { - return IrStatementOrigin.PREFIX_DECR - } - } - } - } - } - return IrStatementOrigin.EQ - } - fun convertToIrConstructorCall(annotation: FirAnnotation): IrExpression { val coneType = annotation.annotationTypeRef.coneTypeSafe() val type = coneType?.toIrType() diff --git a/compiler/testData/codegen/bytecodeText/intrinsics/postfixIncrDecr.kt b/compiler/testData/codegen/bytecodeText/intrinsics/postfixIncrDecr.kt index 18c888f5636..29e92e68db2 100644 --- a/compiler/testData/codegen/bytecodeText/intrinsics/postfixIncrDecr.kt +++ b/compiler/testData/codegen/bytecodeText/intrinsics/postfixIncrDecr.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - fun use(i: Int) {} fun testPostfixIncr0() { diff --git a/compiler/testData/ir/irText/declarations/localDelegatedProperties.fir.ir.txt b/compiler/testData/ir/irText/declarations/localDelegatedProperties.fir.ir.txt index 2daa464ab27..5cd1a9059e6 100644 --- a/compiler/testData/ir/irText/declarations/localDelegatedProperties.fir.ir.txt +++ b/compiler/testData/ir/irText/declarations/localDelegatedProperties.fir.ir.txt @@ -49,12 +49,12 @@ FILE fqName: fileName:/localDelegatedProperties.kt : CONST Int type=kotlin.Int value=0 VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:@[FlexibleNullability] kotlin.Int? [val] CALL 'local final fun (): @[FlexibleNullability] kotlin.Int? declared in .test2' type=@[FlexibleNullability] kotlin.Int? origin=GET_LOCAL_PROPERTY - CALL 'local final fun (: @[FlexibleNullability] kotlin.Int?): kotlin.Unit declared in .test2' type=kotlin.Unit origin=EQ + CALL 'local final fun (: @[FlexibleNullability] kotlin.Int?): kotlin.Unit declared in .test2' type=kotlin.Unit origin=POSTFIX_INCR : CALL 'public final fun inc (): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null $this: GET_VAR 'val tmp_0: @[FlexibleNullability] kotlin.Int? [val] declared in .test2' type=@[FlexibleNullability] kotlin.Int? origin=null TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit GET_VAR 'val tmp_0: @[FlexibleNullability] kotlin.Int? [val] declared in .test2' type=@[FlexibleNullability] kotlin.Int? origin=null - CALL 'local final fun (: @[FlexibleNullability] kotlin.Int?): kotlin.Unit declared in .test2' type=kotlin.Unit origin=EQ + CALL 'local final fun (: @[FlexibleNullability] kotlin.Int?): kotlin.Unit declared in .test2' type=kotlin.Unit origin=PLUSEQ : CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null $this: CALL 'local final fun (): @[FlexibleNullability] kotlin.Int? declared in .test2' type=@[FlexibleNullability] kotlin.Int? origin=GET_LOCAL_PROPERTY other: CONST Int type=kotlin.Int value=1 diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignment1.fir.ir.txt b/compiler/testData/ir/irText/expressions/augmentedAssignment1.fir.ir.txt index 60796f04c00..0668f122294 100644 --- a/compiler/testData/ir/irText/expressions/augmentedAssignment1.fir.ir.txt +++ b/compiler/testData/ir/irText/expressions/augmentedAssignment1.fir.ir.txt @@ -18,11 +18,11 @@ FILE fqName: fileName:/augmentedAssignment1.kt BLOCK_BODY VAR name:x type:kotlin.Int [var] CONST Int type=kotlin.Int value=0 - SET_VAR 'var x: kotlin.Int [var] declared in .testVariable' type=kotlin.Unit origin=EQ + SET_VAR 'var x: kotlin.Int [var] declared in .testVariable' type=kotlin.Unit origin=PLUSEQ CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null $this: GET_VAR 'var x: kotlin.Int [var] declared in .testVariable' type=kotlin.Int origin=null other: CONST Int type=kotlin.Int value=1 - SET_VAR 'var x: kotlin.Int [var] declared in .testVariable' type=kotlin.Unit origin=EQ + SET_VAR 'var x: kotlin.Int [var] declared in .testVariable' type=kotlin.Unit origin=MINUSEQ CALL 'public final fun minus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null $this: GET_VAR 'var x: kotlin.Int [var] declared in .testVariable' type=kotlin.Int origin=null other: CONST Int type=kotlin.Int value=2 diff --git a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.ir.txt b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.ir.txt index c5821e223d1..c2d5e03e8ea 100644 --- a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.ir.txt +++ b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.ir.txt @@ -102,7 +102,7 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt WHILE label=Outer origin=WHILE_LOOP condition: CONST Boolean type=kotlin.Boolean value=true body: BLOCK type=kotlin.Unit origin=null - SET_VAR 'var i: kotlin.Int [var] declared in .test5' type=kotlin.Unit origin=EQ + SET_VAR 'var i: kotlin.Int [var] declared in .test5' type=kotlin.Unit origin=PREFIX_INCR CALL 'public final fun inc (): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null $this: GET_VAR 'var i: kotlin.Int [var] declared in .test5' type=kotlin.Int origin=null TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit @@ -112,7 +112,7 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt BLOCK type=kotlin.Unit origin=null DO_WHILE label=Inner origin=DO_WHILE_LOOP body: COMPOSITE type=kotlin.Unit origin=DO_WHILE_LOOP - SET_VAR 'var j: kotlin.Int [var] declared in .test5' type=kotlin.Unit origin=EQ + SET_VAR 'var j: kotlin.Int [var] declared in .test5' type=kotlin.Unit origin=PREFIX_INCR CALL 'public final fun inc (): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null $this: GET_VAR 'var j: kotlin.Int [var] declared in .test5' type=kotlin.Int origin=null GET_VAR 'var j: kotlin.Int [var] declared in .test5' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/expressions/breakContinueInWhen.fir.ir.txt b/compiler/testData/ir/irText/expressions/breakContinueInWhen.fir.ir.txt index 13fe5ef5fe1..cc22f20c9c3 100644 --- a/compiler/testData/ir/irText/expressions/breakContinueInWhen.fir.ir.txt +++ b/compiler/testData/ir/irText/expressions/breakContinueInWhen.fir.ir.txt @@ -111,7 +111,7 @@ FILE fqName: fileName:/breakContinueInWhen.kt BLOCK type=kotlin.Unit origin=null DO_WHILE label=null origin=DO_WHILE_LOOP body: COMPOSITE type=kotlin.Unit origin=DO_WHILE_LOOP - SET_VAR 'var k: kotlin.Int [var] declared in .testContinueDoWhile' type=kotlin.Unit origin=EQ + SET_VAR 'var k: kotlin.Int [var] declared in .testContinueDoWhile' type=kotlin.Unit origin=PREFIX_INCR CALL 'public final fun inc (): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null $this: GET_VAR 'var k: kotlin.Int [var] declared in .testContinueDoWhile' type=kotlin.Int origin=null TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.fir.ir.txt b/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.fir.ir.txt index 31e77c7589a..16b5cec4835 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.fir.ir.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.fir.ir.txt @@ -16,7 +16,7 @@ FILE fqName: fileName:/withVarargViewedAsArray.kt CALL 'public final fun next (): kotlin.Int [operator] declared in kotlin.collections.IntIterator' type=kotlin.Int origin=FOR_LOOP_NEXT $this: GET_VAR 'val tmp_0: kotlin.collections.IntIterator [val] declared in .sum' type=kotlin.collections.IntIterator origin=null BLOCK type=kotlin.Unit origin=null - SET_VAR 'var result: kotlin.Int [var] declared in .sum' type=kotlin.Unit origin=EQ + SET_VAR 'var result: kotlin.Int [var] declared in .sum' type=kotlin.Unit origin=PLUSEQ CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null $this: GET_VAR 'var result: kotlin.Int [var] declared in .sum' type=kotlin.Int origin=null other: GET_VAR 'val arg: kotlin.Int [val] declared in .sum' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.fir.ir.txt b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.fir.ir.txt index 54f47566392..0db692b1e28 100644 --- a/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.fir.ir.txt +++ b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.fir.ir.txt @@ -121,10 +121,10 @@ FILE fqName: fileName:/complexAugmentedAssignment.kt VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.IntArray [val] GET_VAR 'a: kotlin.IntArray declared in .test1' type=kotlin.IntArray origin=null VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.Int [val] - BLOCK type=kotlin.Int origin=null + BLOCK type=kotlin.Int origin=POSTFIX_INCR VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:kotlin.Int [val] GET_VAR 'var i: kotlin.Int [var] declared in .test1' type=kotlin.Int origin=null - SET_VAR 'var i: kotlin.Int [var] declared in .test1' type=kotlin.Unit origin=EQ + SET_VAR 'var i: kotlin.Int [var] declared in .test1' type=kotlin.Unit origin=POSTFIX_INCR CALL 'public final fun inc (): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null $this: GET_VAR 'val tmp_2: kotlin.Int [val] declared in .test1' type=kotlin.Int origin=null GET_VAR 'val tmp_2: kotlin.Int [val] declared in .test1' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/expressions/field.fir.ir.txt b/compiler/testData/ir/irText/expressions/field.fir.ir.txt index c6a52440ff4..52eb0250973 100644 --- a/compiler/testData/ir/irText/expressions/field.fir.ir.txt +++ b/compiler/testData/ir/irText/expressions/field.fir.ir.txt @@ -27,7 +27,7 @@ FILE fqName: fileName:/field.kt correspondingProperty: PROPERTY name:testAugmented visibility:public modality:FINAL [var] VALUE_PARAMETER name:value index:0 type:kotlin.Int BLOCK_BODY - SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:testAugmented type:kotlin.Int visibility:private [static]' type=kotlin.Unit origin=EQ + SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:testAugmented type:kotlin.Int visibility:private [static]' type=kotlin.Unit origin=PLUSEQ value: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null $this: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:testAugmented type:kotlin.Int visibility:private [static]' type=kotlin.Int origin=GET_PROPERTY other: GET_VAR 'value: kotlin.Int declared in .' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/expressions/incrementDecrement.fir.ir.txt b/compiler/testData/ir/irText/expressions/incrementDecrement.fir.ir.txt index 40649dcdb01..cac8139d58d 100644 --- a/compiler/testData/ir/irText/expressions/incrementDecrement.fir.ir.txt +++ b/compiler/testData/ir/irText/expressions/incrementDecrement.fir.ir.txt @@ -32,14 +32,14 @@ FILE fqName: fileName:/incrementDecrement.kt VAR name:x type:kotlin.Int [var] CONST Int type=kotlin.Int value=0 VAR name:x1 type:kotlin.Int [val] - BLOCK type=kotlin.Int origin=null - SET_VAR 'var x: kotlin.Int [var] declared in .testVarPrefix' type=kotlin.Unit origin=EQ + BLOCK type=kotlin.Int origin=PREFIX_INCR + SET_VAR 'var x: kotlin.Int [var] declared in .testVarPrefix' type=kotlin.Unit origin=PREFIX_INCR CALL 'public final fun inc (): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null $this: GET_VAR 'var x: kotlin.Int [var] 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 - SET_VAR 'var x: kotlin.Int [var] declared in .testVarPrefix' type=kotlin.Unit origin=EQ + BLOCK type=kotlin.Int origin=PREFIX_DECR + SET_VAR 'var x: kotlin.Int [var] declared in .testVarPrefix' type=kotlin.Unit origin=PREFIX_DECR CALL 'public final fun dec (): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null $this: GET_VAR 'var x: kotlin.Int [var] declared in .testVarPrefix' type=kotlin.Int origin=null GET_VAR 'var x: kotlin.Int [var] declared in .testVarPrefix' type=kotlin.Int origin=null @@ -48,18 +48,18 @@ FILE fqName: fileName:/incrementDecrement.kt VAR name:x type:kotlin.Int [var] CONST Int type=kotlin.Int value=0 VAR name:x1 type:kotlin.Int [val] - BLOCK type=kotlin.Int origin=null + BLOCK type=kotlin.Int origin=POSTFIX_INCR VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int [val] GET_VAR 'var x: kotlin.Int [var] declared in .testVarPostfix' type=kotlin.Int origin=null - SET_VAR 'var x: kotlin.Int [var] declared in .testVarPostfix' type=kotlin.Unit origin=EQ + SET_VAR 'var x: kotlin.Int [var] declared in .testVarPostfix' type=kotlin.Unit origin=POSTFIX_INCR 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 .testVarPostfix' type=kotlin.Int origin=null GET_VAR 'val tmp_0: kotlin.Int [val] declared in .testVarPostfix' type=kotlin.Int origin=null VAR name:x2 type:kotlin.Int [val] - BLOCK type=kotlin.Int origin=null + BLOCK type=kotlin.Int origin=POSTFIX_DECR VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.Int [val] GET_VAR 'var x: kotlin.Int [var] declared in .testVarPostfix' type=kotlin.Int origin=null - SET_VAR 'var x: kotlin.Int [var] declared in .testVarPostfix' type=kotlin.Unit origin=EQ + SET_VAR 'var x: kotlin.Int [var] declared in .testVarPostfix' type=kotlin.Unit origin=POSTFIX_DECR CALL 'public final fun dec (): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null $this: GET_VAR 'val tmp_1: kotlin.Int [val] declared in .testVarPostfix' type=kotlin.Int origin=null GET_VAR 'val tmp_1: kotlin.Int [val] declared in .testVarPostfix' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/expressions/whileDoWhile.fir.ir.txt b/compiler/testData/ir/irText/expressions/whileDoWhile.fir.ir.txt index 58c14713878..8aeb6a9081f 100644 --- a/compiler/testData/ir/irText/expressions/whileDoWhile.fir.ir.txt +++ b/compiler/testData/ir/irText/expressions/whileDoWhile.fir.ir.txt @@ -12,10 +12,10 @@ FILE fqName: fileName:/whileDoWhile.kt condition: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT arg0: GET_VAR 'var x: kotlin.Int [var] declared in .test' type=kotlin.Int origin=null arg1: CONST Int type=kotlin.Int value=5 - body: BLOCK type=kotlin.Int origin=null + body: BLOCK type=kotlin.Int origin=POSTFIX_INCR VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int [val] GET_VAR 'var x: kotlin.Int [var] declared in .test' type=kotlin.Int origin=null - SET_VAR 'var x: kotlin.Int [var] declared in .test' type=kotlin.Unit origin=EQ + SET_VAR 'var x: kotlin.Int [var] declared in .test' type=kotlin.Unit origin=POSTFIX_INCR 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 .test' type=kotlin.Int origin=null GET_VAR 'val tmp_0: kotlin.Int [val] declared in .test' type=kotlin.Int origin=null @@ -26,7 +26,7 @@ FILE fqName: fileName:/whileDoWhile.kt body: BLOCK type=kotlin.Int origin=null VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.Int [val] GET_VAR 'var x: kotlin.Int [var] declared in .test' type=kotlin.Int origin=null - SET_VAR 'var x: kotlin.Int [var] declared in .test' type=kotlin.Unit origin=EQ + SET_VAR 'var x: kotlin.Int [var] declared in .test' type=kotlin.Unit origin=POSTFIX_INCR CALL 'public final fun inc (): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null $this: GET_VAR 'val tmp_1: kotlin.Int [val] declared in .test' type=kotlin.Int origin=null GET_VAR 'val tmp_1: kotlin.Int [val] declared in .test' type=kotlin.Int origin=null @@ -38,10 +38,10 @@ FILE fqName: fileName:/whileDoWhile.kt arg1: CONST Int type=kotlin.Int value=0 BLOCK type=kotlin.Unit origin=null DO_WHILE label=null origin=DO_WHILE_LOOP - body: BLOCK type=kotlin.Int origin=null + body: BLOCK type=kotlin.Int origin=POSTFIX_INCR VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:kotlin.Int [val] GET_VAR 'var x: kotlin.Int [var] declared in .test' type=kotlin.Int origin=null - SET_VAR 'var x: kotlin.Int [var] declared in .test' type=kotlin.Unit origin=EQ + SET_VAR 'var x: kotlin.Int [var] declared in .test' type=kotlin.Unit origin=POSTFIX_INCR CALL 'public final fun inc (): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null $this: GET_VAR 'val tmp_2: kotlin.Int [val] declared in .test' type=kotlin.Int origin=null GET_VAR 'val tmp_2: kotlin.Int [val] declared in .test' type=kotlin.Int origin=null @@ -53,7 +53,7 @@ FILE fqName: fileName:/whileDoWhile.kt body: COMPOSITE type=kotlin.Unit origin=DO_WHILE_LOOP VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:kotlin.Int [val] GET_VAR 'var x: kotlin.Int [var] declared in .test' type=kotlin.Int origin=null - SET_VAR 'var x: kotlin.Int [var] declared in .test' type=kotlin.Unit origin=EQ + SET_VAR 'var x: kotlin.Int [var] declared in .test' type=kotlin.Unit origin=POSTFIX_INCR 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' type=kotlin.Int origin=null GET_VAR 'val tmp_3: kotlin.Int [val] declared in .test' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/firProblems/ArrayMap.fir.ir.txt b/compiler/testData/ir/irText/firProblems/ArrayMap.fir.ir.txt index 9d9a221563e..8f8947feb36 100644 --- a/compiler/testData/ir/irText/firProblems/ArrayMap.fir.ir.txt +++ b/compiler/testData/ir/irText/firProblems/ArrayMap.fir.ir.txt @@ -548,7 +548,7 @@ FILE fqName: fileName:/ArrayMap.kt VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.Int [val] CALL 'private final fun (): kotlin.Int declared in .ArrayMapImpl.iterator.' type=kotlin.Int origin=GET_PROPERTY $this: GET_VAR ': .ArrayMapImpl.iterator..ArrayMapImpl> declared in .ArrayMapImpl.iterator..computeNext' type=.ArrayMapImpl.iterator..ArrayMapImpl> origin=null - CALL 'private final fun (: kotlin.Int): kotlin.Unit declared in .ArrayMapImpl.iterator.' type=kotlin.Unit origin=EQ + CALL 'private final fun (: kotlin.Int): kotlin.Unit declared in .ArrayMapImpl.iterator.' type=kotlin.Unit origin=POSTFIX_INCR $this: GET_VAR ': .ArrayMapImpl.iterator..ArrayMapImpl> declared in .ArrayMapImpl.iterator..computeNext' type=.ArrayMapImpl.iterator..ArrayMapImpl> origin=null : CALL 'public final fun inc (): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null $this: GET_VAR 'val tmp_1: kotlin.Int [val] declared in .ArrayMapImpl.iterator..computeNext' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/lambdas/localFunction.fir.ir.txt b/compiler/testData/ir/irText/lambdas/localFunction.fir.ir.txt index a0c8bcdf725..9e75ddd7bde 100644 --- a/compiler/testData/ir/irText/lambdas/localFunction.fir.ir.txt +++ b/compiler/testData/ir/irText/lambdas/localFunction.fir.ir.txt @@ -7,7 +7,7 @@ FILE fqName: fileName:/localFunction.kt BLOCK_BODY VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int [val] GET_VAR 'var x: kotlin.Int [var] declared in .outer' type=kotlin.Int origin=null - SET_VAR 'var x: kotlin.Int [var] declared in .outer' type=kotlin.Unit origin=EQ + SET_VAR 'var x: kotlin.Int [var] declared in .outer' type=kotlin.Unit origin=POSTFIX_INCR 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 .outer.local' type=kotlin.Int origin=null TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit diff --git a/compiler/testData/ir/irText/regressions/coercionInLoop.fir.ir.txt b/compiler/testData/ir/irText/regressions/coercionInLoop.fir.ir.txt index 781d3d6ed74..f25522f3895 100644 --- a/compiler/testData/ir/irText/regressions/coercionInLoop.fir.ir.txt +++ b/compiler/testData/ir/irText/regressions/coercionInLoop.fir.ir.txt @@ -28,7 +28,7 @@ FILE fqName: fileName:/coercionInLoop.kt GET_VAR 'var i: kotlin.Int [var] declared in .box' type=kotlin.Int origin=null VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int [val] GET_VAR 'var i: kotlin.Int [var] declared in .box' type=kotlin.Int origin=null - SET_VAR 'var i: kotlin.Int [var] declared in .box' type=kotlin.Unit origin=EQ + SET_VAR 'var i: kotlin.Int [var] declared in .box' type=kotlin.Unit origin=POSTFIX_INCR 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 .box' type=kotlin.Int origin=null GET_VAR 'val tmp_0: kotlin.Int [val] declared in .box' type=kotlin.Int origin=null