From 64d630faa3591fe9d46842f948f22a9da6a3daa2 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Thu, 18 Aug 2016 17:53:04 +0300 Subject: [PATCH] Detailed "operator" convention information (for JS). --- .../kotlin/psi2ir/Psi2IrTranslator.kt | 2 +- .../psi2ir/generators/IrCallGenerator.kt | 8 +- .../generators/IrDeclarationGenerator.kt | 2 +- .../generators/IrOperatorConventions.kt | 9 +- .../IrOperatorExpressionGenerator.kt | 14 ++-- .../psi2ir/generators/IrStatementGenerator.kt | 7 +- .../generators/values/IrIndexedLValue.kt | 47 +++++++---- .../psi2ir/generators/values/IrValue.kt | 5 +- .../transformations/InlineDesugaredBlocks.kt | 4 +- .../ir/expressions/IrBlockExpression.kt | 4 +- .../kotlin/ir/expressions/IrOperator.kt | 82 +++++++++++-------- .../ir/expressions/IrOperatorExpression.kt | 10 ++- .../kotlin/ir/util/RenderIrElement.kt | 18 ++-- .../testData/ir/irText/arrayAssignment.kt | 6 ++ .../testData/ir/irText/arrayAssignment.txt | 19 ++++- .../ir/irText/arrayAugmentedAssignment1.kt | 3 +- .../ir/irText/arrayAugmentedAssignment1.txt | 64 ++++++++++----- .../ir/irText/arrayAugmentedAssignment2.txt | 21 ++--- compiler/testData/ir/irText/assignments.txt | 14 ++-- .../ir/irText/augmentedAssignment1.txt | 44 +++++----- .../ir/irText/augmentedAssignment2.kt | 2 +- .../ir/irText/augmentedAssignment2.txt | 40 ++++----- compiler/testData/ir/irText/boxOk.txt | 2 +- .../ir/irText/callWithReorderedArguments.txt | 44 +++++----- compiler/testData/ir/irText/calls.txt | 38 ++++----- .../ir/irText/conventionComparisons.txt | 24 +++--- .../testData/ir/irText/destructuring1.txt | 23 +++--- compiler/testData/ir/irText/dotQualified.txt | 12 +-- compiler/testData/ir/irText/elvis.txt | 18 ++-- compiler/testData/ir/irText/equality.txt | 18 ++-- .../ir/irText/extensionPropertyGetterCall.txt | 6 +- compiler/testData/ir/irText/identity.txt | 18 ++-- compiler/testData/ir/irText/in.txt | 24 +++--- .../testData/ir/irText/incrementDecrement.txt | 72 ++++++++-------- .../ir/irText/primitiveComparisons.txt | 24 +++--- compiler/testData/ir/irText/references.txt | 26 +++--- .../testData/ir/irText/simpleOperators.kt | 6 ++ .../testData/ir/irText/simpleOperators.txt | 71 ++++++++++++---- compiler/testData/ir/irText/smartCasts.txt | 46 +++++------ .../ir/irText/smartCastsWithDestructuring.txt | 25 +++--- compiler/testData/ir/irText/smoke.txt | 8 +- compiler/testData/ir/irText/stringPlus.txt | 20 ++--- 42 files changed, 529 insertions(+), 421 deletions(-) diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/Psi2IrTranslator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/Psi2IrTranslator.kt index f2deff25f93..a99f948c832 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/Psi2IrTranslator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/Psi2IrTranslator.kt @@ -28,7 +28,7 @@ import org.jetbrains.kotlin.resolve.BindingContext class Psi2IrTranslator(val configuration: Configuration = Configuration()) { class Configuration( - val shouldInlineDesugaredBlocks: Boolean = true, + val shouldInlineDesugaredBlocks: Boolean = false, val shouldFoldStringConcatenation: Boolean = true ) diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/IrCallGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/IrCallGenerator.kt index 0d8df069405..3e81a904844 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/IrCallGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/IrCallGenerator.kt @@ -161,11 +161,9 @@ class IrCallGenerator(val irStatementGenerator: IrStatementGenerator) : IrGenera val valueArgumentsInEvaluationOrder = resolvedCall.valueArguments.values val valueParameters = resolvedCall.resultingDescriptor.valueParameters - val irBlock = IrBlockExpressionImpl(ktExpression.startOffset, ktExpression.endOffset, resultType, - hasResult = isUsedAsExpression(ktExpression), - isDesugared = true) - - + val hasResult = isUsedAsExpression(ktExpression) + val irBlock = IrBlockExpressionImpl(ktExpression.startOffset, ktExpression.endOffset, resultType, hasResult, + IrOperator.SYNTHETIC_BLOCK) val valueArgumentsToValueParameters = HashMap() for ((index, valueArgument) in resolvedCall.valueArgumentsByIndex!!.withIndex()) { diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/IrDeclarationGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/IrDeclarationGenerator.kt index 3a1aef75301..ec70cfafcac 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/IrDeclarationGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/IrDeclarationGenerator.kt @@ -150,7 +150,7 @@ class IrDeclarationGenerator(override val context: IrGeneratorContext) : IrGener if (ktBody is KtBlockExpression) irRhs else - IrBlockExpressionImpl(ktBody.startOffset, ktBody.endOffset, null, hasResult = false, isDesugared = true).apply { + IrBlockExpressionImpl(ktBody.startOffset, ktBody.endOffset, null, false).apply { addStatement(IrReturnExpressionImpl(ktBody.startOffset, ktBody.endOffset, scopeOwner, irRhs)) } return IrExpressionBodyImpl(ktBody.startOffset, ktBody.endOffset, irExpressionBody) diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/IrOperatorConventions.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/IrOperatorConventions.kt index 9bfb0511586..ece98b48d4d 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/IrOperatorConventions.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/IrOperatorConventions.kt @@ -17,11 +17,12 @@ package org.jetbrains.kotlin.psi2ir.generators import com.intellij.psi.tree.IElementType +import org.jetbrains.kotlin.ir.expressions.IrBinaryOperator import org.jetbrains.kotlin.ir.expressions.IrOperator import org.jetbrains.kotlin.lexer.KtTokens -fun getIrBinaryOperator(ktOperator: IElementType): IrOperator? = +fun getIrBinaryOperator(ktOperator: IElementType): IrBinaryOperator? = KT_TOKEN_TO_IR_BINARY_OPERATOR[ktOperator] fun getIrPrefixOperator(ktOperator: IElementType): IrOperator? = @@ -30,7 +31,7 @@ fun getIrPrefixOperator(ktOperator: IElementType): IrOperator? = fun getIrPostfixOperator(ktOperator: IElementType): IrOperator? = KT_TOKEN_TO_IR_POSTFIX_OPERATOR[ktOperator] -private val KT_TOKEN_TO_IR_BINARY_OPERATOR = mapOf( +private val KT_TOKEN_TO_IR_BINARY_OPERATOR = mapOf( KtTokens.EQ to IrOperator.EQ, KtTokens.PLUSEQ to IrOperator.PLUSEQ, @@ -66,14 +67,14 @@ private val KT_TOKEN_TO_IR_BINARY_OPERATOR = mapOf( KtTokens.ELVIS to IrOperator.ELVIS ) -private val KT_TOKEN_TO_IR_PREFIX_OPERATOR = mapOf( +private val KT_TOKEN_TO_IR_PREFIX_OPERATOR = mapOf( KtTokens.PLUSPLUS to IrOperator.PREFIX_INCR, KtTokens.MINUSMINUS to IrOperator.PREFIX_DECR, KtTokens.EXCL to IrOperator.EXCL, KtTokens.MINUS to IrOperator.UMINUS ) -private val KT_TOKEN_TO_IR_POSTFIX_OPERATOR = mapOf( +private val KT_TOKEN_TO_IR_POSTFIX_OPERATOR = mapOf( KtTokens.PLUSPLUS to IrOperator.POSTFIX_INCR, KtTokens.MINUSMINUS to IrOperator.POSTFIX_DECR, KtTokens.EXCLEXCL to IrOperator.EXCLEXCL diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/IrOperatorExpressionGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/IrOperatorExpressionGenerator.kt index 911d3fe0e6d..148a9ce8839 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/IrOperatorExpressionGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/IrOperatorExpressionGenerator.kt @@ -78,7 +78,7 @@ class IrOperatorExpressionGenerator(val irStatementGenerator: IrStatementGenerat ) } - private fun generateBinaryBooleanOperator(expression: KtBinaryExpression, irOperator: IrOperator): IrExpression { + private fun generateBinaryBooleanOperator(expression: KtBinaryExpression, irOperator: IrBinaryOperator): IrExpression { val irArgument0 = irStatementGenerator.generateExpression(expression.left!!).toExpectedType(context.builtIns.booleanType) val irArgument1 = irStatementGenerator.generateExpression(expression.right!!).toExpectedType(context.builtIns.booleanType) return IrBinaryOperatorExpressionImpl( @@ -99,7 +99,7 @@ class IrOperatorExpressionGenerator(val irStatementGenerator: IrStatementGenerat IrOperator.EXCL, null, irOperatorCall) } - private fun generateIdentityOperator(expression: KtBinaryExpression, irOperator: IrOperator): IrExpression { + private fun generateIdentityOperator(expression: KtBinaryExpression, irOperator: IrBinaryOperator): IrExpression { val irArgument0 = irStatementGenerator.generateExpression(expression.left!!) val irArgument1 = irStatementGenerator.generateExpression(expression.right!!) return IrBinaryOperatorExpressionImpl( @@ -108,7 +108,7 @@ class IrOperatorExpressionGenerator(val irStatementGenerator: IrStatementGenerat ) } - private fun generateEqualityOperator(expression: KtBinaryExpression, irOperator: IrOperator): IrExpression { + private fun generateEqualityOperator(expression: KtBinaryExpression, irOperator: IrBinaryOperator): IrExpression { val relatedCall = getResolvedCall(expression)!! val relatedDescriptor = relatedCall.resultingDescriptor @@ -133,7 +133,7 @@ class IrOperatorExpressionGenerator(val irStatementGenerator: IrStatementGenerat ) } - private fun generateComparisonOperator(expression: KtBinaryExpression, irOperator: IrOperator): IrExpression { + private fun generateComparisonOperator(expression: KtBinaryExpression, irOperator: IrBinaryOperator): IrExpression { val relatedCall = getResolvedCall(expression)!! val relatedDescriptor = relatedCall.resultingDescriptor @@ -158,11 +158,11 @@ class IrOperatorExpressionGenerator(val irStatementGenerator: IrStatementGenerat val operatorCall = getResolvedCall(expression)!! if (irLValue is IrLValueWithAugmentedStore) { - return irLValue.prefixAugmentedStore(operatorCall) + return irLValue.prefixAugmentedStore(operatorCall, irOperator) } val opCallGenerator = IrCallGenerator(irStatementGenerator).apply { putValue(ktBaseExpression, irLValue) } - val irBlock = IrBlockExpressionImpl(expression.startOffset, expression.endOffset, irLValue.type, true, true) + val irBlock = IrBlockExpressionImpl(expression.startOffset, expression.endOffset, irLValue.type, true, irOperator) val irOpCall = opCallGenerator.generateCall(expression, operatorCall, irOperator) val irTmp = irStatementGenerator.temporaryVariableFactory.createTemporaryVariable(irOpCall) irBlock.addStatement(irTmp) @@ -179,7 +179,7 @@ class IrOperatorExpressionGenerator(val irStatementGenerator: IrStatementGenerat val isSimpleAssignment = get(BindingContext.VARIABLE_REASSIGNMENT, expression) ?: false if (isSimpleAssignment && irLValue is IrLValueWithAugmentedStore) { - return irLValue.augmentedStore(operatorCall, irStatementGenerator.generateExpression(expression.right!!)) + return irLValue.augmentedStore(operatorCall, irOperator, irStatementGenerator.generateExpression(expression.right!!)) } val opCallGenerator = IrCallGenerator(irStatementGenerator).apply { putValue(ktLeft, irLValue) } diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/IrStatementGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/IrStatementGenerator.kt index 1a6987b82e6..697ac3009ff 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/IrStatementGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/IrStatementGenerator.kt @@ -72,8 +72,7 @@ class IrStatementGenerator( override fun visitDestructuringDeclaration(multiDeclaration: KtDestructuringDeclaration, data: Nothing?): IrStatement { // TODO use some special form that introduces multiple declarations into surrounding scope? - val irBlock = IrBlockExpressionImpl(multiDeclaration.startOffset, multiDeclaration.endOffset, null, - hasResult = false, isDesugared = true) + val irBlock = IrBlockExpressionImpl(multiDeclaration.startOffset, multiDeclaration.endOffset, null, false, IrOperator.SYNTHETIC_BLOCK) val ktInitializer = multiDeclaration.initializer!! val irTmpInitializer = temporaryVariableFactory.createTemporaryVariable(ktInitializer.genExpr()) irBlock.addStatement(irTmpInitializer) @@ -94,8 +93,8 @@ class IrStatementGenerator( } override fun visitBlockExpression(expression: KtBlockExpression, data: Nothing?): IrStatement { - val irBlock = IrBlockExpressionImpl(expression.startOffset, expression.endOffset, getReturnType(expression), - hasResult = isUsedAsExpression(expression), isDesugared = false) + val irBlock = IrBlockExpressionImpl(expression.startOffset, expression.endOffset, + getReturnType(expression), isUsedAsExpression(expression)) expression.statements.forEach { irBlock.addStatement(it.genStmt()) } return irBlock } diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/values/IrIndexedLValue.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/values/IrIndexedLValue.kt index c5e679e74ab..868bcb327fc 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/values/IrIndexedLValue.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/values/IrIndexedLValue.kt @@ -51,26 +51,22 @@ class IrIndexedLValue( private fun generateGetOrSetCallAsDesugaredBlock(call: ResolvedCall<*>, irArgument: IrExpression? = null): IrExpression { val callGenerator = IrCallGenerator(irStatementGenerator) - - val hasResult = irArgument == null - val irBlock = createDesugaredBlock(call, callGenerator, hasResult) + setupCallGeneratorContext(callGenerator) if (irArgument != null) { callGenerator.putValue(call.resultingDescriptor.valueParameters.last(), IrSingleExpressionValue(irArgument)) } - irBlock.addStatement(callGenerator.generateCall(ktArrayAccessExpression, call, irOperator)) - - return irBlock + return callGenerator.generateCall(ktArrayAccessExpression, call, irOperator) } - override fun prefixAugmentedStore(operatorCall: ResolvedCall<*>): IrExpression { + override fun prefixAugmentedStore(operatorCall: ResolvedCall<*>, irOperator: IrOperator): IrExpression { if (indexedGetCall == null) throw AssertionError("Indexed LValue has no 'get' call: ${ktArrayAccessExpression.text}") if (indexedSetCall == null) throw AssertionError("Indexed LValue has no 'set' call: ${ktArrayAccessExpression.text}") val callGenerator = IrCallGenerator(irStatementGenerator) - val irBlock = createDesugaredBlock(indexedSetCall, callGenerator, true) + val irBlock = createDesugaredBlockWithTemporaries(indexedSetCall, callGenerator, true, irOperator) val operatorCallReceiver = operatorCall.extensionReceiver ?: operatorCall.dispatchReceiver callGenerator.putValue(operatorCallReceiver!!, @@ -89,13 +85,13 @@ class IrIndexedLValue( return irBlock } - override fun augmentedStore(operatorCall: ResolvedCall<*>, irOperatorArgument: IrExpression): IrExpression { + override fun augmentedStore(operatorCall: ResolvedCall<*>, irOperator: IrOperator, irOperatorArgument: IrExpression): IrExpression { if (indexedGetCall == null) throw AssertionError("Indexed LValue has no 'get' call: ${ktArrayAccessExpression.text}") if (indexedSetCall == null) throw AssertionError("Indexed LValue has no 'set' call: ${ktArrayAccessExpression.text}") val callGenerator = IrCallGenerator(irStatementGenerator) - val irBlock = createDesugaredBlock(indexedSetCall, callGenerator, false) + val irBlock = createDesugaredBlockWithTemporaries(indexedSetCall, callGenerator, false, irOperator) callGenerator.putValue(operatorCall.resultingDescriptor.valueParameters[0], IrSingleExpressionValue(irOperatorArgument)) @@ -111,17 +107,24 @@ class IrIndexedLValue( return irBlock } - private fun createDesugaredBlock(call: ResolvedCall<*>, callGenerator: IrCallGenerator, hasResult: Boolean): IrBlockExpressionImpl { - val irBlock = IrBlockExpressionImpl(ktArrayAccessExpression.startOffset, ktArrayAccessExpression.endOffset, - call.resultingDescriptor.returnType, - hasResult, true) - - defineContextVariables(irBlock, callGenerator) - + private fun createDesugaredBlockWithTemporaries( + call: ResolvedCall<*>, + callGenerator: IrCallGenerator, + hasResult: Boolean, + operator: IrOperator? + ): IrBlockExpressionImpl { + val irBlock = createDesugaredBlock(call, hasResult, operator) + defineTemporaryVariables(irBlock, callGenerator) return irBlock } - private fun defineContextVariables(irBlock: IrBlockExpression, callGenerator: IrCallGenerator) { + private fun createDesugaredBlock(call: ResolvedCall<*>, hasResult: Boolean, operator: IrOperator?): IrBlockExpressionImpl { + return IrBlockExpressionImpl(ktArrayAccessExpression.startOffset, ktArrayAccessExpression.endOffset, + call.resultingDescriptor.returnType, + hasResult, operator) + } + + private fun defineTemporaryVariables(irBlock: IrBlockExpression, callGenerator: IrCallGenerator) { irBlock.addIfNotNull(callGenerator.introduceTemporary(ktArrayAccessExpression.arrayExpression!!, irArray, "array")) var index = 0 @@ -129,4 +132,12 @@ class IrIndexedLValue( irBlock.addIfNotNull(callGenerator.introduceTemporary(ktIndexExpression, irIndexValue, "index${index++}")) } } + + private fun setupCallGeneratorContext(callGenerator: IrCallGenerator) { + callGenerator.putValue(ktArrayAccessExpression.arrayExpression!!, IrSingleExpressionValue(irArray)) + + for ((ktIndexExpression, irIndexValue) in indexValues) { + callGenerator.putValue(ktIndexExpression, IrSingleExpressionValue(irIndexValue)) + } + } } \ No newline at end of file diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/values/IrValue.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/values/IrValue.kt index a302aa9f092..4c7f312b211 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/values/IrValue.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/values/IrValue.kt @@ -18,6 +18,7 @@ package org.jetbrains.kotlin.psi2ir.generators.values import org.jetbrains.kotlin.ir.assertDetached import org.jetbrains.kotlin.ir.expressions.IrExpression +import org.jetbrains.kotlin.ir.expressions.IrOperator import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall import org.jetbrains.kotlin.types.KotlinType @@ -49,7 +50,7 @@ interface IrLValue : IrValue { } interface IrLValueWithAugmentedStore : IrLValue { - fun prefixAugmentedStore(operatorCall: ResolvedCall<*>): IrExpression - fun augmentedStore(operatorCall: ResolvedCall<*>, irOperatorArgument: IrExpression): IrExpression + fun prefixAugmentedStore(operatorCall: ResolvedCall<*>, irOperator: IrOperator): IrExpression + fun augmentedStore(operatorCall: ResolvedCall<*>, irOperator: IrOperator, irOperatorArgument: IrExpression): IrExpression } diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/transformations/InlineDesugaredBlocks.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/transformations/InlineDesugaredBlocks.kt index c7a8313bdeb..143ccca0be8 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/transformations/InlineDesugaredBlocks.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/transformations/InlineDesugaredBlocks.kt @@ -35,11 +35,11 @@ class InlineDesugaredBlocks : IrElementVisitor { override fun visitBlockExpression(expression: IrBlockExpression, data: Nothing?) { val transformedBlock = IrBlockExpressionImpl( expression.startOffset, expression.endOffset, expression.type, - expression.hasResult, expression.isDesugared + expression.hasResult, expression.operator ) for (statement in expression.statements) { statement.accept(this, data) - if (statement is IrBlockExpression && statement.isDesugared) { + if (statement is IrBlockExpression && statement.operator != null) { statement.statements.forEach { transformedBlock.addStatement(it.detach()) } diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrBlockExpression.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrBlockExpression.kt index 654509c7587..f04ae97d654 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrBlockExpression.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrBlockExpression.kt @@ -27,7 +27,7 @@ import java.util.* interface IrBlockExpression : IrExpression { val hasResult: Boolean - val isDesugared: Boolean + val operator: IrOperator? val statements: List fun addStatement(statement: IrStatement) @@ -42,7 +42,7 @@ class IrBlockExpressionImpl( endOffset: Int, type: KotlinType?, override val hasResult: Boolean, - override val isDesugared: Boolean + override val operator: IrOperator? = null ) : IrExpressionBase(startOffset, endOffset, type), IrBlockExpression { override val statements: MutableList = ArrayList() diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrOperator.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrOperator.kt index 10b057fe254..c5f382fba2b 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrOperator.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrOperator.kt @@ -16,51 +16,54 @@ package org.jetbrains.kotlin.ir.expressions -abstract class IrOperator(val debugName: String) { - override fun toString(): String = debugName +interface IrOperator { + object UMINUS : IrOperatorImpl("UMINUS"), IrUnaryOperator + object EXCL : IrOperatorImpl("EXCL"), IrUnaryOperator + object EXCLEXCL : IrOperatorImpl("EXCLEXCL"), IrUnaryOperator - object INVOKE : IrOperator("INVOKE") + object ELVIS : IrOperatorImpl("ELVIS"), IrBinaryOperator - object PREFIX_INCR : IrOperator("PREFIX_INCR") - object PREFIX_DECR : IrOperator("PREFIX_DECR") - object POSTFIX_INCR : IrOperator("POSTFIX_INCR") - object POSTFIX_DECR : IrOperator("POSTFIX_DECR") + object LT : IrOperatorImpl("LT"), IrBinaryOperator + object GT : IrOperatorImpl("GT"), IrBinaryOperator + object LTEQ : IrOperatorImpl("LTEQ"), IrBinaryOperator + object GTEQ : IrOperatorImpl("GTEQ"), IrBinaryOperator - object UMINUS : IrOperator("UMINUS") - object EXCL : IrOperator("EXCL") - object EXCLEXCL : IrOperator("EXCLEXCL") - object ELVIS : IrOperator("ELVIS") + object EQEQ : IrOperatorImpl("EQEQ"), IrBinaryOperator + object EQEQEQ : IrOperatorImpl("EQEQEQ"), IrBinaryOperator + object EXCLEQ : IrOperatorImpl("EXCLEQ"), IrBinaryOperator + object EXCLEQEQ : IrOperatorImpl("EXCLEQEQ"), IrBinaryOperator - object LT : IrOperator("LT") - object GT : IrOperator("GT") - object LTEQ : IrOperator("LTEQ") - object GTEQ : IrOperator("GTEQ") + object IN : IrOperatorImpl("IN"), IrBinaryOperator + object NOT_IN : IrOperatorImpl("NOT_IN"), IrBinaryOperator + object ANDAND : IrOperatorImpl("ANDAND"), IrBinaryOperator + object OROR : IrOperatorImpl("OROR"), IrBinaryOperator - object EQEQ : IrOperator("EQEQ") - object EQEQEQ : IrOperator("EQEQEQ") - object EXCLEQ : IrOperator("EXCLEQ") - object EXCLEQEQ : IrOperator("EXCLEQEQ") - object IN : IrOperator("IN") - object NOT_IN : IrOperator("NOT_IN") - object ANDAND : IrOperator("ANDAND") - object OROR : IrOperator("OROR") - object RANGE : IrOperator("RANGE") - object PLUS : IrOperator("PLUS") - object MINUS : IrOperator("MINUS") - object MUL : IrOperator("MUL") - object DIV : IrOperator("DIV") - object PERC : IrOperator("PERC") + object PLUS : IrOperatorImpl("PLUS"), IrBinaryOperator + object MINUS : IrOperatorImpl("MINUS"), IrBinaryOperator + object MUL : IrOperatorImpl("MUL"), IrBinaryOperator + object DIV : IrOperatorImpl("DIV"), IrBinaryOperator + object PERC : IrOperatorImpl("PERC"), IrBinaryOperator + object RANGE : IrOperatorImpl("RANGE"), IrBinaryOperator - object EQ : IrOperator("EQ") - object PLUSEQ : IrOperator("PLUSEQ") - object MINUSEQ : IrOperator("MINUSEQ") - object MULTEQ : IrOperator("MULTEQ") - object DIVEQ : IrOperator("DIVEQ") - object PERCEQ : IrOperator("PERCEQ") + object INVOKE : IrOperatorImpl("INVOKE"), IrUnaryOperator - data class COMPONENT_N private constructor(val index: Int) : IrOperator("COMPONENT_$index") { + object PREFIX_INCR : IrOperatorImpl("PREFIX_INCR"), IrUnaryOperator + object PREFIX_DECR : IrOperatorImpl("PREFIX_DECR"), IrUnaryOperator + object POSTFIX_INCR : IrOperatorImpl("POSTFIX_INCR"), IrUnaryOperator + object POSTFIX_DECR : IrOperatorImpl("POSTFIX_DECR"), IrUnaryOperator + + object EQ : IrOperatorImpl("EQ"), IrBinaryOperator + object PLUSEQ : IrOperatorImpl("PLUSEQ"), IrBinaryOperator + object MINUSEQ : IrOperatorImpl("MINUSEQ"), IrBinaryOperator + object MULTEQ : IrOperatorImpl("MULTEQ"), IrBinaryOperator + object DIVEQ : IrOperatorImpl("DIVEQ"), IrBinaryOperator + object PERCEQ : IrOperatorImpl("PERCEQ"), IrBinaryOperator + + object SYNTHETIC_BLOCK : IrOperatorImpl("SYNTHETIC_BLOCK") + + data class COMPONENT_N private constructor(val index: Int) : IrOperatorImpl("COMPONENT_$index") { companion object { private val precreatedComponents = Array(32) { i -> COMPONENT_N(i + 1) } @@ -71,4 +74,11 @@ abstract class IrOperator(val debugName: String) { COMPONENT_N(index) } } +} + +interface IrUnaryOperator : IrOperator +interface IrBinaryOperator : IrOperator + +abstract class IrOperatorImpl(val debugName: String): IrOperator { + override fun toString(): String = debugName } \ No newline at end of file diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrOperatorExpression.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrOperatorExpression.kt index c5c9e5c31d4..b91cb6d80ef 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrOperatorExpression.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrOperatorExpression.kt @@ -27,10 +27,12 @@ interface IrOperatorExpression : IrExpression { } interface IrUnaryOperatorExpression : IrOperatorExpression { + override val operator: IrUnaryOperator var argument: IrExpression } interface IrBinaryOperatorExpression : IrOperatorExpression { + override val operator: IrBinaryOperator var argument0: IrExpression var argument1: IrExpression } @@ -39,14 +41,14 @@ class IrUnaryOperatorExpressionImpl( startOffset: Int, endOffset: Int, type: KotlinType?, - override val operator: IrOperator, + override val operator: IrUnaryOperator, override val relatedDescriptor: CallableDescriptor? ) : IrExpressionBase(startOffset, endOffset, type), IrUnaryOperatorExpression { constructor( startOffset: Int, endOffset: Int, type: KotlinType?, - operator: IrOperator, + operator: IrUnaryOperator, relatedDescriptor: CallableDescriptor?, argument: IrExpression ) : this(startOffset, endOffset, type, operator, relatedDescriptor) { @@ -89,14 +91,14 @@ class IrBinaryOperatorExpressionImpl( startOffset: Int, endOffset: Int, type: KotlinType?, - override val operator: IrOperator, + override val operator: IrBinaryOperator, override val relatedDescriptor: CallableDescriptor? ) : IrExpressionBase(startOffset, endOffset, type), IrBinaryOperatorExpression { constructor( startOffset: Int, endOffset: Int, type: KotlinType?, - operator: IrOperator, + operator: IrBinaryOperator, relatedDescriptor: CallableDescriptor?, argument0: IrExpression, argument1: IrExpression diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/RenderIrElement.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/RenderIrElement.kt index 788c2debc69..ac4284f218c 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/RenderIrElement.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/RenderIrElement.kt @@ -64,7 +64,7 @@ class RenderIrElementVisitor : IrElementVisitor { "LITERAL ${expression.kind} type=${expression.renderType()} value='${expression.value}'" override fun visitBlockExpression(expression: IrBlockExpression, data: Nothing?): String = - "BLOCK type=${expression.renderType()} hasResult=${expression.hasResult} isDesugared=${expression.isDesugared}" + "BLOCK type=${expression.renderType()} hasResult=${expression.hasResult} operator=${expression.operator}" override fun visitReturnExpression(expression: IrReturnExpression, data: Nothing?): String = "RETURN type=${expression.renderType()}" @@ -77,17 +77,21 @@ class RenderIrElementVisitor : IrElementVisitor { override fun visitCallExpression(expression: IrCallExpression, data: Nothing?): String = "CALL ${if (expression.isSafe) "?." else "."}${expression.descriptor.name} " + - "type=${expression.renderType()} operator=${expression.operator ?: ""}" + "type=${expression.renderType()} operator=${expression.operator}" override fun visitGetProperty(expression: IrGetPropertyExpression, data: Nothing?): String = "GET_PROPERTY ${if (expression.isSafe) "?." else "."}${expression.descriptor.name} " + - "type=${expression.renderType()}" + "type=${expression.renderType()} operator=${expression.operator}" + + override fun visitSetProperty(expression: IrSetPropertyExpression, data: Nothing?): String = + "SET_PROPERTY ${if (expression.isSafe) "?." else "."}${expression.descriptor.name}" + + "type=${expression.renderType()} operator=${expression.operator}" override fun visitGetVariable(expression: IrGetVariableExpression, data: Nothing?): String = - "GET_VAR ${expression.descriptor.name} type=${expression.renderType()}" + "GET_VAR ${expression.descriptor.name} type=${expression.renderType()} operator=${expression.operator}" override fun visitSetVariable(expression: IrSetVariableExpression, data: Nothing?): String = - "SET_VAR ${expression.descriptor.name} type=${expression.renderType()}" + "SET_VAR ${expression.descriptor.name} type=${expression.renderType()} operator=${expression.operator}" override fun visitGetObjectValue(expression: IrGetObjectValueExpression, data: Nothing?): String = "GET_OBJECT ${expression.descriptor.name} type=${expression.renderType()}" @@ -95,10 +99,6 @@ class RenderIrElementVisitor : IrElementVisitor { override fun visitGetEnumValue(expression: IrGetEnumValueExpression, data: Nothing?): String = "GET_ENUM_VALUE ${expression.descriptor.name} type=${expression.renderType()}" - override fun visitSetProperty(expression: IrSetPropertyExpression, data: Nothing?): String = - "SET_PROPERTY ${if (expression.isSafe) "?." else "."}${expression.descriptor.name}" + - "type=${expression.renderType()}" - override fun visitUnaryOperator(expression: IrUnaryOperatorExpression, data: Nothing?): String = "UNARY_OP operator=${expression.operator} " + "type=${expression.renderType()} " + diff --git a/compiler/testData/ir/irText/arrayAssignment.kt b/compiler/testData/ir/irText/arrayAssignment.kt index 21f406ef952..26fec9c8b2b 100644 --- a/compiler/testData/ir/irText/arrayAssignment.kt +++ b/compiler/testData/ir/irText/arrayAssignment.kt @@ -1,4 +1,10 @@ fun test() { val x = intArrayOf(1, 2, 3) x[1] = 0 +} + +fun foo() = 1 + +fun test2() { + intArrayOf(1, 2, 3)[foo()] = 1 } \ No newline at end of file diff --git a/compiler/testData/ir/irText/arrayAssignment.txt b/compiler/testData/ir/irText/arrayAssignment.txt index b2be3bf40bd..15934e0d3d4 100644 --- a/compiler/testData/ir/irText/arrayAssignment.txt +++ b/compiler/testData/ir/irText/arrayAssignment.txt @@ -1,11 +1,24 @@ IrFile /arrayAssignment.kt IrFunction public fun test(): kotlin.Unit IrExpressionBody - BLOCK type= hasResult=false isDesugared=false + BLOCK type= hasResult=false operator=null VAR val x: kotlin.IntArray - CALL .intArrayOf type=kotlin.IntArray operator= + CALL .intArrayOf type=kotlin.IntArray operator=null elements: DUMMY vararg type=kotlin.Int CALL .set type=kotlin.Unit operator=EQ - $this: GET_VAR x type=kotlin.IntArray + $this: GET_VAR x type=kotlin.IntArray operator=null index: LITERAL Int type=kotlin.Int value='1' value: LITERAL Int type=kotlin.Int value='0' + IrFunction public fun foo(): kotlin.Int + IrExpressionBody + BLOCK type= hasResult=false operator=null + RETURN type= + LITERAL Int type=kotlin.Int value='1' + IrFunction public fun test2(): kotlin.Unit + IrExpressionBody + BLOCK type= hasResult=false operator=null + CALL .set type=kotlin.Unit operator=EQ + $this: CALL .intArrayOf type=kotlin.IntArray operator=null + elements: DUMMY vararg type=kotlin.Int + index: CALL .foo type=kotlin.Int operator=null + value: LITERAL Int type=kotlin.Int value='1' diff --git a/compiler/testData/ir/irText/arrayAugmentedAssignment1.kt b/compiler/testData/ir/irText/arrayAugmentedAssignment1.kt index dc7d54f6b74..2fabccb3a17 100644 --- a/compiler/testData/ir/irText/arrayAugmentedAssignment1.kt +++ b/compiler/testData/ir/irText/arrayAugmentedAssignment1.kt @@ -1,8 +1,9 @@ fun foo(): IntArray = intArrayOf(1, 2, 3) +fun bar() = 42 fun testVariable() { var x = foo() x[0] += 1 foo()[0] *= 2 + foo()[bar()] -= 1 } - diff --git a/compiler/testData/ir/irText/arrayAugmentedAssignment1.txt b/compiler/testData/ir/irText/arrayAugmentedAssignment1.txt index 9b719f6c33d..3c1d7596468 100644 --- a/compiler/testData/ir/irText/arrayAugmentedAssignment1.txt +++ b/compiler/testData/ir/irText/arrayAugmentedAssignment1.txt @@ -1,30 +1,50 @@ IrFile /arrayAugmentedAssignment1.kt IrFunction public fun foo(): kotlin.IntArray IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= - CALL .intArrayOf type=kotlin.IntArray operator= + CALL .intArrayOf type=kotlin.IntArray operator=null elements: DUMMY vararg type=kotlin.Int + IrFunction public fun bar(): kotlin.Int + IrExpressionBody + BLOCK type= hasResult=false operator=null + RETURN type= + LITERAL Int type=kotlin.Int value='42' IrFunction public fun testVariable(): kotlin.Unit IrExpressionBody - BLOCK type= hasResult=false isDesugared=false + BLOCK type= hasResult=false operator=null VAR var x: kotlin.IntArray - CALL .foo type=kotlin.IntArray operator= - CALL .set type=kotlin.Unit operator=PLUSEQ - $this: GET_VAR x type=kotlin.IntArray - index: LITERAL Int type=kotlin.Int value='0' - value: CALL .plus type=kotlin.Int operator=PLUSEQ - $this: CALL .get type=kotlin.Int operator=PLUSEQ - $this: GET_VAR x type=kotlin.IntArray - index: LITERAL Int type=kotlin.Int value='0' - other: LITERAL Int type=kotlin.Int value='1' - VAR val tmp0_array: kotlin.IntArray - CALL .foo type=kotlin.IntArray operator= - CALL .set type=kotlin.Unit operator=MULTEQ - $this: GET_VAR tmp0_array type=kotlin.IntArray - index: LITERAL Int type=kotlin.Int value='0' - value: CALL .times type=kotlin.Int operator=MULTEQ - $this: CALL .get type=kotlin.Int operator=MULTEQ - $this: GET_VAR tmp0_array type=kotlin.IntArray - index: LITERAL Int type=kotlin.Int value='0' - other: LITERAL Int type=kotlin.Int value='2' + CALL .foo type=kotlin.IntArray operator=null + BLOCK type=kotlin.Unit hasResult=false operator=PLUSEQ + CALL .set type=kotlin.Unit operator=PLUSEQ + $this: GET_VAR x type=kotlin.IntArray operator=null + index: LITERAL Int type=kotlin.Int value='0' + value: CALL .plus type=kotlin.Int operator=PLUSEQ + $this: CALL .get type=kotlin.Int operator=PLUSEQ + $this: GET_VAR x type=kotlin.IntArray operator=null + index: LITERAL Int type=kotlin.Int value='0' + other: LITERAL Int type=kotlin.Int value='1' + BLOCK type=kotlin.Unit hasResult=false operator=MULTEQ + VAR val tmp0_array: kotlin.IntArray + CALL .foo type=kotlin.IntArray operator=null + CALL .set type=kotlin.Unit operator=MULTEQ + $this: GET_VAR tmp0_array type=kotlin.IntArray operator=null + index: LITERAL Int type=kotlin.Int value='0' + value: CALL .times type=kotlin.Int operator=MULTEQ + $this: CALL .get type=kotlin.Int operator=MULTEQ + $this: GET_VAR tmp0_array type=kotlin.IntArray operator=null + index: LITERAL Int type=kotlin.Int value='0' + other: LITERAL Int type=kotlin.Int value='2' + BLOCK type=kotlin.Unit hasResult=false operator=MINUSEQ + VAR val tmp1_array: kotlin.IntArray + CALL .foo type=kotlin.IntArray operator=null + VAR val tmp2_index0: kotlin.Int + CALL .bar type=kotlin.Int operator=null + CALL .set type=kotlin.Unit operator=MINUSEQ + $this: GET_VAR tmp1_array type=kotlin.IntArray operator=null + index: GET_VAR tmp2_index0 type=kotlin.Int operator=null + value: CALL .minus type=kotlin.Int operator=MINUSEQ + $this: CALL .get type=kotlin.Int operator=MINUSEQ + $this: GET_VAR tmp1_array type=kotlin.IntArray operator=null + index: GET_VAR tmp2_index0 type=kotlin.Int operator=null + other: LITERAL Int type=kotlin.Int value='1' diff --git a/compiler/testData/ir/irText/arrayAugmentedAssignment2.txt b/compiler/testData/ir/irText/arrayAugmentedAssignment2.txt index e4d4f2805a0..e8d19cee655 100644 --- a/compiler/testData/ir/irText/arrayAugmentedAssignment2.txt +++ b/compiler/testData/ir/irText/arrayAugmentedAssignment2.txt @@ -3,13 +3,14 @@ IrFile /arrayAugmentedAssignment2.kt DUMMY IB IrFunction public fun IB.test(/*0*/ a: IA): kotlin.Unit IrExpressionBody - BLOCK type= hasResult=false isDesugared=false - CALL .set type=kotlin.Unit operator=PLUSEQ - $this: $RECEIVER of: test type=IB - $receiver: GET_VAR a type=IA - index: LITERAL String type=kotlin.String value='' - value: CALL .plus type=kotlin.Int operator=PLUSEQ - $this: CALL .get type=kotlin.Int operator=PLUSEQ - $this: GET_VAR a type=IA - index: LITERAL String type=kotlin.String value='' - other: LITERAL Int type=kotlin.Int value='42' + BLOCK type= hasResult=false operator=null + BLOCK type=kotlin.Unit hasResult=false operator=PLUSEQ + CALL .set type=kotlin.Unit operator=PLUSEQ + $this: $RECEIVER of: test type=IB + $receiver: GET_VAR a type=IA operator=null + index: LITERAL String type=kotlin.String value='' + value: CALL .plus type=kotlin.Int operator=PLUSEQ + $this: CALL .get type=kotlin.Int operator=PLUSEQ + $this: GET_VAR a type=IA operator=null + index: LITERAL String type=kotlin.String value='' + other: LITERAL Int type=kotlin.Int value='42' diff --git a/compiler/testData/ir/irText/assignments.txt b/compiler/testData/ir/irText/assignments.txt index c0229f64f63..1e5c79b7fd1 100644 --- a/compiler/testData/ir/irText/assignments.txt +++ b/compiler/testData/ir/irText/assignments.txt @@ -2,18 +2,18 @@ IrFile /assignments.kt DUMMY Ref IrFunction public fun test1(): kotlin.Unit IrExpressionBody - BLOCK type= hasResult=false isDesugared=false + BLOCK type= hasResult=false operator=null VAR var x: kotlin.Int LITERAL Int type=kotlin.Int value='0' - SET_VAR x type= + SET_VAR x type= operator=EQ LITERAL Int type=kotlin.Int value='1' - SET_VAR x type= + SET_VAR x type= operator=EQ CALL .plus type=kotlin.Int operator=PLUS - $this: GET_VAR x type=kotlin.Int + $this: GET_VAR x type=kotlin.Int operator=null other: LITERAL Int type=kotlin.Int value='1' IrFunction public fun test2(/*0*/ r: Ref): kotlin.Unit IrExpressionBody - BLOCK type= hasResult=false isDesugared=false - SET_PROPERTY .xtype= - $this: GET_VAR r type=Ref + BLOCK type= hasResult=false operator=null + SET_PROPERTY .xtype= operator=EQ + $this: GET_VAR r type=Ref operator=null $value: LITERAL Int type=kotlin.Int value='0' diff --git a/compiler/testData/ir/irText/augmentedAssignment1.txt b/compiler/testData/ir/irText/augmentedAssignment1.txt index 000cd9e3506..6b38bfe0df3 100644 --- a/compiler/testData/ir/irText/augmentedAssignment1.txt +++ b/compiler/testData/ir/irText/augmentedAssignment1.txt @@ -4,49 +4,49 @@ IrFile /augmentedAssignment1.kt LITERAL Int type=kotlin.Int value='0' IrFunction public fun testVariable(): kotlin.Unit IrExpressionBody - BLOCK type=kotlin.Int hasResult=true isDesugared=false + BLOCK type=kotlin.Int hasResult=true operator=null VAR var x: kotlin.Int LITERAL Int type=kotlin.Int value='0' - SET_VAR x type= + SET_VAR x type= operator=PLUSEQ CALL .plus type=kotlin.Int operator=PLUSEQ - $this: GET_VAR x type=kotlin.Int + $this: GET_VAR x type=kotlin.Int operator=PLUSEQ other: LITERAL Int type=kotlin.Int value='1' - SET_VAR x type= + SET_VAR x type= operator=MINUSEQ CALL .minus type=kotlin.Int operator=MINUSEQ - $this: GET_VAR x type=kotlin.Int + $this: GET_VAR x type=kotlin.Int operator=MINUSEQ other: LITERAL Int type=kotlin.Int value='2' - SET_VAR x type= + SET_VAR x type= operator=MULTEQ CALL .times type=kotlin.Int operator=MULTEQ - $this: GET_VAR x type=kotlin.Int + $this: GET_VAR x type=kotlin.Int operator=MULTEQ other: LITERAL Int type=kotlin.Int value='3' - SET_VAR x type= + SET_VAR x type= operator=DIVEQ CALL .div type=kotlin.Int operator=DIVEQ - $this: GET_VAR x type=kotlin.Int + $this: GET_VAR x type=kotlin.Int operator=DIVEQ other: LITERAL Int type=kotlin.Int value='4' - SET_VAR x type= + SET_VAR x type= operator=PERCEQ CALL .mod type=kotlin.Int operator=PERCEQ - $this: GET_VAR x type=kotlin.Int + $this: GET_VAR x type=kotlin.Int operator=PERCEQ other: LITERAL Int type=kotlin.Int value='5' IrFunction public fun testProperty(): kotlin.Unit IrExpressionBody - BLOCK type=kotlin.Int hasResult=true isDesugared=false - SET_PROPERTY .ptype= + BLOCK type=kotlin.Int hasResult=true operator=null + SET_PROPERTY .ptype= operator=PLUSEQ $value: CALL .plus type=kotlin.Int operator=PLUSEQ - $this: GET_PROPERTY .p type=kotlin.Int + $this: GET_PROPERTY .p type=kotlin.Int operator=PLUSEQ other: LITERAL Int type=kotlin.Int value='1' - SET_PROPERTY .ptype= + SET_PROPERTY .ptype= operator=MINUSEQ $value: CALL .minus type=kotlin.Int operator=MINUSEQ - $this: GET_PROPERTY .p type=kotlin.Int + $this: GET_PROPERTY .p type=kotlin.Int operator=MINUSEQ other: LITERAL Int type=kotlin.Int value='2' - SET_PROPERTY .ptype= + SET_PROPERTY .ptype= operator=MULTEQ $value: CALL .times type=kotlin.Int operator=MULTEQ - $this: GET_PROPERTY .p type=kotlin.Int + $this: GET_PROPERTY .p type=kotlin.Int operator=MULTEQ other: LITERAL Int type=kotlin.Int value='3' - SET_PROPERTY .ptype= + SET_PROPERTY .ptype= operator=DIVEQ $value: CALL .div type=kotlin.Int operator=DIVEQ - $this: GET_PROPERTY .p type=kotlin.Int + $this: GET_PROPERTY .p type=kotlin.Int operator=DIVEQ other: LITERAL Int type=kotlin.Int value='4' - SET_PROPERTY .ptype= + SET_PROPERTY .ptype= operator=PERCEQ $value: CALL .mod type=kotlin.Int operator=PERCEQ - $this: GET_PROPERTY .p type=kotlin.Int + $this: GET_PROPERTY .p type=kotlin.Int operator=PERCEQ other: LITERAL Int type=kotlin.Int value='5' diff --git a/compiler/testData/ir/irText/augmentedAssignment2.kt b/compiler/testData/ir/irText/augmentedAssignment2.kt index 61ebed0cbd0..d7ab839fe48 100644 --- a/compiler/testData/ir/irText/augmentedAssignment2.kt +++ b/compiler/testData/ir/irText/augmentedAssignment2.kt @@ -22,5 +22,5 @@ fun testProperty() { p -= "-=" p *= "*=" p /= "/=" - p %= "*=" + p %= "%=" } diff --git a/compiler/testData/ir/irText/augmentedAssignment2.txt b/compiler/testData/ir/irText/augmentedAssignment2.txt index 7768c051aae..2ac2f045002 100644 --- a/compiler/testData/ir/irText/augmentedAssignment2.txt +++ b/compiler/testData/ir/irText/augmentedAssignment2.txt @@ -2,57 +2,57 @@ IrFile /augmentedAssignment2.kt DUMMY A IrFunction public operator fun A.plusAssign(/*0*/ s: kotlin.String): kotlin.Unit IrExpressionBody - BLOCK type= hasResult=false isDesugared=false + BLOCK type= hasResult=false operator=null IrFunction public operator fun A.minusAssign(/*0*/ s: kotlin.String): kotlin.Unit IrExpressionBody - BLOCK type= hasResult=false isDesugared=false + BLOCK type= hasResult=false operator=null IrFunction public operator fun A.timesAssign(/*0*/ s: kotlin.String): kotlin.Unit IrExpressionBody - BLOCK type= hasResult=false isDesugared=false + BLOCK type= hasResult=false operator=null IrFunction public operator fun A.divAssign(/*0*/ s: kotlin.String): kotlin.Unit IrExpressionBody - BLOCK type= hasResult=false isDesugared=false + BLOCK type= hasResult=false operator=null IrFunction public operator fun A.modAssign(/*0*/ s: kotlin.String): kotlin.Unit IrExpressionBody - BLOCK type= hasResult=false isDesugared=false + BLOCK type= hasResult=false operator=null IrProperty public val p: A getter=null setter=null IrExpressionBody - CALL . type=A operator= + CALL . type=A operator=null IrFunction public fun testVariable(): kotlin.Unit IrExpressionBody - BLOCK type= hasResult=false isDesugared=false + BLOCK type= hasResult=false operator=null VAR val a: A - CALL . type=A operator= + CALL . type=A operator=null CALL .plusAssign type=kotlin.Unit operator=PLUSEQ - $receiver: GET_VAR a type=A + $receiver: GET_VAR a type=A operator=PLUSEQ s: LITERAL String type=kotlin.String value='+=' CALL .minusAssign type=kotlin.Unit operator=MINUSEQ - $receiver: GET_VAR a type=A + $receiver: GET_VAR a type=A operator=MINUSEQ s: LITERAL String type=kotlin.String value='-=' CALL .timesAssign type=kotlin.Unit operator=MULTEQ - $receiver: GET_VAR a type=A + $receiver: GET_VAR a type=A operator=MULTEQ s: LITERAL String type=kotlin.String value='*=' CALL .divAssign type=kotlin.Unit operator=DIVEQ - $receiver: GET_VAR a type=A + $receiver: GET_VAR a type=A operator=DIVEQ s: LITERAL String type=kotlin.String value='/=' CALL .modAssign type=kotlin.Unit operator=PERCEQ - $receiver: GET_VAR a type=A + $receiver: GET_VAR a type=A operator=PERCEQ s: LITERAL String type=kotlin.String value='*=' IrFunction public fun testProperty(): kotlin.Unit IrExpressionBody - BLOCK type= hasResult=false isDesugared=false + BLOCK type= hasResult=false operator=null CALL .plusAssign type=kotlin.Unit operator=PLUSEQ - $receiver: GET_PROPERTY .p type=A + $receiver: GET_PROPERTY .p type=A operator=PLUSEQ s: LITERAL String type=kotlin.String value='+=' CALL .minusAssign type=kotlin.Unit operator=MINUSEQ - $receiver: GET_PROPERTY .p type=A + $receiver: GET_PROPERTY .p type=A operator=MINUSEQ s: LITERAL String type=kotlin.String value='-=' CALL .timesAssign type=kotlin.Unit operator=MULTEQ - $receiver: GET_PROPERTY .p type=A + $receiver: GET_PROPERTY .p type=A operator=MULTEQ s: LITERAL String type=kotlin.String value='*=' CALL .divAssign type=kotlin.Unit operator=DIVEQ - $receiver: GET_PROPERTY .p type=A + $receiver: GET_PROPERTY .p type=A operator=DIVEQ s: LITERAL String type=kotlin.String value='/=' CALL .modAssign type=kotlin.Unit operator=PERCEQ - $receiver: GET_PROPERTY .p type=A - s: LITERAL String type=kotlin.String value='*=' + $receiver: GET_PROPERTY .p type=A operator=PERCEQ + s: LITERAL String type=kotlin.String value='%=' diff --git a/compiler/testData/ir/irText/boxOk.txt b/compiler/testData/ir/irText/boxOk.txt index c71591c49af..139014c7d1a 100644 --- a/compiler/testData/ir/irText/boxOk.txt +++ b/compiler/testData/ir/irText/boxOk.txt @@ -1,6 +1,6 @@ IrFile /boxOk.kt IrFunction public fun box(): kotlin.String IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= LITERAL String type=kotlin.String value='OK' diff --git a/compiler/testData/ir/irText/callWithReorderedArguments.txt b/compiler/testData/ir/irText/callWithReorderedArguments.txt index e5b0a6fd0fc..c0632554db2 100644 --- a/compiler/testData/ir/irText/callWithReorderedArguments.txt +++ b/compiler/testData/ir/irText/callWithReorderedArguments.txt @@ -1,42 +1,44 @@ IrFile /callWithReorderedArguments.kt IrFunction public fun foo(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Unit IrExpressionBody - BLOCK type= hasResult=false isDesugared=false + BLOCK type= hasResult=false operator=null IrFunction public fun noReorder1(): kotlin.Int IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= LITERAL Int type=kotlin.Int value='1' IrFunction public fun noReorder2(): kotlin.Int IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= LITERAL Int type=kotlin.Int value='2' IrFunction public fun reordered1(): kotlin.Int IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= LITERAL Int type=kotlin.Int value='1' IrFunction public fun reordered2(): kotlin.Int IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= LITERAL Int type=kotlin.Int value='2' IrFunction public fun test(): kotlin.Unit IrExpressionBody - BLOCK type= hasResult=false isDesugared=false - CALL .foo type=kotlin.Unit operator= - a: CALL .noReorder1 type=kotlin.Int operator= - b: CALL .noReorder2 type=kotlin.Int operator= - VAR val tmp0_b: kotlin.Int - CALL .reordered1 type=kotlin.Int operator= - VAR val tmp1_a: kotlin.Int - CALL .reordered2 type=kotlin.Int operator= - CALL .foo type=kotlin.Unit operator= - a: GET_VAR tmp1_a type=kotlin.Int - b: GET_VAR tmp0_b type=kotlin.Int - VAR val tmp2_a: kotlin.Int - CALL .reordered2 type=kotlin.Int operator= - CALL .foo type=kotlin.Unit operator= - a: GET_VAR tmp2_a type=kotlin.Int - b: LITERAL Int type=kotlin.Int value='1' + BLOCK type= hasResult=false operator=null + CALL .foo type=kotlin.Unit operator=null + a: CALL .noReorder1 type=kotlin.Int operator=null + b: CALL .noReorder2 type=kotlin.Int operator=null + BLOCK type=kotlin.Unit hasResult=false operator=SYNTHETIC_BLOCK + VAR val tmp0_b: kotlin.Int + CALL .reordered1 type=kotlin.Int operator=null + VAR val tmp1_a: kotlin.Int + CALL .reordered2 type=kotlin.Int operator=null + CALL .foo type=kotlin.Unit operator=null + a: GET_VAR tmp1_a type=kotlin.Int operator=null + b: GET_VAR tmp0_b type=kotlin.Int operator=null + BLOCK type=kotlin.Unit hasResult=false operator=SYNTHETIC_BLOCK + VAR val tmp2_a: kotlin.Int + CALL .reordered2 type=kotlin.Int operator=null + CALL .foo type=kotlin.Unit operator=null + a: GET_VAR tmp2_a type=kotlin.Int operator=null + b: LITERAL Int type=kotlin.Int value='1' diff --git a/compiler/testData/ir/irText/calls.txt b/compiler/testData/ir/irText/calls.txt index aa616ae2597..7fe3b4f58cd 100644 --- a/compiler/testData/ir/irText/calls.txt +++ b/compiler/testData/ir/irText/calls.txt @@ -1,42 +1,42 @@ IrFile /calls.kt IrFunction public fun foo(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int): kotlin.Int IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= - GET_VAR x type=kotlin.Int + GET_VAR x type=kotlin.Int operator=null IrFunction public fun bar(/*0*/ x: kotlin.Int): kotlin.Int IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= - CALL .foo type=kotlin.Int operator= - x: GET_VAR x type=kotlin.Int + CALL .foo type=kotlin.Int operator=null + x: GET_VAR x type=kotlin.Int operator=null y: LITERAL Int type=kotlin.Int value='1' IrFunction public fun qux(/*0*/ x: kotlin.Int): kotlin.Int IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= - CALL .foo type=kotlin.Int operator= - x: CALL .foo type=kotlin.Int operator= - x: GET_VAR x type=kotlin.Int - y: GET_VAR x type=kotlin.Int - y: GET_VAR x type=kotlin.Int + CALL .foo type=kotlin.Int operator=null + x: CALL .foo type=kotlin.Int operator=null + x: GET_VAR x type=kotlin.Int operator=null + y: GET_VAR x type=kotlin.Int operator=null + y: GET_VAR x type=kotlin.Int operator=null IrFunction public fun kotlin.Int.ext1(): kotlin.Int IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= $RECEIVER of: ext1 type=kotlin.Int IrFunction public fun kotlin.Int.ext2(/*0*/ x: kotlin.Int): kotlin.Int IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= - CALL .foo type=kotlin.Int operator= + CALL .foo type=kotlin.Int operator=null x: $RECEIVER of: ext2 type=kotlin.Int - y: GET_VAR x type=kotlin.Int + y: GET_VAR x type=kotlin.Int operator=null IrFunction public fun kotlin.Int.ext3(/*0*/ x: kotlin.Int): kotlin.Int IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= - CALL .foo type=kotlin.Int operator= - x: CALL .ext1 type=kotlin.Int operator= + CALL .foo type=kotlin.Int operator=null + x: CALL .ext1 type=kotlin.Int operator=null $receiver: $RECEIVER of: ext3 type=kotlin.Int - y: GET_VAR x type=kotlin.Int + y: GET_VAR x type=kotlin.Int operator=null diff --git a/compiler/testData/ir/irText/conventionComparisons.txt b/compiler/testData/ir/irText/conventionComparisons.txt index a10084c41db..6c2c95d796b 100644 --- a/compiler/testData/ir/irText/conventionComparisons.txt +++ b/compiler/testData/ir/irText/conventionComparisons.txt @@ -1,29 +1,29 @@ IrFile /conventionComparisons.kt IrFunction public fun test1(/*0*/ a: kotlin.String, /*1*/ b: kotlin.String): kotlin.Boolean IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= BINARY_OP operator=GT type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.String): kotlin.Int - GET_VAR a type=kotlin.String - GET_VAR b type=kotlin.String + GET_VAR a type=kotlin.String operator=null + GET_VAR b type=kotlin.String operator=null IrFunction public fun test2(/*0*/ a: kotlin.String, /*1*/ b: kotlin.String): kotlin.Boolean IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= BINARY_OP operator=LT type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.String): kotlin.Int - GET_VAR a type=kotlin.String - GET_VAR b type=kotlin.String + GET_VAR a type=kotlin.String operator=null + GET_VAR b type=kotlin.String operator=null IrFunction public fun test3(/*0*/ a: kotlin.String, /*1*/ b: kotlin.String): kotlin.Boolean IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= BINARY_OP operator=GTEQ type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.String): kotlin.Int - GET_VAR a type=kotlin.String - GET_VAR b type=kotlin.String + GET_VAR a type=kotlin.String operator=null + GET_VAR b type=kotlin.String operator=null IrFunction public fun test4(/*0*/ a: kotlin.String, /*1*/ b: kotlin.String): kotlin.Boolean IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= BINARY_OP operator=LTEQ type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.String): kotlin.Int - GET_VAR a type=kotlin.String - GET_VAR b type=kotlin.String + GET_VAR a type=kotlin.String operator=null + GET_VAR b type=kotlin.String operator=null diff --git a/compiler/testData/ir/irText/destructuring1.txt b/compiler/testData/ir/irText/destructuring1.txt index ea817be22f9..aa8a84c3f09 100644 --- a/compiler/testData/ir/irText/destructuring1.txt +++ b/compiler/testData/ir/irText/destructuring1.txt @@ -1,13 +1,14 @@ IrFunction public fun B.test(): kotlin.Unit IrExpressionBody - BLOCK type= hasResult=false isDesugared=false - VAR val tmp0: A - GET_VAR A type=A - VAR val x: kotlin.Int - CALL .component1 type=kotlin.Int operator=COMPONENT_N(index=1) - $this: $RECEIVER of: test type=B - $receiver: GET_VAR tmp0 type=A - VAR val y: kotlin.Int - CALL .component2 type=kotlin.Int operator=COMPONENT_N(index=2) - $this: $RECEIVER of: test type=B - $receiver: GET_VAR tmp0 type=A + BLOCK type= hasResult=false operator=null + BLOCK type= hasResult=false operator=SYNTHETIC_BLOCK + VAR val tmp0: A + GET_VAR A type=A operator=null + VAR val x: kotlin.Int + CALL .component1 type=kotlin.Int operator=COMPONENT_N(index=1) + $this: $RECEIVER of: test type=B + $receiver: GET_VAR tmp0 type=A operator=null + VAR val y: kotlin.Int + CALL .component2 type=kotlin.Int operator=COMPONENT_N(index=2) + $this: $RECEIVER of: test type=B + $receiver: GET_VAR tmp0 type=A operator=null diff --git a/compiler/testData/ir/irText/dotQualified.txt b/compiler/testData/ir/irText/dotQualified.txt index e091af323fc..897e7bcf4d6 100644 --- a/compiler/testData/ir/irText/dotQualified.txt +++ b/compiler/testData/ir/irText/dotQualified.txt @@ -1,14 +1,14 @@ IrFile /dotQualified.kt IrFunction public fun length(/*0*/ s: kotlin.String): kotlin.Int IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= - GET_PROPERTY .length type=kotlin.Int - $this: GET_VAR s type=kotlin.String + GET_PROPERTY .length type=kotlin.Int operator=null + $this: GET_VAR s type=kotlin.String operator=null IrFunction public fun lengthN(/*0*/ s: kotlin.String?): kotlin.Int? IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= - GET_PROPERTY ?.length type=kotlin.Int? + GET_PROPERTY ?.length type=kotlin.Int? operator=null $this: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String - GET_VAR s type=kotlin.String? + GET_VAR s type=kotlin.String? operator=null diff --git a/compiler/testData/ir/irText/elvis.txt b/compiler/testData/ir/irText/elvis.txt index 6cfdc21a236..8b8f245c976 100644 --- a/compiler/testData/ir/irText/elvis.txt +++ b/compiler/testData/ir/irText/elvis.txt @@ -1,26 +1,26 @@ IrFile /elvis.kt IrFunction public fun test1(/*0*/ a: kotlin.Any?, /*1*/ b: kotlin.Any): kotlin.Any IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= BINARY_OP operator=ELVIS type=kotlin.Any related=null - GET_VAR a type=kotlin.Any? - GET_VAR b type=kotlin.Any + GET_VAR a type=kotlin.Any? operator=null + GET_VAR b type=kotlin.Any operator=null IrFunction public fun test2(/*0*/ a: kotlin.String?, /*1*/ b: kotlin.Any): kotlin.Any IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= BINARY_OP operator=ELVIS type=kotlin.Any related=null - GET_VAR a type=kotlin.String? - GET_VAR b type=kotlin.Any + GET_VAR a type=kotlin.String? operator=null + GET_VAR b type=kotlin.Any operator=null IrFunction public fun test3(/*0*/ a: kotlin.Any?, /*1*/ b: kotlin.Any?): kotlin.String IrExpressionBody - BLOCK type= hasResult=false isDesugared=false + BLOCK type= hasResult=false operator=null DUMMY KtIfExpression type=kotlin.Unit DUMMY KtIfExpression type=kotlin.Unit RETURN type= BINARY_OP operator=ELVIS type=kotlin.String related=null TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String? - GET_VAR a type=kotlin.Any? + GET_VAR a type=kotlin.Any? operator=null TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String - GET_VAR b type=kotlin.Any? + GET_VAR b type=kotlin.Any? operator=null diff --git a/compiler/testData/ir/irText/equality.txt b/compiler/testData/ir/irText/equality.txt index 045af2c09b5..32f00030bc4 100644 --- a/compiler/testData/ir/irText/equality.txt +++ b/compiler/testData/ir/irText/equality.txt @@ -1,22 +1,22 @@ IrFile /equality.kt IrFunction public fun test1(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Boolean IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= BINARY_OP operator=EQEQ type=kotlin.Boolean related=public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - GET_VAR a type=kotlin.Int - GET_VAR b type=kotlin.Int + GET_VAR a type=kotlin.Int operator=null + GET_VAR b type=kotlin.Int operator=null IrFunction public fun test2(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Boolean IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= BINARY_OP operator=EXCLEQ type=kotlin.Boolean related=public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - GET_VAR a type=kotlin.Int - GET_VAR b type=kotlin.Int + GET_VAR a type=kotlin.Int operator=null + GET_VAR b type=kotlin.Int operator=null IrFunction public fun test3(/*0*/ a: kotlin.Any?, /*1*/ b: kotlin.Any?): kotlin.Boolean IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= BINARY_OP operator=EQEQ type=kotlin.Boolean related=public open operator fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - GET_VAR a type=kotlin.Any? - GET_VAR b type=kotlin.Any? + GET_VAR a type=kotlin.Any? operator=null + GET_VAR b type=kotlin.Any? operator=null diff --git a/compiler/testData/ir/irText/extensionPropertyGetterCall.txt b/compiler/testData/ir/irText/extensionPropertyGetterCall.txt index fb1d03dbcfd..e3a8fbfb789 100644 --- a/compiler/testData/ir/irText/extensionPropertyGetterCall.txt +++ b/compiler/testData/ir/irText/extensionPropertyGetterCall.txt @@ -2,12 +2,12 @@ IrFile /extensionPropertyGetterCall.kt IrProperty public val kotlin.String.okext: kotlin.String getter= setter=null IrPropertyGetter public fun kotlin.String.(): kotlin.String property=okext IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= LITERAL String type=kotlin.String value='OK' IrFunction public fun kotlin.String.test5(): kotlin.String IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= - GET_PROPERTY .okext type=kotlin.String + GET_PROPERTY .okext type=kotlin.String operator=null $receiver: $RECEIVER of: test5 type=kotlin.String diff --git a/compiler/testData/ir/irText/identity.txt b/compiler/testData/ir/irText/identity.txt index e4c7abd37dc..47f43eb367e 100644 --- a/compiler/testData/ir/irText/identity.txt +++ b/compiler/testData/ir/irText/identity.txt @@ -1,22 +1,22 @@ IrFile /identity.kt IrFunction public fun test1(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Boolean IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= BINARY_OP operator=EQEQEQ type=kotlin.Boolean related=null - GET_VAR a type=kotlin.Int - GET_VAR b type=kotlin.Int + GET_VAR a type=kotlin.Int operator=null + GET_VAR b type=kotlin.Int operator=null IrFunction public fun test2(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Boolean IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= BINARY_OP operator=EXCLEQEQ type=kotlin.Boolean related=null - GET_VAR a type=kotlin.Int - GET_VAR b type=kotlin.Int + GET_VAR a type=kotlin.Int operator=null + GET_VAR b type=kotlin.Int operator=null IrFunction public fun test3(/*0*/ a: kotlin.Any?, /*1*/ b: kotlin.Any?): kotlin.Boolean IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= BINARY_OP operator=EQEQEQ type=kotlin.Boolean related=null - GET_VAR a type=kotlin.Any? - GET_VAR b type=kotlin.Any? + GET_VAR a type=kotlin.Any? operator=null + GET_VAR b type=kotlin.Any? operator=null diff --git a/compiler/testData/ir/irText/in.txt b/compiler/testData/ir/irText/in.txt index bc20c3dffa9..ed7b0f9422b 100644 --- a/compiler/testData/ir/irText/in.txt +++ b/compiler/testData/ir/irText/in.txt @@ -1,31 +1,31 @@ IrFile /in.kt IrFunction public fun test1(/*0*/ a: kotlin.Any, /*1*/ x: kotlin.collections.Collection): kotlin.Boolean IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= CALL .contains type=kotlin.Boolean operator=IN - $this: GET_VAR x type=kotlin.collections.Collection - element: GET_VAR a type=kotlin.Any + $this: GET_VAR x type=kotlin.collections.Collection operator=null + element: GET_VAR a type=kotlin.Any operator=null IrFunction public fun test2(/*0*/ a: kotlin.Any, /*1*/ x: kotlin.collections.Collection): kotlin.Boolean IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= UNARY_OP operator=EXCL type=kotlin.Boolean related=null CALL .contains type=kotlin.Boolean operator=NOT_IN - $this: GET_VAR x type=kotlin.collections.Collection - element: GET_VAR a type=kotlin.Any + $this: GET_VAR x type=kotlin.collections.Collection operator=null + element: GET_VAR a type=kotlin.Any operator=null IrFunction public fun test3(/*0*/ a: T, /*1*/ x: kotlin.collections.Collection): kotlin.Boolean IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= CALL .contains type=kotlin.Boolean operator=IN - $this: GET_VAR x type=kotlin.collections.Collection - element: GET_VAR a type=T + $this: GET_VAR x type=kotlin.collections.Collection operator=null + element: GET_VAR a type=T operator=null IrFunction public fun test4(/*0*/ a: T, /*1*/ x: kotlin.collections.Collection): kotlin.Boolean IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= UNARY_OP operator=EXCL type=kotlin.Boolean related=null CALL .contains type=kotlin.Boolean operator=NOT_IN - $this: GET_VAR x type=kotlin.collections.Collection - element: GET_VAR a type=T + $this: GET_VAR x type=kotlin.collections.Collection operator=null + element: GET_VAR a type=T operator=null diff --git a/compiler/testData/ir/irText/incrementDecrement.txt b/compiler/testData/ir/irText/incrementDecrement.txt index 1957e59eeba..b8056fdd8d3 100644 --- a/compiler/testData/ir/irText/incrementDecrement.txt +++ b/compiler/testData/ir/irText/incrementDecrement.txt @@ -4,78 +4,78 @@ IrFile /incrementDecrement.kt LITERAL Int type=kotlin.Int value='0' IrProperty public val arr: kotlin.IntArray getter=null setter=null IrExpressionBody - CALL .intArrayOf type=kotlin.IntArray operator= + CALL .intArrayOf type=kotlin.IntArray operator=null elements: DUMMY vararg type=kotlin.Int IrFunction public fun testVar(): kotlin.Unit IrExpressionBody - BLOCK type= hasResult=false isDesugared=false + BLOCK type= hasResult=false operator=null VAR var x: kotlin.Int LITERAL Int type=kotlin.Int value='0' VAR val x1: kotlin.Int - BLOCK type=kotlin.Int hasResult=true isDesugared=true + BLOCK type=kotlin.Int hasResult=true operator=PREFIX_INCR VAR val tmp0: kotlin.Int CALL .inc type=kotlin.Int operator=PREFIX_INCR - $this: GET_VAR x type=kotlin.Int - SET_VAR x type= - GET_VAR tmp0 type=kotlin.Int - GET_VAR tmp0 type=kotlin.Int + $this: GET_VAR x type=kotlin.Int operator=PREFIX_INCR + SET_VAR x type= operator=PREFIX_INCR + GET_VAR tmp0 type=kotlin.Int operator=null + GET_VAR tmp0 type=kotlin.Int operator=null VAR val x2: kotlin.Int - BLOCK type=kotlin.Int hasResult=true isDesugared=true + BLOCK type=kotlin.Int hasResult=true operator=PREFIX_DECR VAR val tmp1: kotlin.Int CALL .dec type=kotlin.Int operator=PREFIX_DECR - $this: GET_VAR x type=kotlin.Int - SET_VAR x type= - GET_VAR tmp1 type=kotlin.Int - GET_VAR tmp1 type=kotlin.Int + $this: GET_VAR x type=kotlin.Int operator=PREFIX_DECR + SET_VAR x type= operator=PREFIX_DECR + GET_VAR tmp1 type=kotlin.Int operator=null + GET_VAR tmp1 type=kotlin.Int operator=null IrFunction public fun testProp(): kotlin.Unit IrExpressionBody - BLOCK type= hasResult=false isDesugared=false + BLOCK type= hasResult=false operator=null VAR val p1: kotlin.Int - BLOCK type=kotlin.Int hasResult=true isDesugared=true + BLOCK type=kotlin.Int hasResult=true operator=PREFIX_INCR VAR val tmp0: kotlin.Int CALL .inc type=kotlin.Int operator=PREFIX_INCR - $this: GET_PROPERTY .p type=kotlin.Int - SET_PROPERTY .ptype= - $value: GET_VAR tmp0 type=kotlin.Int - GET_VAR tmp0 type=kotlin.Int + $this: GET_PROPERTY .p type=kotlin.Int operator=PREFIX_INCR + SET_PROPERTY .ptype= operator=PREFIX_INCR + $value: GET_VAR tmp0 type=kotlin.Int operator=null + GET_VAR tmp0 type=kotlin.Int operator=null VAR val p2: kotlin.Int - BLOCK type=kotlin.Int hasResult=true isDesugared=true + BLOCK type=kotlin.Int hasResult=true operator=PREFIX_DECR VAR val tmp1: kotlin.Int CALL .dec type=kotlin.Int operator=PREFIX_DECR - $this: GET_PROPERTY .p type=kotlin.Int - SET_PROPERTY .ptype= - $value: GET_VAR tmp1 type=kotlin.Int - GET_VAR tmp1 type=kotlin.Int + $this: GET_PROPERTY .p type=kotlin.Int operator=PREFIX_DECR + SET_PROPERTY .ptype= operator=PREFIX_DECR + $value: GET_VAR tmp1 type=kotlin.Int operator=null + GET_VAR tmp1 type=kotlin.Int operator=null IrFunction public fun testArray(): kotlin.Unit IrExpressionBody - BLOCK type= hasResult=false isDesugared=false + BLOCK type= hasResult=false operator=null VAR val a1: kotlin.Int TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.Int - BLOCK type=kotlin.Unit hasResult=true isDesugared=true + BLOCK type=kotlin.Unit hasResult=true operator=PREFIX_INCR VAR val tmp0_array: kotlin.IntArray - GET_PROPERTY .arr type=kotlin.IntArray + GET_PROPERTY .arr type=kotlin.IntArray operator=null VAR val tmp1: kotlin.Int CALL .inc type=kotlin.Int operator=PREFIX_INCR $this: CALL .get type=kotlin.Int operator=PREFIX_INCR - $this: GET_VAR tmp0_array type=kotlin.IntArray + $this: GET_VAR tmp0_array type=kotlin.IntArray operator=null index: LITERAL Int type=kotlin.Int value='0' CALL .set type=kotlin.Unit operator=PREFIX_INCR - $this: GET_VAR tmp0_array type=kotlin.IntArray + $this: GET_VAR tmp0_array type=kotlin.IntArray operator=null index: LITERAL Int type=kotlin.Int value='0' - value: GET_VAR tmp1 type=kotlin.Int - GET_VAR tmp1 type=kotlin.Int + value: GET_VAR tmp1 type=kotlin.Int operator=null + GET_VAR tmp1 type=kotlin.Int operator=null VAR val a2: kotlin.Int TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.Int - BLOCK type=kotlin.Unit hasResult=true isDesugared=true + BLOCK type=kotlin.Unit hasResult=true operator=PREFIX_DECR VAR val tmp2_array: kotlin.IntArray - GET_PROPERTY .arr type=kotlin.IntArray + GET_PROPERTY .arr type=kotlin.IntArray operator=null VAR val tmp3: kotlin.Int CALL .dec type=kotlin.Int operator=PREFIX_DECR $this: CALL .get type=kotlin.Int operator=PREFIX_DECR - $this: GET_VAR tmp2_array type=kotlin.IntArray + $this: GET_VAR tmp2_array type=kotlin.IntArray operator=null index: LITERAL Int type=kotlin.Int value='0' CALL .set type=kotlin.Unit operator=PREFIX_DECR - $this: GET_VAR tmp2_array type=kotlin.IntArray + $this: GET_VAR tmp2_array type=kotlin.IntArray operator=null index: LITERAL Int type=kotlin.Int value='0' - value: GET_VAR tmp3 type=kotlin.Int - GET_VAR tmp3 type=kotlin.Int + value: GET_VAR tmp3 type=kotlin.Int operator=null + GET_VAR tmp3 type=kotlin.Int operator=null diff --git a/compiler/testData/ir/irText/primitiveComparisons.txt b/compiler/testData/ir/irText/primitiveComparisons.txt index 639b38895cb..0221fc23488 100644 --- a/compiler/testData/ir/irText/primitiveComparisons.txt +++ b/compiler/testData/ir/irText/primitiveComparisons.txt @@ -1,29 +1,29 @@ IrFile /primitiveComparisons.kt IrFunction public fun test1(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Boolean IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= BINARY_OP operator=GT type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Int): kotlin.Int - GET_VAR a type=kotlin.Int - GET_VAR b type=kotlin.Int + GET_VAR a type=kotlin.Int operator=null + GET_VAR b type=kotlin.Int operator=null IrFunction public fun test2(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Boolean IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= BINARY_OP operator=LT type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Int): kotlin.Int - GET_VAR a type=kotlin.Int - GET_VAR b type=kotlin.Int + GET_VAR a type=kotlin.Int operator=null + GET_VAR b type=kotlin.Int operator=null IrFunction public fun test3(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Boolean IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= BINARY_OP operator=GTEQ type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Int): kotlin.Int - GET_VAR a type=kotlin.Int - GET_VAR b type=kotlin.Int + GET_VAR a type=kotlin.Int operator=null + GET_VAR b type=kotlin.Int operator=null IrFunction public fun test4(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Boolean IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= BINARY_OP operator=LTEQ type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Int): kotlin.Int - GET_VAR a type=kotlin.Int - GET_VAR b type=kotlin.Int + GET_VAR a type=kotlin.Int operator=null + GET_VAR b type=kotlin.Int operator=null diff --git a/compiler/testData/ir/irText/references.txt b/compiler/testData/ir/irText/references.txt index 7d20a63fd72..5a7d1b5fc81 100644 --- a/compiler/testData/ir/irText/references.txt +++ b/compiler/testData/ir/irText/references.txt @@ -4,44 +4,44 @@ IrFile /references.kt LITERAL String type=kotlin.String value='OK' IrProperty public val ok2: kotlin.String = "OK" getter=null setter=null IrExpressionBody - GET_PROPERTY .ok type=kotlin.String + GET_PROPERTY .ok type=kotlin.String operator=null IrProperty public val ok3: kotlin.String getter= setter=null IrPropertyGetter public fun (): kotlin.String property=ok3 IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= LITERAL String type=kotlin.String value='OK' IrFunction public fun test1(): kotlin.String IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= - GET_PROPERTY .ok type=kotlin.String + GET_PROPERTY .ok type=kotlin.String operator=null IrFunction public fun test2(/*0*/ x: kotlin.String): kotlin.String IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= - GET_VAR x type=kotlin.String + GET_VAR x type=kotlin.String operator=null IrFunction public fun test3(): kotlin.String IrExpressionBody - BLOCK type= hasResult=false isDesugared=false + BLOCK type= hasResult=false operator=null VAR val x: kotlin.String = "OK" LITERAL String type=kotlin.String value='OK' RETURN type= - GET_VAR x type=kotlin.String + GET_VAR x type=kotlin.String operator=null IrFunction public fun test4(): kotlin.String IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= - GET_PROPERTY .ok3 type=kotlin.String + GET_PROPERTY .ok3 type=kotlin.String operator=null IrProperty public val kotlin.String.okext: kotlin.String getter= setter=null IrPropertyGetter public fun kotlin.String.(): kotlin.String property=okext IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= LITERAL String type=kotlin.String value='OK' IrFunction public fun kotlin.String.test5(): kotlin.String IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= - GET_PROPERTY .okext type=kotlin.String + GET_PROPERTY .okext type=kotlin.String operator=null $receiver: $RECEIVER of: test5 type=kotlin.String diff --git a/compiler/testData/ir/irText/simpleOperators.kt b/compiler/testData/ir/irText/simpleOperators.kt index a64691ec594..44eece271a1 100644 --- a/compiler/testData/ir/irText/simpleOperators.kt +++ b/compiler/testData/ir/irText/simpleOperators.kt @@ -4,3 +4,9 @@ fun test3(a: Int, b: Int) = a * b fun test4(a: Int, b: Int) = a / b fun test5(a: Int, b: Int) = a % b fun test6(a: Int, b: Int) = a .. b + +fun test1x(a: Int, b: Int) = a.plus(b) +fun test2x(a: Int, b: Int) = a.minus(b) +fun test3x(a: Int, b: Int) = a.times(b) +fun test4x(a: Int, b: Int) = a.div(b) +fun test5x(a: Int, b: Int) = a.mod(b) \ No newline at end of file diff --git a/compiler/testData/ir/irText/simpleOperators.txt b/compiler/testData/ir/irText/simpleOperators.txt index 632601b8ad8..3b7bf86ceb1 100644 --- a/compiler/testData/ir/irText/simpleOperators.txt +++ b/compiler/testData/ir/irText/simpleOperators.txt @@ -1,43 +1,78 @@ IrFile /simpleOperators.kt IrFunction public fun test1(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Int IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= CALL .plus type=kotlin.Int operator=PLUS - $this: GET_VAR a type=kotlin.Int - other: GET_VAR b type=kotlin.Int + $this: GET_VAR a type=kotlin.Int operator=null + other: GET_VAR b type=kotlin.Int operator=null IrFunction public fun test2(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Int IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= CALL .minus type=kotlin.Int operator=MINUS - $this: GET_VAR a type=kotlin.Int - other: GET_VAR b type=kotlin.Int + $this: GET_VAR a type=kotlin.Int operator=null + other: GET_VAR b type=kotlin.Int operator=null IrFunction public fun test3(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Int IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= CALL .times type=kotlin.Int operator=MUL - $this: GET_VAR a type=kotlin.Int - other: GET_VAR b type=kotlin.Int + $this: GET_VAR a type=kotlin.Int operator=null + other: GET_VAR b type=kotlin.Int operator=null IrFunction public fun test4(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Int IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= CALL .div type=kotlin.Int operator=DIV - $this: GET_VAR a type=kotlin.Int - other: GET_VAR b type=kotlin.Int + $this: GET_VAR a type=kotlin.Int operator=null + other: GET_VAR b type=kotlin.Int operator=null IrFunction public fun test5(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Int IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= CALL .mod type=kotlin.Int operator=PERC - $this: GET_VAR a type=kotlin.Int - other: GET_VAR b type=kotlin.Int + $this: GET_VAR a type=kotlin.Int operator=null + other: GET_VAR b type=kotlin.Int operator=null IrFunction public fun test6(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.ranges.IntRange IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= CALL .rangeTo type=kotlin.ranges.IntRange operator=RANGE - $this: GET_VAR a type=kotlin.Int - other: GET_VAR b type=kotlin.Int + $this: GET_VAR a type=kotlin.Int operator=null + other: GET_VAR b type=kotlin.Int operator=null + IrFunction public fun test1x(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Int + IrExpressionBody + BLOCK type= hasResult=false operator=null + RETURN type= + CALL .plus type=kotlin.Int operator=null + $this: GET_VAR a type=kotlin.Int operator=null + other: GET_VAR b type=kotlin.Int operator=null + IrFunction public fun test2x(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Int + IrExpressionBody + BLOCK type= hasResult=false operator=null + RETURN type= + CALL .minus type=kotlin.Int operator=null + $this: GET_VAR a type=kotlin.Int operator=null + other: GET_VAR b type=kotlin.Int operator=null + IrFunction public fun test3x(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Int + IrExpressionBody + BLOCK type= hasResult=false operator=null + RETURN type= + CALL .times type=kotlin.Int operator=null + $this: GET_VAR a type=kotlin.Int operator=null + other: GET_VAR b type=kotlin.Int operator=null + IrFunction public fun test4x(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Int + IrExpressionBody + BLOCK type= hasResult=false operator=null + RETURN type= + CALL .div type=kotlin.Int operator=null + $this: GET_VAR a type=kotlin.Int operator=null + other: GET_VAR b type=kotlin.Int operator=null + IrFunction public fun test5x(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Int + IrExpressionBody + BLOCK type= hasResult=false operator=null + RETURN type= + CALL .mod type=kotlin.Int operator=null + $this: GET_VAR a type=kotlin.Int operator=null + other: GET_VAR b type=kotlin.Int operator=null diff --git a/compiler/testData/ir/irText/smartCasts.txt b/compiler/testData/ir/irText/smartCasts.txt index 0f415f27023..e576d3696eb 100644 --- a/compiler/testData/ir/irText/smartCasts.txt +++ b/compiler/testData/ir/irText/smartCasts.txt @@ -1,51 +1,51 @@ IrFile /smartCasts.kt IrFunction public fun expectsString(/*0*/ s: kotlin.String): kotlin.Unit IrExpressionBody - BLOCK type= hasResult=false isDesugared=false + BLOCK type= hasResult=false operator=null IrFunction public fun expectsInt(/*0*/ i: kotlin.Int): kotlin.Unit IrExpressionBody - BLOCK type= hasResult=false isDesugared=false + BLOCK type= hasResult=false operator=null IrFunction public fun overloaded(/*0*/ s: kotlin.String): kotlin.String IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= - GET_VAR s type=kotlin.String + GET_VAR s type=kotlin.String operator=null IrFunction public fun overloaded(/*0*/ x: kotlin.Any): kotlin.Any IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= - GET_VAR x type=kotlin.Any + GET_VAR x type=kotlin.Any operator=null IrFunction public fun test1(/*0*/ x: kotlin.Any): kotlin.Unit IrExpressionBody - BLOCK type= hasResult=false isDesugared=false + BLOCK type= hasResult=false operator=null DUMMY KtIfExpression type=kotlin.Unit - CALL .println type=kotlin.Unit operator= - message: GET_PROPERTY .length type=kotlin.Int + CALL .println type=kotlin.Unit operator=null + message: GET_PROPERTY .length type=kotlin.Int operator=null $this: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String - GET_VAR x type=kotlin.Any - CALL .expectsString type=kotlin.Unit operator= + GET_VAR x type=kotlin.Any operator=null + CALL .expectsString type=kotlin.Unit operator=null s: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String - GET_VAR x type=kotlin.Any - CALL .expectsInt type=kotlin.Unit operator= - i: GET_PROPERTY .length type=kotlin.Int + GET_VAR x type=kotlin.Any operator=null + CALL .expectsInt type=kotlin.Unit operator=null + i: GET_PROPERTY .length type=kotlin.Int operator=null $this: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String - GET_VAR x type=kotlin.Any - CALL .expectsString type=kotlin.Unit operator= - s: CALL .overloaded type=kotlin.String operator= + GET_VAR x type=kotlin.Any operator=null + CALL .expectsString type=kotlin.Unit operator=null + s: CALL .overloaded type=kotlin.String operator=null s: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String - GET_VAR x type=kotlin.Any + GET_VAR x type=kotlin.Any operator=null IrFunction public fun test2(/*0*/ x: kotlin.Any): kotlin.String IrExpressionBody - BLOCK type= hasResult=false isDesugared=false + BLOCK type= hasResult=false operator=null DUMMY KtIfExpression type=kotlin.Unit RETURN type= - CALL .overloaded type=kotlin.String operator= + CALL .overloaded type=kotlin.String operator=null s: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String - GET_VAR x type=kotlin.Any + GET_VAR x type=kotlin.Any operator=null IrFunction public fun test3(/*0*/ x: kotlin.Any): kotlin.String IrExpressionBody - BLOCK type= hasResult=false isDesugared=false + BLOCK type= hasResult=false operator=null DUMMY KtIfExpression type=kotlin.Unit RETURN type= TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String - GET_VAR x type=kotlin.Any + GET_VAR x type=kotlin.Any operator=null diff --git a/compiler/testData/ir/irText/smartCastsWithDestructuring.txt b/compiler/testData/ir/irText/smartCastsWithDestructuring.txt index 9e4bebc36ad..65f91080dc8 100644 --- a/compiler/testData/ir/irText/smartCastsWithDestructuring.txt +++ b/compiler/testData/ir/irText/smartCastsWithDestructuring.txt @@ -3,24 +3,25 @@ IrFile /smartCastsWithDestructuring.kt DUMMY I2 IrFunction public operator fun I1.component1(): kotlin.Int IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= LITERAL Int type=kotlin.Int value='1' IrFunction public operator fun I2.component2(): kotlin.String IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= LITERAL String type=kotlin.String value='' IrFunction public fun test(/*0*/ x: I1): kotlin.Unit IrExpressionBody - BLOCK type= hasResult=false isDesugared=false + BLOCK type= hasResult=false operator=null DUMMY KtIfExpression type=kotlin.Unit - VAR val tmp0: I1 - GET_VAR x type=I1 - VAR val c1: kotlin.Int - CALL .component1 type=kotlin.Int operator=COMPONENT_N(index=1) - $receiver: GET_VAR tmp0 type=I1 - VAR val c2: kotlin.String - CALL .component2 type=kotlin.String operator=COMPONENT_N(index=2) - $receiver: TYPE_OP operator=IMPLICIT_CAST typeOperand=I2 - GET_VAR tmp0 type=I1 + BLOCK type= hasResult=false operator=SYNTHETIC_BLOCK + VAR val tmp0: I1 + GET_VAR x type=I1 operator=null + VAR val c1: kotlin.Int + CALL .component1 type=kotlin.Int operator=COMPONENT_N(index=1) + $receiver: GET_VAR tmp0 type=I1 operator=null + VAR val c2: kotlin.String + CALL .component2 type=kotlin.String operator=COMPONENT_N(index=2) + $receiver: TYPE_OP operator=IMPLICIT_CAST typeOperand=I2 + GET_VAR tmp0 type=I1 operator=null diff --git a/compiler/testData/ir/irText/smoke.txt b/compiler/testData/ir/irText/smoke.txt index 7e2789638a4..fc73a31db8a 100644 --- a/compiler/testData/ir/irText/smoke.txt +++ b/compiler/testData/ir/irText/smoke.txt @@ -1,7 +1,7 @@ IrFile /smoke.kt IrFunction public fun testFun(): kotlin.String IrExpressionBody - BLOCK type= hasResult=false isDesugared=false + BLOCK type= hasResult=false operator=null RETURN type= LITERAL String type=kotlin.String value='OK' IrProperty public val testSimpleVal: kotlin.Int = 1 getter=null setter=null @@ -10,7 +10,7 @@ IrFile /smoke.kt IrProperty public val testValWithGetter: kotlin.Int getter= setter=null IrPropertyGetter public fun (): kotlin.Int property=testValWithGetter IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= LITERAL Int type=kotlin.Int value='42' IrProperty public var testSimpleVar: kotlin.Int getter=null setter=null @@ -19,9 +19,9 @@ IrFile /smoke.kt IrProperty public var testVarWithAccessors: kotlin.Int getter= setter= IrPropertyGetter public fun (): kotlin.Int property=testVarWithAccessors IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= LITERAL Int type=kotlin.Int value='42' IrPropertySetter public fun (/*0*/ v: kotlin.Int): kotlin.Unit property=testVarWithAccessors IrExpressionBody - BLOCK type= hasResult=false isDesugared=false + BLOCK type= hasResult=false operator=null diff --git a/compiler/testData/ir/irText/stringPlus.txt b/compiler/testData/ir/irText/stringPlus.txt index 62254ccc8c2..6cb6a15007b 100644 --- a/compiler/testData/ir/irText/stringPlus.txt +++ b/compiler/testData/ir/irText/stringPlus.txt @@ -1,27 +1,27 @@ IrFile /stringPlus.kt IrFunction public fun test1(/*0*/ a: kotlin.String, /*1*/ b: kotlin.Any): kotlin.String IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= STRING_CONCATENATION type=kotlin.String - GET_VAR a type=kotlin.String - GET_VAR b type=kotlin.Any + GET_VAR a type=kotlin.String operator=null + GET_VAR b type=kotlin.Any operator=null IrFunction public fun test2(/*0*/ a: kotlin.String, /*1*/ b: kotlin.Int): kotlin.String IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= STRING_CONCATENATION type=kotlin.String - GET_VAR a type=kotlin.String + GET_VAR a type=kotlin.String operator=null LITERAL String type=kotlin.String value='+' - GET_VAR b type=kotlin.Int + GET_VAR b type=kotlin.Int operator=null IrFunction public fun test3(/*0*/ a: kotlin.String, /*1*/ b: kotlin.Int): kotlin.String IrExpressionBody - BLOCK type= hasResult=false isDesugared=true + BLOCK type= hasResult=false operator=null RETURN type= STRING_CONCATENATION type=kotlin.String - GET_VAR a type=kotlin.String + GET_VAR a type=kotlin.String operator=null LITERAL String type=kotlin.String value='+' CALL .plus type=kotlin.Int operator=PLUS - $this: GET_VAR b type=kotlin.Int + $this: GET_VAR b type=kotlin.Int operator=null other: LITERAL Int type=kotlin.Int value='1' - GET_VAR a type=kotlin.String + GET_VAR a type=kotlin.String operator=null