diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/KotlinUtils.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/KotlinUtils.kt index 8bb8a681a0c..ac3eb2ba399 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/KotlinUtils.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/KotlinUtils.kt @@ -16,16 +16,20 @@ package org.jetbrains.kotlin.psi2ir +import com.intellij.psi.PsiElement import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.incremental.components.NoLookupLocation +import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.psi.KtElement import org.jetbrains.kotlin.psi.KtExpression import org.jetbrains.kotlin.psi.KtPsiUtil import org.jetbrains.kotlin.psi.KtSecondaryConstructor +import org.jetbrains.kotlin.psi.psiUtil.endOffset +import org.jetbrains.kotlin.psi.psiUtil.startOffset import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall import org.jetbrains.kotlin.resolve.calls.model.ArgumentMatch @@ -75,4 +79,7 @@ fun MemberScope.findSingleFunction(name: Name): FunctionDescriptor = getContributedFunctions(name, NoLookupLocation.FROM_BACKEND).single() fun KotlinBuiltIns.findSingleFunction(name: Name): FunctionDescriptor = - builtInsPackageScope.findSingleFunction(name) \ No newline at end of file + builtInsPackageScope.findSingleFunction(name) + +val PsiElement?.startOffsetOrUndefined get() = this?.startOffset ?: UNDEFINED_OFFSET +val PsiElement?.endOffsetOrUndefined get() = this?.endOffset ?: UNDEFINED_OFFSET \ No newline at end of file diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/BodyGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/BodyGenerator.kt index 298e0fc58d5..f8db9d24736 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/BodyGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/BodyGenerator.kt @@ -36,20 +36,6 @@ class BodyGenerator(val scopeOwner: DeclarationDescriptor, override val context: override val scope = Scope(scopeOwner) private val loopTable = HashMap() - fun generateDefaultParameters(ktFunction: KtFunction, irFunction: IrFunctionBase) { - generateDefaultParameters(ktFunction.valueParameterList ?: return, irFunction) - } - - fun generateDefaultParameters(ktParameterList: KtParameterList, irFunction: IrFunctionBase) { - val statementGenerator = createStatementGenerator() - for (ktParameter in ktParameterList.parameters) { - val ktDefaultValue = ktParameter.defaultValue ?: continue - val valueParameter = getOrFail(BindingContext.VALUE_PARAMETER, ktParameter) as? ValueParameterDescriptor ?: continue - val irDefaultValue = statementGenerator.generateExpression(ktDefaultValue) - irFunction.putDefault(valueParameter, IrExpressionBodyImpl(irDefaultValue)) - } - } - fun generateFunctionBody(ktBody: KtExpression): IrBody { val statementGenerator = createStatementGenerator() @@ -64,8 +50,8 @@ class BodyGenerator(val scopeOwner: DeclarationDescriptor, override val context: return irBlockBody } - fun generatePropertyInitializerBody(ktInitializer: KtExpression): IrExpressionBody = - IrExpressionBodyImpl(createStatementGenerator().generateExpression(ktInitializer)) + fun generateExpressionBody(ktExpression: KtExpression): IrExpressionBody = + IrExpressionBodyImpl(createStatementGenerator().generateExpression(ktExpression)) fun generateLambdaBody(ktFun: KtFunctionLiteral): IrBody { val statementGenerator = createStatementGenerator() diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ClassGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ClassGenerator.kt index 5e005035038..9d0c5a4a11c 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ClassGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ClassGenerator.kt @@ -18,9 +18,7 @@ package org.jetbrains.kotlin.psi2ir.generators import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.descriptors.* -import org.jetbrains.kotlin.ir.declarations.IrClass -import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin -import org.jetbrains.kotlin.ir.declarations.IrEnumEntry +import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.declarations.impl.* import org.jetbrains.kotlin.ir.descriptors.IrImplementingDelegateDescriptorImpl import org.jetbrains.kotlin.ir.expressions.impl.* @@ -37,17 +35,16 @@ import org.jetbrains.kotlin.renderer.OverrideRenderingPolicy import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter -import org.jetbrains.kotlin.utils.addToStdlib.assertedCast import java.lang.AssertionError import java.util.* -class ClassGenerator(val declarationGenerator: DeclarationGenerator) : Generator { - override val context: GeneratorContext get() = declarationGenerator.context - +class ClassGenerator(declarationGenerator: DeclarationGenerator) : DeclarationGeneratorExtension(declarationGenerator) { fun generateClass(ktClassOrObject: KtClassOrObject): IrClass { val descriptor = getOrFail(BindingContext.CLASS, ktClassOrObject) val irClass = IrClassImpl(ktClassOrObject.startOffset, ktClassOrObject.endOffset, IrDeclarationOrigin.DEFINED, descriptor) + declarationGenerator.generateTypeParameterDeclarations(irClass, descriptor.declaredTypeParameters) + generatePrimaryConstructor(irClass, ktClassOrObject) generatePropertiesDeclaredInPrimaryConstructor(irClass, ktClassOrObject) @@ -117,7 +114,7 @@ class ClassGenerator(val declarationGenerator: DeclarationGenerator) : Generator val irDelegate = IrFieldImpl(ktDelegateExpression.startOffset, ktDelegateExpression.endOffset, IrDeclarationOrigin.DELEGATE, delegateDescriptor) val bodyGenerator = BodyGenerator(irClass.descriptor, context) - irDelegate.initializer = bodyGenerator.generatePropertyInitializerBody(ktDelegateExpression) + irDelegate.initializer = bodyGenerator.generateExpressionBody(ktDelegateExpression) irClass.addMember(irDelegate) for (delegatedMember in delegatedMembers) { @@ -128,7 +125,7 @@ class ClassGenerator(val declarationGenerator: DeclarationGenerator) : Generator } } - private fun generateDelegatedMember(irClass: IrClassImpl, irDelegate: IrFieldImpl, + private fun generateDelegatedMember(irClass: IrClass, irDelegate: IrField, delegatedMember: CallableMemberDescriptor, overriddenMember: CallableMemberDescriptor) { when (delegatedMember) { is FunctionDescriptor -> @@ -139,33 +136,36 @@ class ClassGenerator(val declarationGenerator: DeclarationGenerator) : Generator } - private fun generateDelegatedProperty(irClass: IrClassImpl, irDelegate: IrFieldImpl, - delegated: PropertyDescriptor, overridden: PropertyDescriptor) { + private fun generateDelegatedProperty(irClass: IrClass, irDelegate: IrField, delegated: PropertyDescriptor, overridden: PropertyDescriptor) { + irClass.addMember(generateDelegatedProperty(irDelegate, delegated, overridden)) + } + + private fun generateDelegatedProperty(irDelegate: IrField, delegated: PropertyDescriptor, overridden: PropertyDescriptor): IrPropertyImpl { val startOffset = irDelegate.startOffset val endOffset = irDelegate.endOffset val irProperty = IrPropertyImpl(startOffset, endOffset, IrDeclarationOrigin.DELEGATED_MEMBER, false, delegated) - val irGetter = IrFunctionImpl(startOffset, endOffset, IrDeclarationOrigin.DELEGATED_MEMBER, delegated.getter!!) - irGetter.body = generateDelegateFunctionBody(irDelegate, delegated.getter!!, overridden.getter!!) - irProperty.getter = irGetter + irProperty.getter = generateDelegatedFunction(irDelegate, delegated.getter!!, overridden.getter!!) if (delegated.isVar) { - val irSetter = IrFunctionImpl(startOffset, endOffset, IrDeclarationOrigin.DELEGATED_MEMBER, delegated.setter!!) - irSetter.body = generateDelegateFunctionBody(irDelegate, delegated.setter!!, overridden.setter!!) - irProperty.setter = irSetter + irProperty.setter = generateDelegatedFunction(irDelegate, delegated.setter!!, overridden.setter!!) } - - irClass.addMember(irProperty) + return irProperty } - private fun generateDelegatedFunction(irClass: IrClassImpl, irDelegate: IrFieldImpl, delegated: FunctionDescriptor, overridden: FunctionDescriptor) { + private fun generateDelegatedFunction(irClass: IrClass, irDelegate: IrField, delegated: FunctionDescriptor, overridden: FunctionDescriptor) { + irClass.addMember(generateDelegatedFunction(irDelegate, delegated, overridden)) + } + + private fun generateDelegatedFunction(irDelegate: IrField, delegated: FunctionDescriptor, overridden: FunctionDescriptor): IrFunction { val irFunction = IrFunctionImpl(irDelegate.startOffset, irDelegate.endOffset, IrDeclarationOrigin.DELEGATED_MEMBER, delegated) + FunctionGenerator(declarationGenerator).generateSyntheticFunctionParameterDeclarations(irFunction) irFunction.body = generateDelegateFunctionBody(irDelegate, delegated, overridden) - irClass.addMember(irFunction) + return irFunction } - private fun generateDelegateFunctionBody(irDelegate: IrFieldImpl, delegated: FunctionDescriptor, overridden: FunctionDescriptor): IrBlockBodyImpl { + private fun generateDelegateFunctionBody(irDelegate: IrField, delegated: FunctionDescriptor, overridden: FunctionDescriptor): IrBlockBodyImpl { val startOffset = irDelegate.startOffset val endOffset = irDelegate.endOffset val dispatchReceiver = delegated.dispatchReceiverParameter ?: @@ -195,7 +195,7 @@ class ClassGenerator(val declarationGenerator: DeclarationGenerator) : Generator } private fun generateAdditionalMembersForDataClass(irClass: IrClassImpl, ktClassOrObject: KtClassOrObject) { - DataClassMembersGenerator(ktClassOrObject, context, irClass).generate() + DataClassMembersGenerator(declarationGenerator).generate(ktClassOrObject, irClass) } private fun generateAdditionalMembersForEnumClass(irClass: IrClassImpl) { @@ -208,14 +208,7 @@ class ClassGenerator(val declarationGenerator: DeclarationGenerator) : Generator val primaryConstructorDescriptor = classDescriptor.unsubstitutedPrimaryConstructor ?: return - val irPrimaryConstructor = IrConstructorImpl(ktClassOrObject.startOffset, ktClassOrObject.endOffset, IrDeclarationOrigin.DEFINED, - primaryConstructorDescriptor) - - val bodyGenerator = BodyGenerator(primaryConstructorDescriptor, context) - ktClassOrObject.primaryConstructor?.valueParameterList?.let { ktValueParameterList -> - bodyGenerator.generateDefaultParameters(ktValueParameterList, irPrimaryConstructor) - } - irPrimaryConstructor.body = bodyGenerator.generatePrimaryConstructorBody(ktClassOrObject) + val irPrimaryConstructor = FunctionGenerator(declarationGenerator).generatePrimaryConstructor(primaryConstructorDescriptor, ktClassOrObject) irClass.addMember(irPrimaryConstructor) } diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/DataClassMembersGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/DataClassMembersGenerator.kt index 64581c7d642..b880768672f 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/DataClassMembersGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/DataClassMembersGenerator.kt @@ -21,6 +21,7 @@ import org.jetbrains.kotlin.backend.common.DataClassMethodGenerator import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET import org.jetbrains.kotlin.ir.builders.* +import org.jetbrains.kotlin.ir.declarations.IrClass import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin import org.jetbrains.kotlin.ir.declarations.IrFunction import org.jetbrains.kotlin.ir.declarations.impl.IrClassImpl @@ -39,119 +40,129 @@ import org.jetbrains.kotlin.types.checker.KotlinTypeChecker import java.lang.AssertionError class DataClassMembersGenerator( - ktClassOrObject: KtClassOrObject, - override val context: GeneratorContext, - val irClass: IrClassImpl -) : Generator, DataClassMethodGenerator(ktClassOrObject, context.bindingContext) { - private inline fun buildMember( - function: FunctionDescriptor, - psiElement: PsiElement? = null, - body: IrMemberFunctionBuilder.(IrFunction) -> Unit - ) { - IrMemberFunctionBuilder( - context, irClass, function, IrDeclarationOrigin.GENERATED_DATA_CLASS_MEMBER, - psiElement?.startOffset ?: UNDEFINED_OFFSET, psiElement?.endOffset ?: UNDEFINED_OFFSET - ).addToClass(body) + declarationGenerator: DeclarationGenerator +) : DeclarationGeneratorExtension(declarationGenerator), Generator{ + fun generate(ktClassOrObject: KtClassOrObject, irClass: IrClass) { + MyDataClassMethodGenerator(ktClassOrObject, irClass).generate() } - override fun generateComponentFunction(function: FunctionDescriptor, parameter: ValueParameterDescriptor) { - val ktParameter = DescriptorToSourceUtils.descriptorToDeclaration(parameter) ?: - throw AssertionError("No definition for data class constructor parameter $parameter") - - val property = getOrFail(BindingContext.VALUE_PARAMETER_AS_PROPERTY, parameter) - - buildMember(function, ktParameter) { - +irReturn(irGet(irThis(), property)) - } - } - - override fun generateCopyFunction(function: FunctionDescriptor, constructorParameters: List) { - val dataClassConstructor = classDescriptor.unsubstitutedPrimaryConstructor ?: - throw AssertionError("Data class should have a primary constructor: $classDescriptor") - - buildMember(function) { - function.valueParameters.forEach { parameter -> - val property = getOrFail(BindingContext.VALUE_PARAMETER_AS_PROPERTY, parameter) - putDefault(parameter, irGet(irThis(), property)) + private inner class MyDataClassMethodGenerator( + ktClassOrObject: KtClassOrObject, + val irClass: IrClass + ) : DataClassMethodGenerator(ktClassOrObject, declarationGenerator.context.bindingContext) { + private inline fun buildMember( + function: FunctionDescriptor, + psiElement: PsiElement? = null, + body: IrMemberFunctionBuilder.(IrFunction) -> Unit + ) { + IrMemberFunctionBuilder( + context, irClass, function, IrDeclarationOrigin.GENERATED_DATA_CLASS_MEMBER, + psiElement?.startOffset ?: UNDEFINED_OFFSET, psiElement?.endOffset ?: UNDEFINED_OFFSET + ).addToClass { irFunction -> + FunctionGenerator(declarationGenerator).generateSyntheticFunctionParameterDeclarations(irFunction) + body(irFunction) } - +irReturn(irCall(dataClassConstructor).mapValueParameters { irGet(function.valueParameters[it.index]) }) } - } - override fun generateEqualsMethod(function: FunctionDescriptor, properties: List) { - buildMember(function) { - +irIfThenReturnTrue(irEqeqeq(irThis(), irOther())) - +irIfThenReturnFalse(irNotIs(irOther(), classDescriptor.defaultType)) - val otherWithCast = defineTemporary(irAs(irOther(), classDescriptor.defaultType), "other_with_cast") - for (property in properties) { - +irIfThenReturnFalse( - irNotEquals(irGet(irThis(), property), - irGet(irGet(otherWithCast), property))) + override fun generateComponentFunction(function: FunctionDescriptor, parameter: ValueParameterDescriptor) { + val ktParameter = DescriptorToSourceUtils.descriptorToDeclaration(parameter) ?: + throw AssertionError("No definition for data class constructor parameter $parameter") + + val property = getOrFail(BindingContext.VALUE_PARAMETER_AS_PROPERTY, parameter) + + buildMember(function, ktParameter) { + +irReturn(irGet(irThis(), property)) } - +irReturnTrue() } - } - private val INT = context.builtIns.int - private val INT_TYPE = context.builtIns.intType + override fun generateCopyFunction(function: FunctionDescriptor, constructorParameters: List) { + val dataClassConstructor = classDescriptor.unsubstitutedPrimaryConstructor ?: + throw AssertionError("Data class should have a primary constructor: $classDescriptor") - private val IMUL = INT.findFirstFunction("times") { KotlinTypeChecker.DEFAULT.equalTypes(it.valueParameters[0].type, INT_TYPE) } - private val IADD = INT.findFirstFunction("plus") { KotlinTypeChecker.DEFAULT.equalTypes(it.valueParameters[0].type, INT_TYPE) } - - private fun getHashCodeFunction(type: KotlinType): CallableDescriptor { - val typeConstructorDescriptor = type.constructor.declarationDescriptor - when (typeConstructorDescriptor) { - is ClassDescriptor -> - return typeConstructorDescriptor.findFirstFunction("hashCode") { it.valueParameters.isEmpty() } - is TypeParameterDescriptor -> - return getHashCodeFunction(context.builtIns.anyType) // TODO - else -> - throw AssertionError("Unexpected type: $type") - } - } - - override fun generateHashCodeMethod(function: FunctionDescriptor, properties: List) { - buildMember(function) { - val result = defineTemporaryVar(irInt(0), "result") - var first = true - for (property in properties) { - val hashCodeOfProperty = getHashCodeOfProperty(irThis(), property) - val irNewValue = - if (first) hashCodeOfProperty - else irCallOp(IADD, irCallOp(IMUL, irGet(result), irInt(31)), hashCodeOfProperty) - +irSetVar(result, irNewValue) - first = false + buildMember(function) { + function.valueParameters.forEach { parameter -> + val property = getOrFail(BindingContext.VALUE_PARAMETER_AS_PROPERTY, parameter) + putDefault(parameter, irGet(irThis(), property)) + } + +irReturn(irCall(dataClassConstructor).mapValueParameters { irGet(function.valueParameters[it.index]) }) } - +irReturn(irGet(result)) } - } - private fun IrMemberFunctionBuilder.getHashCodeOfProperty(receiver: IrExpression, property: PropertyDescriptor): IrExpression = - when { - property.type.containsNull() -> - irLet(irGet(receiver, property)) { variable -> - irIfNull(context.builtIns.intType, irGet(variable), irInt(0), getHashCodeOf(irGet(variable))) - } + override fun generateEqualsMethod(function: FunctionDescriptor, properties: List) { + buildMember(function) { + +irIfThenReturnTrue(irEqeqeq(irThis(), irOther())) + +irIfThenReturnFalse(irNotIs(irOther(), classDescriptor.defaultType)) + val otherWithCast = defineTemporary(irAs(irOther(), classDescriptor.defaultType), "other_with_cast") + for (property in properties) { + +irIfThenReturnFalse( + irNotEquals(irGet(irThis(), property), + irGet(irGet(otherWithCast), property))) + } + +irReturnTrue() + } + } + + private val INT = context.builtIns.int + private val INT_TYPE = context.builtIns.intType + + private val IMUL = INT.findFirstFunction("times") { KotlinTypeChecker.DEFAULT.equalTypes(it.valueParameters[0].type, INT_TYPE) } + private val IADD = INT.findFirstFunction("plus") { KotlinTypeChecker.DEFAULT.equalTypes(it.valueParameters[0].type, INT_TYPE) } + + private fun getHashCodeFunction(type: KotlinType): CallableDescriptor { + val typeConstructorDescriptor = type.constructor.declarationDescriptor + when (typeConstructorDescriptor) { + is ClassDescriptor -> + return typeConstructorDescriptor.findFirstFunction("hashCode") { it.valueParameters.isEmpty() } + is TypeParameterDescriptor -> + return getHashCodeFunction(context.builtIns.anyType) // TODO else -> - getHashCodeOf(irGet(receiver, property)) + throw AssertionError("Unexpected type: $type") } + } - private fun IrMemberFunctionBuilder.getHashCodeOf(irValue: IrExpression): IrExpression = - irCall(getHashCodeFunction(irValue.type)).apply { dispatchReceiver = irValue } - - override fun generateToStringMethod(function: FunctionDescriptor, properties: List) { - buildMember(function) { - val irConcat = irConcat() - irConcat.addArgument(irString(classDescriptor.name.asString() + "(")) - var first = true - for (property in properties) { - if (!first) irConcat.addArgument(irString(", ")) - irConcat.addArgument(irString(property.name.asString() + "=")) - irConcat.addArgument(irGet(irThis(), property)) - first = false + override fun generateHashCodeMethod(function: FunctionDescriptor, properties: List) { + buildMember(function) { + val result = defineTemporaryVar(irInt(0), "result") + var first = true + for (property in properties) { + val hashCodeOfProperty = getHashCodeOfProperty(irThis(), property) + val irNewValue = + if (first) hashCodeOfProperty + else irCallOp(IADD, irCallOp(IMUL, irGet(result), irInt(31)), hashCodeOfProperty) + +irSetVar(result, irNewValue) + first = false + } + +irReturn(irGet(result)) + } + } + + private fun IrMemberFunctionBuilder.getHashCodeOfProperty(receiver: IrExpression, property: PropertyDescriptor): IrExpression = + when { + property.type.containsNull() -> + irLet(irGet(receiver, property)) { variable -> + irIfNull(context.builtIns.intType, irGet(variable), irInt(0), getHashCodeOf(irGet(variable))) + } + else -> + getHashCodeOf(irGet(receiver, property)) + } + + private fun IrMemberFunctionBuilder.getHashCodeOf(irValue: IrExpression): IrExpression = + irCall(getHashCodeFunction(irValue.type)).apply { dispatchReceiver = irValue } + + override fun generateToStringMethod(function: FunctionDescriptor, properties: List) { + buildMember(function) { + val irConcat = irConcat() + irConcat.addArgument(irString(classDescriptor.name.asString() + "(")) + var first = true + for (property in properties) { + if (!first) irConcat.addArgument(irString(", ")) + irConcat.addArgument(irString(property.name.asString() + "=")) + irConcat.addArgument(irGet(irThis(), property)) + first = false + } + irConcat.addArgument(irString(")")) + +irReturn(irConcat) } - irConcat.addArgument(irString(")")) - +irReturn(irConcat) } } } diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/DeclarationGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/DeclarationGenerator.kt index 6d46a229a4a..c463d18877c 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/DeclarationGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/DeclarationGenerator.kt @@ -17,23 +17,27 @@ package org.jetbrains.kotlin.psi2ir.generators import org.jetbrains.kotlin.descriptors.CallableDescriptor -import org.jetbrains.kotlin.descriptors.ClassConstructorDescriptor import org.jetbrains.kotlin.descriptors.ClassDescriptor +import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor +import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET import org.jetbrains.kotlin.ir.declarations.* -import org.jetbrains.kotlin.ir.declarations.impl.* +import org.jetbrains.kotlin.ir.declarations.impl.IrAnonymousInitializerImpl +import org.jetbrains.kotlin.ir.declarations.impl.IrErrorDeclarationImpl +import org.jetbrains.kotlin.ir.declarations.impl.IrTypeAliasImpl +import org.jetbrains.kotlin.ir.declarations.impl.IrTypeParameterImpl import org.jetbrains.kotlin.ir.expressions.IrBody import org.jetbrains.kotlin.ir.expressions.IrExpressionBody import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.endOffset import org.jetbrains.kotlin.psi.psiUtil.startOffset -import org.jetbrains.kotlin.psi2ir.isConstructorDelegatingToSuper import org.jetbrains.kotlin.resolve.BindingContext +import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils class DeclarationGenerator(override val context: GeneratorContext) : Generator { fun generateMemberDeclaration(ktDeclaration: KtDeclaration): IrDeclaration = when (ktDeclaration) { is KtNamedFunction -> - generateFunctionDeclaration(ktDeclaration) + FunctionGenerator(this).generateFunctionDeclaration(ktDeclaration) is KtProperty -> PropertyGenerator(this).generatePropertyDeclaration(ktDeclaration) is KtClassOrObject -> @@ -52,7 +56,7 @@ class DeclarationGenerator(override val context: GeneratorContext) : Generator { is KtAnonymousInitializer -> generateAnonymousInitializerDeclaration(ktDeclaration, classDescriptor) is KtSecondaryConstructor -> - generateSecondaryConstructor(ktDeclaration) + FunctionGenerator(this).generateSecondaryConstructor(ktDeclaration) is KtEnumEntry -> generateEnumEntryDeclaration(ktDeclaration) else -> @@ -76,44 +80,28 @@ class DeclarationGenerator(override val context: GeneratorContext) : Generator { return irAnonymousInitializer } - fun generateFunctionDeclaration(ktFunction: KtNamedFunction): IrFunction { - val functionDescriptor = getOrFail(BindingContext.FUNCTION, ktFunction) - val irFunction = IrFunctionImpl(ktFunction.startOffset, ktFunction.endOffset, IrDeclarationOrigin.DEFINED, functionDescriptor) - val bodyGenerator = createBodyGenerator(functionDescriptor) - bodyGenerator.generateDefaultParameters(ktFunction, irFunction) - irFunction.body = ktFunction.bodyExpression?.let { bodyGenerator.generateFunctionBody(it) } - return irFunction - } - - fun generateSecondaryConstructor(ktConstructor: KtSecondaryConstructor): IrFunction { - if (ktConstructor.isConstructorDelegatingToSuper(context.bindingContext)) { - return generateSecondaryConstructorWithNestedInitializers(ktConstructor) + fun generateTypeParameterDeclarations( + irTypeParametersOwner: IrTypeParametersContainer, + from: List + ) { + from.mapTo(irTypeParametersOwner.typeParameters) { typeParameterDescriptor -> + val ktTypeParameterDeclaration = DescriptorToSourceUtils.getSourceFromDescriptor(typeParameterDescriptor) + val startOffset = ktTypeParameterDeclaration?.startOffset ?: UNDEFINED_OFFSET + val endOffset = ktTypeParameterDeclaration?.endOffset ?: UNDEFINED_OFFSET + IrTypeParameterImpl(startOffset, endOffset, IrDeclarationOrigin.DEFINED, typeParameterDescriptor) } - val constructorDescriptor = getOrFail(BindingContext.CONSTRUCTOR, ktConstructor) as ClassConstructorDescriptor - val irConstructor = IrConstructorImpl(ktConstructor.startOffset, ktConstructor.endOffset, IrDeclarationOrigin.DEFINED, constructorDescriptor) - val bodyGenerator = createBodyGenerator(constructorDescriptor) - bodyGenerator.generateDefaultParameters(ktConstructor, irConstructor) - irConstructor.body = bodyGenerator.generateSecondaryConstructorBody(ktConstructor) - return irConstructor - } - - - private fun generateSecondaryConstructorWithNestedInitializers(ktConstructor: KtSecondaryConstructor): IrFunction { - val constructorDescriptor = getOrFail(BindingContext.CONSTRUCTOR, ktConstructor) as ClassConstructorDescriptor - val irConstructor = IrConstructorImpl(ktConstructor.startOffset, ktConstructor.endOffset, IrDeclarationOrigin.DEFINED, constructorDescriptor) - val bodyGenerator = createBodyGenerator(constructorDescriptor) - bodyGenerator.generateDefaultParameters(ktConstructor, irConstructor) - irConstructor.body = createBodyGenerator(constructorDescriptor).generateSecondaryConstructorBodyWithNestedInitializers(ktConstructor) - return irConstructor } fun generateFunctionBody(scopeOwner: CallableDescriptor, ktBody: KtExpression): IrBody = createBodyGenerator(scopeOwner).generateFunctionBody(ktBody) fun generateInitializerBody(scopeOwner: CallableDescriptor, ktBody: KtExpression): IrExpressionBody = - createBodyGenerator(scopeOwner).generatePropertyInitializerBody(ktBody) + createBodyGenerator(scopeOwner).generateExpressionBody(ktBody) +} - private fun createBodyGenerator(descriptor: CallableDescriptor) = - BodyGenerator(descriptor, context) +abstract class DeclarationGeneratorExtension(val declarationGenerator: DeclarationGenerator) : Generator { + override val context: GeneratorContext get() = declarationGenerator.context +} -} \ No newline at end of file +fun Generator.createBodyGenerator(scopeOwnerDescriptor: CallableDescriptor) = + BodyGenerator(scopeOwnerDescriptor, context) \ No newline at end of file diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/DelegatedPropertyGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/DelegatedPropertyGenerator.kt index 841af1088e3..dd99d4afadb 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/DelegatedPropertyGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/DelegatedPropertyGenerator.kt @@ -36,8 +36,9 @@ import org.jetbrains.kotlin.psi2ir.intermediate.* import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.types.KotlinType +class DelegatedPropertyGenerator(declarationGenerator: DeclarationGenerator) : DeclarationGeneratorExtension(declarationGenerator) { + constructor(context: GeneratorContext) : this(DeclarationGenerator(context)) -class DelegatedPropertyGenerator(override val context: GeneratorContext) : Generator { fun generateDelegatedProperty( ktProperty: KtProperty, ktDelegate: KtPropertyDelegate, @@ -55,30 +56,40 @@ class DelegatedPropertyGenerator(override val context: GeneratorContext) : Gener val delegateReceiverValue = createBackingFieldValueForDelegate(delegateDescriptor, ktDelegate) val getterDescriptor = propertyDescriptor.getter!! - irProperty.getter = IrFunctionImpl( - ktDelegate.startOffset, ktDelegate.endOffset, IrDeclarationOrigin.DELEGATED_PROPERTY_ACCESSOR, - getterDescriptor, - generateDelegatedPropertyGetterBody( - ktDelegate, getterDescriptor, delegateReceiverValue, - createCallableReference(ktDelegate, kPropertyType, propertyDescriptor) - ) - ) + irProperty.getter = generateDelegatedPropertyAccessorExceptBody(ktProperty, ktDelegate, getterDescriptor).also { irGetter -> + irGetter.body = generateDelegatedPropertyGetterBody( + ktDelegate, getterDescriptor, delegateReceiverValue, + createCallableReference(ktDelegate, kPropertyType, propertyDescriptor) + ) + } if (propertyDescriptor.isVar) { val setterDescriptor = propertyDescriptor.setter!! - irProperty.setter = IrFunctionImpl( - ktDelegate.startOffset, ktDelegate.endOffset, IrDeclarationOrigin.DELEGATED_PROPERTY_ACCESSOR, - setterDescriptor, - generateDelegatedPropertySetterBody( - ktDelegate, setterDescriptor, delegateReceiverValue, - createCallableReference(ktDelegate, kPropertyType, propertyDescriptor) - ) - ) + irProperty.setter = generateDelegatedPropertyAccessorExceptBody(ktProperty, ktDelegate, setterDescriptor).also { irSetter -> + irSetter.body = generateDelegatedPropertySetterBody( + ktDelegate, setterDescriptor, delegateReceiverValue, + createCallableReference(ktDelegate, kPropertyType, propertyDescriptor) + ) + } } return irProperty } + private fun generateDelegatedPropertyAccessorExceptBody( + ktProperty: KtProperty, + ktDelegate: KtPropertyDelegate, + accessorDescriptor: PropertyAccessorDescriptor + ): IrFunction = + IrFunctionImpl( + ktDelegate.startOffset, ktDelegate.endOffset, + IrDeclarationOrigin.DELEGATED_PROPERTY_ACCESSOR, + accessorDescriptor + ).also { irGetter -> + FunctionGenerator(declarationGenerator).generateFunctionParameterDeclarations(irGetter, ktProperty, null) + } + + private fun getKPropertyTypeForDelegatedProperty(propertyDescriptor: PropertyDescriptor): KotlinType { val receivers = listOfNotNull(propertyDescriptor.extensionReceiverParameter, propertyDescriptor.dispatchReceiverParameter) return context.reflectionTypes.getKPropertyType(Annotations.EMPTY, receivers.map{ it.type }, propertyDescriptor.type, propertyDescriptor.isVar) diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/EnumClassMembersGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/EnumClassMembersGenerator.kt index 612e1476ecf..120c8deb79d 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/EnumClassMembersGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/EnumClassMembersGenerator.kt @@ -19,6 +19,7 @@ package org.jetbrains.kotlin.psi2ir.generators import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET import org.jetbrains.kotlin.ir.declarations.impl.IrClassImpl import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin +import org.jetbrains.kotlin.ir.declarations.addMember import org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl import org.jetbrains.kotlin.ir.expressions.impl.IrSyntheticBodyImpl import org.jetbrains.kotlin.ir.expressions.IrSyntheticBodyKind @@ -39,7 +40,10 @@ class EnumClassMembersGenerator(override val context: GeneratorContext) : Genera irClass.addMember( IrFunctionImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, IrDeclarationOrigin.ENUM_CLASS_SPECIAL_MEMBER, - valuesFunction, IrSyntheticBodyImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, IrSyntheticBodyKind.ENUM_VALUES))) + valuesFunction, + IrSyntheticBodyImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, IrSyntheticBodyKind.ENUM_VALUES) + ) + ) } private fun generateValueOf(irClass: IrClassImpl) { @@ -51,6 +55,9 @@ class EnumClassMembersGenerator(override val context: GeneratorContext) : Genera irClass.addMember( IrFunctionImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, IrDeclarationOrigin.ENUM_CLASS_SPECIAL_MEMBER, - valueOfFunction, IrSyntheticBodyImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, IrSyntheticBodyKind.ENUM_VALUEOF))) + valueOfFunction, + IrSyntheticBodyImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, IrSyntheticBodyKind.ENUM_VALUEOF) + ) + ) } } diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/FunctionGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/FunctionGenerator.kt new file mode 100644 index 00000000000..551712a092f --- /dev/null +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/FunctionGenerator.kt @@ -0,0 +1,161 @@ +/* + * Copyright 2010-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.psi2ir.generators + +import org.jetbrains.kotlin.descriptors.ClassConstructorDescriptor +import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor +import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor +import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor +import org.jetbrains.kotlin.ir.declarations.IrConstructor +import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin +import org.jetbrains.kotlin.ir.declarations.IrFunction +import org.jetbrains.kotlin.ir.declarations.IrValueParameter +import org.jetbrains.kotlin.ir.declarations.impl.IrConstructorImpl +import org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl +import org.jetbrains.kotlin.ir.declarations.impl.IrValueParameterImpl +import org.jetbrains.kotlin.psi.* +import org.jetbrains.kotlin.psi.psiUtil.endOffset +import org.jetbrains.kotlin.psi.psiUtil.startOffset +import org.jetbrains.kotlin.psi2ir.endOffsetOrUndefined +import org.jetbrains.kotlin.psi2ir.isConstructorDelegatingToSuper +import org.jetbrains.kotlin.psi2ir.startOffsetOrUndefined +import org.jetbrains.kotlin.resolve.BindingContext +import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils + +class FunctionGenerator(declarationGenerator: DeclarationGenerator) : DeclarationGeneratorExtension(declarationGenerator) { + constructor(context: GeneratorContext) : this(DeclarationGenerator(context)) + + fun generateFunctionDeclaration(ktFunction: KtNamedFunction): IrFunction { + val functionDescriptor = getOrFail(BindingContext.FUNCTION, ktFunction) + val irFunction = IrFunctionImpl(ktFunction.startOffset, ktFunction.endOffset, IrDeclarationOrigin.DEFINED, functionDescriptor) + generateFunctionParameterDeclarations(irFunction, ktFunction, ktFunction.receiverTypeReference) + irFunction.body = ktFunction.bodyExpression?.let { createBodyGenerator(functionDescriptor).generateFunctionBody(it) } + return irFunction + } + + fun generateLambdaFunctionDeclaration(ktFunction: KtFunctionLiteral): IrFunction { + val lambdaDescriptor = getOrFail(BindingContext.FUNCTION, ktFunction) + val irLambdaFunction = IrFunctionImpl(ktFunction.startOffset, ktFunction.endOffset, IrDeclarationOrigin.LOCAL_FUNCTION_FOR_LAMBDA, lambdaDescriptor) + generateFunctionParameterDeclarations(irLambdaFunction, ktFunction, null) + irLambdaFunction.body = createBodyGenerator(lambdaDescriptor).generateLambdaBody(ktFunction) + return irLambdaFunction + } + + fun generateFunctionParameterDeclarations( + irFunction: IrFunction, + ktParameterOwner: KtElement, + ktReceiverParameterElement: KtElement? + ) { + declarationGenerator.generateTypeParameterDeclarations(irFunction, irFunction.descriptor.typeParameters) + generateValueParameterDeclarations(irFunction, ktParameterOwner, ktReceiverParameterElement) + } + + fun generatePrimaryConstructor( + primaryConstructorDescriptor: ClassConstructorDescriptor, + ktClassOrObject: KtClassOrObject + ): IrConstructor { + val irPrimaryConstructor = IrConstructorImpl( + ktClassOrObject.startOffset, ktClassOrObject.endOffset, + IrDeclarationOrigin.DEFINED, + primaryConstructorDescriptor + ) + + generateFunctionParameterDeclarations( + irPrimaryConstructor, + ktClassOrObject.primaryConstructor ?: ktClassOrObject, + null + ) + + irPrimaryConstructor.body = BodyGenerator(primaryConstructorDescriptor, context).generatePrimaryConstructorBody(ktClassOrObject) + + return irPrimaryConstructor + } + + fun generateSyntheticFunctionParameterDeclarations(irFunction: IrFunction) { + declarationGenerator.generateTypeParameterDeclarations(irFunction, irFunction.descriptor.typeParameters) + generateValueParameterDeclarations(irFunction, null, null) + } + + private fun generateValueParameterDeclarations( + irFunction: IrFunction, + ktParameterOwner: KtElement?, + ktReceiverParameterElement: KtElement? + ) { + val functionDescriptor = irFunction.descriptor + + irFunction.dispatchReceiverParameter = functionDescriptor.dispatchReceiverParameter?.let { + generateReceiverParameterDeclaration(it, ktParameterOwner) + } + + irFunction.extensionReceiverParameter = functionDescriptor.extensionReceiverParameter?.let { + generateReceiverParameterDeclaration(it, ktReceiverParameterElement ?: ktParameterOwner) + } + + val bodyGenerator = createBodyGenerator(functionDescriptor) + functionDescriptor.valueParameters.mapTo(irFunction.valueParameters) { valueParameterDescriptor -> + val ktParameter = DescriptorToSourceUtils.getSourceFromDescriptor(valueParameterDescriptor) as? KtParameter + generateValueParameterDeclaration(valueParameterDescriptor, ktParameter, bodyGenerator) + } + } + + private fun generateValueParameterDeclaration( + valueParameterDescriptor: ValueParameterDescriptor, + ktParameter: KtParameter?, + bodyGenerator: BodyGenerator + ): IrValueParameter = + IrValueParameterImpl( + ktParameter.startOffsetOrUndefined, + ktParameter.endOffsetOrUndefined, + IrDeclarationOrigin.DEFINED, + valueParameterDescriptor, + ktParameter?.defaultValue?.let { + bodyGenerator.generateExpressionBody(it) + } + ) + + private fun generateReceiverParameterDeclaration( + receiverParameterDescriptor: ReceiverParameterDescriptor, + ktElement: KtElement? + ): IrValueParameter = + IrValueParameterImpl( + ktElement.startOffsetOrUndefined, + ktElement.endOffsetOrUndefined, + IrDeclarationOrigin.DEFINED, + receiverParameterDescriptor + ) + + fun generateSecondaryConstructor(ktConstructor: KtSecondaryConstructor): IrFunction { + val constructorDescriptor = getOrFail(BindingContext.CONSTRUCTOR, ktConstructor) as ClassConstructorDescriptor + + val irConstructor = IrConstructorImpl(ktConstructor.startOffset, ktConstructor.endOffset, IrDeclarationOrigin.DEFINED, + constructorDescriptor) + + generateFunctionParameterDeclarations(irConstructor, ktConstructor, null) + + irConstructor.body = createBodyGenerator(constructorDescriptor).run { + if (ktConstructor.isConstructorDelegatingToSuper(context.bindingContext)) + generateSecondaryConstructorBodyWithNestedInitializers(ktConstructor) + else + generateSecondaryConstructorBody(ktConstructor) + } + + return irConstructor + } + + + +} \ No newline at end of file diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/LocalFunctionGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/LocalFunctionGenerator.kt index 3f3c4302427..59db352f65b 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/LocalFunctionGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/LocalFunctionGenerator.kt @@ -17,36 +17,29 @@ package org.jetbrains.kotlin.psi2ir.generators import org.jetbrains.kotlin.ir.IrStatement -import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin import org.jetbrains.kotlin.ir.declarations.IrFunction -import org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl +import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin import org.jetbrains.kotlin.ir.expressions.impl.IrBlockImpl import org.jetbrains.kotlin.ir.expressions.impl.IrCallableReferenceImpl -import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin import org.jetbrains.kotlin.psi.KtLambdaExpression import org.jetbrains.kotlin.psi.KtNamedFunction import org.jetbrains.kotlin.psi.psiUtil.endOffset import org.jetbrains.kotlin.psi.psiUtil.startOffset -import org.jetbrains.kotlin.resolve.BindingContext class LocalFunctionGenerator(statementGenerator: StatementGenerator) : StatementGeneratorExtension(statementGenerator) { fun generateLambda(ktLambda: KtLambdaExpression): IrStatement { val ktFun = ktLambda.functionLiteral val lambdaExpressionType = getInferredTypeWithImplicitCastsOrFail(ktLambda) - val lambdaDescriptor = getOrFail(BindingContext.FUNCTION, ktFun) + val irLambdaFunction = FunctionGenerator(context).generateLambdaFunctionDeclaration(ktFun) + val irBlock = IrBlockImpl(ktLambda.startOffset, ktLambda.endOffset, lambdaExpressionType, IrStatementOrigin.LAMBDA) - - val irFun = IrFunctionImpl(ktFun.startOffset, ktFun.endOffset, IrDeclarationOrigin.LOCAL_FUNCTION_FOR_LAMBDA, lambdaDescriptor) - irFun.body = BodyGenerator(lambdaDescriptor, statementGenerator.context).generateLambdaBody(ktFun) - irBlock.statements.add(irFun) - + irBlock.statements.add(irLambdaFunction) irBlock.statements.add( IrCallableReferenceImpl( ktLambda.startOffset, ktLambda.endOffset, lambdaExpressionType, - lambdaDescriptor, null, IrStatementOrigin.LAMBDA + irLambdaFunction.descriptor, null, IrStatementOrigin.LAMBDA ) ) - return irBlock } @@ -73,6 +66,5 @@ class LocalFunctionGenerator(statementGenerator: StatementGenerator) : Statement } private fun generateFunctionDeclaration(ktFun: KtNamedFunction): IrFunction = - DeclarationGenerator(context).generateFunctionDeclaration(ktFun) - + FunctionGenerator(context).generateFunctionDeclaration(ktFun) } \ No newline at end of file diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/PropertyGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/PropertyGenerator.kt index 185d3c94bd3..9c20ab8db18 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/PropertyGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/PropertyGenerator.kt @@ -16,10 +16,7 @@ package org.jetbrains.kotlin.psi2ir.generators -import org.jetbrains.kotlin.descriptors.ClassDescriptor -import org.jetbrains.kotlin.descriptors.PropertyDescriptor -import org.jetbrains.kotlin.descriptors.PropertyGetterDescriptor -import org.jetbrains.kotlin.descriptors.PropertySetterDescriptor +import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.ir.declarations.IrDeclaration import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin import org.jetbrains.kotlin.ir.declarations.IrFunction @@ -37,11 +34,11 @@ import org.jetbrains.kotlin.psi.KtProperty import org.jetbrains.kotlin.psi.KtPropertyDelegate import org.jetbrains.kotlin.psi.psiUtil.endOffset import org.jetbrains.kotlin.psi.psiUtil.startOffset +import org.jetbrains.kotlin.psi2ir.endOffsetOrUndefined +import org.jetbrains.kotlin.psi2ir.startOffsetOrUndefined import org.jetbrains.kotlin.resolve.BindingContext -class PropertyGenerator(val declarationGenerator: DeclarationGenerator) : Generator { - override val context: GeneratorContext get() = declarationGenerator.context - +class PropertyGenerator(declarationGenerator: DeclarationGenerator) : DeclarationGeneratorExtension(declarationGenerator) { fun generatePropertyDeclaration(ktProperty: KtProperty): IrProperty { val propertyDescriptor = getPropertyDescriptor(ktProperty) val ktDelegate = ktProperty.delegate @@ -65,25 +62,32 @@ class PropertyGenerator(val declarationGenerator: DeclarationGenerator) : Genera val getter = propertyDescriptor.getter ?: throw AssertionError("Property declared in primary constructor has no getter: $propertyDescriptor") - val irGetter = IrFunctionImpl(ktParameter.startOffset, ktParameter.endOffset, IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR, getter) - irProperty.getter = irGetter - irGetter.body = generateDefaultGetterBody(ktParameter, getter) + irProperty.getter = generateDefaultAccessor(getter, ktParameter, isGetter = true) if (propertyDescriptor.isVar) { val setter = propertyDescriptor.setter ?: throw AssertionError("Property declared in primary constructor has no setter: $propertyDescriptor") - val irSetter = IrFunctionImpl(ktParameter.startOffset, ktParameter.endOffset, IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR, setter) - irSetter.body = generateDefaultSetterBody(ktParameter, setter) - irProperty.setter = irSetter + irProperty.setter = generateDefaultAccessor(setter, ktParameter, isGetter = false) } return irProperty } + fun generateDefaultAccessor(descriptor: PropertyAccessorDescriptor, ktElement: KtElement, isGetter: Boolean): IrFunction { + val irAccessor = IrFunctionImpl(ktElement.startOffsetOrUndefined, ktElement.endOffsetOrUndefined, IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR, descriptor) + val accessorDescriptor = irAccessor.descriptor + declarationGenerator.generateTypeParameterDeclarations(irAccessor, accessorDescriptor.typeParameters) + FunctionGenerator(declarationGenerator).generateSyntheticFunctionParameterDeclarations(irAccessor) + irAccessor.body = + if (isGetter) generateDefaultGetterBody(ktElement, descriptor as PropertyGetterDescriptor) + else generateDefaultSetterBody(ktElement, descriptor as PropertySetterDescriptor) + return irAccessor + } + private fun generateDelegatedProperty(ktProperty: KtProperty, ktDelegate: KtPropertyDelegate, propertyDescriptor: PropertyDescriptor): IrProperty { val ktDelegateExpression = ktDelegate.expression!! val irDelegateInitializer = declarationGenerator.generateInitializerBody(propertyDescriptor, ktDelegateExpression) - return DelegatedPropertyGenerator(context).generateDelegatedProperty(ktProperty, ktDelegate, propertyDescriptor, irDelegateInitializer) + return DelegatedPropertyGenerator(declarationGenerator).generateDelegatedProperty(ktProperty, ktDelegate, propertyDescriptor, irDelegateInitializer) } private fun generateSimpleProperty(ktProperty: KtProperty, propertyDescriptor: PropertyDescriptor): IrProperty { @@ -114,6 +118,7 @@ class PropertyGenerator(val declarationGenerator: DeclarationGenerator) : Genera val irGetter = ktGetter?.let { IrFunctionImpl(it.startOffset, it.endOffset, IrDeclarationOrigin.DEFINED, getter) } ?: IrFunctionImpl(ktProperty.startOffset, ktProperty.endOffset, IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR, getter) + FunctionGenerator(declarationGenerator).generateFunctionParameterDeclarations(irGetter, ktProperty, ktProperty.receiverTypeReference) irGetter.body = ktGetter?.bodyExpression?.let { declarationGenerator.generateFunctionBody(getter, it ) @@ -131,6 +136,7 @@ class PropertyGenerator(val declarationGenerator: DeclarationGenerator) : Genera val irSetter = ktSetter?.let { IrFunctionImpl(it.startOffset, it.endOffset, IrDeclarationOrigin.DEFINED, setter) } ?: IrFunctionImpl(ktProperty.startOffset, ktProperty.endOffset, IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR, setter) + FunctionGenerator(declarationGenerator).generateFunctionParameterDeclarations(irSetter, ktProperty, ktProperty.receiverTypeReference) irSetter.body = ktSetter?.bodyExpression?.let { declarationGenerator.generateFunctionBody(setter, it ) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/builders/IrMemberFunctionBuilder.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/builders/IrMemberFunctionBuilder.kt index fe0eb258ce9..8de17b0da01 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/builders/IrMemberFunctionBuilder.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/builders/IrMemberFunctionBuilder.kt @@ -19,15 +19,17 @@ package org.jetbrains.kotlin.ir.builders import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET +import org.jetbrains.kotlin.ir.declarations.IrClass import org.jetbrains.kotlin.ir.declarations.impl.IrClassImpl import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin import org.jetbrains.kotlin.ir.declarations.IrFunction import org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl +import org.jetbrains.kotlin.ir.declarations.putDefault import org.jetbrains.kotlin.ir.expressions.IrExpression class IrMemberFunctionBuilder( context: IrGeneratorContext, - val irClass: IrClassImpl, + val irClass: IrClass, val function: FunctionDescriptor, val origin: IrDeclarationOrigin, startOffset: Int = UNDEFINED_OFFSET, @@ -35,11 +37,12 @@ class IrMemberFunctionBuilder( ) : IrBlockBodyBuilder(context, Scope(function), startOffset, endOffset) { lateinit var irFunction: IrFunction - inline fun addToClass(body: IrMemberFunctionBuilder.(IrFunction) -> Unit) { + inline fun addToClass(body: IrMemberFunctionBuilder.(IrFunction) -> Unit): IrFunction { irFunction = IrFunctionImpl(startOffset, endOffset, origin, function) body(irFunction) irFunction.body = doBuild() - irClass.addMember(irFunction) + irClass.declarations.add(irFunction) + return irFunction } fun putDefault(parameter: ValueParameterDescriptor, value: IrExpression) { diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrClass.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrClass.kt index be73147acd4..afcf1a84aba 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrClass.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrClass.kt @@ -18,13 +18,19 @@ package org.jetbrains.kotlin.ir.declarations import org.jetbrains.kotlin.descriptors.ClassDescriptor -interface IrClass : IrDeclaration, IrDeclarationContainer { +interface IrClass : IrDeclaration, IrDeclarationContainer, IrTypeParametersContainer { override val declarationKind: IrDeclarationKind get() = IrDeclarationKind.CLASS override val descriptor: ClassDescriptor +} - val typeParameters: MutableList +fun IrClass.addMember(member: IrDeclaration) { + declarations.add(member) +} + +fun IrClass.addAll(members: List) { + declarations.addAll(members) } fun IrClass.getInstanceInitializerMembers() = diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrDeclarationContainer.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrDeclarationContainer.kt index 5e8e6a321c2..df2cc487a28 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrDeclarationContainer.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrDeclarationContainer.kt @@ -16,8 +16,6 @@ package org.jetbrains.kotlin.ir.declarations -import org.jetbrains.kotlin.ir.util.transformFlat - interface IrDeclarationContainer { val declarations: MutableList } diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrFunction.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrFunction.kt index e47404842bb..7f7abaef3d2 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrFunction.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrFunction.kt @@ -21,19 +21,32 @@ import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor import org.jetbrains.kotlin.ir.expressions.IrBody import org.jetbrains.kotlin.ir.expressions.IrExpressionBody -interface IrFunction : IrDeclaration { +interface IrFunction : IrDeclaration, IrTypeParametersContainer { override val descriptor: FunctionDescriptor - val typeParameters: MutableList - + var dispatchReceiverParameter: IrValueParameter? + var extensionReceiverParameter: IrValueParameter? val valueParameters: MutableList var body: IrBody? override val declarationKind: IrDeclarationKind get() = IrDeclarationKind.FUNCTION - - fun putDefault(parameter: ValueParameterDescriptor, expressionBody: IrExpressionBody) - fun getDefault(parameter: ValueParameterDescriptor): IrExpressionBody? } + +fun IrFunction.getIrValueParameter(parameter: ValueParameterDescriptor): IrValueParameter = + valueParameters.getOrElse(parameter.index) { + throw AssertionError("No IrValueParameter for $parameter") + }.also { found -> + assert(found.descriptor == parameter) { + "Parameter indices mismatch at $descriptor: $parameter != ${found.descriptor}" + } + } + +fun IrFunction.getDefault(parameter: ValueParameterDescriptor): IrExpressionBody? = + getIrValueParameter(parameter).defaultValue + +fun IrFunction.putDefault(parameter: ValueParameterDescriptor, expressionBody: IrExpressionBody) { + getIrValueParameter(parameter).defaultValue = expressionBody +} diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrTypeParametersContainer.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrTypeParametersContainer.kt new file mode 100644 index 00000000000..e92214cf261 --- /dev/null +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrTypeParametersContainer.kt @@ -0,0 +1,21 @@ +/* + * Copyright 2010-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.ir.declarations + +interface IrTypeParametersContainer { + val typeParameters: MutableList +} \ No newline at end of file diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrClassImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrClassImpl.kt index 8611e1db259..605f0fb9a4a 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrClassImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrClassImpl.kt @@ -41,14 +41,6 @@ class IrClassImpl( override val typeParameters: MutableList = SmartList() - fun addMember(member: IrDeclaration) { - declarations.add(member) - } - - fun addAll(members: List) { - declarations.addAll(members) - } - override fun accept(visitor: IrElementVisitor, data: D): R = visitor.visitClass(this, data) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrFunctionBase.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrFunctionBase.kt index c388390479a..c0abbcddb48 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrFunctionBase.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrFunctionBase.kt @@ -35,30 +35,27 @@ abstract class IrFunctionBase( ) : IrDeclarationBase(startOffset, endOffset, origin), IrFunction { override val typeParameters: MutableList = SmartList() + override var dispatchReceiverParameter: IrValueParameter? = null + override var extensionReceiverParameter: IrValueParameter? = null override val valueParameters: MutableList = ArrayList() final override var body: IrBody? = null - private fun getIrValueParameter(parameter: ValueParameterDescriptor): IrValueParameter = - valueParameters.getOrElse(parameter.index) { - throw AssertionError("No IrValueParameter for $parameter") - } - - override fun getDefault(parameter: ValueParameterDescriptor): IrExpressionBody? = - getIrValueParameter(parameter).defaultValue - - override fun putDefault(parameter: ValueParameterDescriptor, expressionBody: IrExpressionBody) { - getIrValueParameter(parameter).defaultValue = expressionBody - } - override fun acceptChildren(visitor: IrElementVisitor, data: D) { typeParameters.forEach { it.accept(visitor, data) } + + dispatchReceiverParameter?.accept(visitor, data) + extensionReceiverParameter?.accept(visitor, data) valueParameters.forEach { it.accept(visitor, data) } + body?.accept(visitor, data) } override fun transformChildren(transformer: IrElementTransformer, data: D) { typeParameters.transform { it.transform(transformer, data) } + + dispatchReceiverParameter = dispatchReceiverParameter?.transform(transformer, data) + extensionReceiverParameter = extensionReceiverParameter?.transform(transformer, data) valueParameters.transform { it.transform(transformer, data) } body = body?.transform(transformer, data) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrValueParameterImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrValueParameterImpl.kt index b88d4e9fdeb..7721c9bc044 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrValueParameterImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrValueParameterImpl.kt @@ -36,7 +36,7 @@ class IrValueParameterImpl( endOffset: Int, origin: IrDeclarationOrigin, descriptor: ParameterDescriptor, - defaultValue: IrExpressionBody + defaultValue: IrExpressionBody? ) : this(startOffset, endOffset, origin, descriptor) { this.defaultValue = defaultValue } diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeepCopyIrTree.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeepCopyIrTree.kt index 3fc2867d046..ce7d3f140d8 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeepCopyIrTree.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DeepCopyIrTree.kt @@ -85,7 +85,9 @@ open class DeepCopyIrTree : IrElementTransformerVoid() { mapDeclarationOrigin(declaration.origin), mapClassDeclaration(declaration.descriptor), declaration.declarations.map { it.transform(this, null) as IrDeclaration } - ) + ).apply { + transformTypeParameters(declaration, descriptor.declaredTypeParameters) + } override fun visitTypeAlias(declaration: IrTypeAlias): IrTypeAlias = IrTypeAliasImpl( @@ -100,7 +102,7 @@ open class DeepCopyIrTree : IrElementTransformerVoid() { mapDeclarationOrigin(declaration.origin), mapFunctionDeclaration(declaration.descriptor), declaration.body?.transform(this, null) - ).transformDefaults(declaration) + ).transformParameters(declaration) override fun visitConstructor(declaration: IrConstructor): IrConstructor = IrConstructorImpl( @@ -108,17 +110,59 @@ open class DeepCopyIrTree : IrElementTransformerVoid() { mapDeclarationOrigin(declaration.origin), mapConstructorDeclaration(declaration.descriptor), declaration.body!!.transform(this, null) - ).transformDefaults(declaration) + ).transformParameters(declaration) - private fun T.transformDefaults(original: T): T { - for (originalValueParameter in original.descriptor.valueParameters) { - val valueParameter = descriptor.valueParameters[originalValueParameter.index] - original.getDefault(originalValueParameter)?.let { irDefaultParameterValue -> - putDefault(valueParameter, irDefaultParameterValue.transform(this@DeepCopyIrTree, null)) + private fun T.transformTypeParameters(original: T, myTypeParameters: List): T = + apply { + original.typeParameters.mapTo(typeParameters) { originalTypeParameter -> + copyTypeParameter(originalTypeParameter, myTypeParameters[originalTypeParameter.descriptor.index]) + } } - } - return this - } + + private fun T.transformParameters(original: T): T = + apply { + transformTypeParameters(original, descriptor.typeParameters) + transformValueParameters(original) + } + + private fun T.transformValueParameters(original: T) = + apply { + dispatchReceiverParameter = original.dispatchReceiverParameter?.let { + copyValueParameter(it, descriptor.dispatchReceiverParameter ?: throw AssertionError("No dispatch receiver in $descriptor")) + } + + extensionReceiverParameter = original.extensionReceiverParameter?.let { + copyValueParameter(it, descriptor.extensionReceiverParameter ?: throw AssertionError("No extension receiver in $descriptor")) + } + + original.valueParameters.mapIndexedTo(valueParameters) { i, originalValueParameter -> + copyValueParameter(originalValueParameter, descriptor.valueParameters[i]) + } + } + + private fun copyTypeParameter( + originalTypeParameter: IrTypeParameter, + newTypeParameterDescriptor: TypeParameterDescriptor + ): IrTypeParameterImpl = + IrTypeParameterImpl( + originalTypeParameter.startOffset, originalTypeParameter.endOffset, + mapDeclarationOrigin(originalTypeParameter.origin), + newTypeParameterDescriptor + ) + + private fun copyValueParameter( + originalValueParameter: IrValueParameter, + newParameterDescriptor: ParameterDescriptor + ): IrValueParameterImpl = + IrValueParameterImpl( + originalValueParameter.startOffset, originalValueParameter.endOffset, + mapDeclarationOrigin(originalValueParameter.origin), + newParameterDescriptor, + originalValueParameter.defaultValue?.transform(this@DeepCopyIrTree, null) + ) + + // TODO visitTypeParameter + // TODO visitValueParameter override fun visitProperty(declaration: IrProperty): IrProperty = IrPropertyImpl( diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DumpIrTree.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DumpIrTree.kt index c9741053370..907009de190 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DumpIrTree.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DumpIrTree.kt @@ -71,6 +71,8 @@ class DumpIrTreeVisitor(out: Appendable): IrElementVisitor { override fun visitFunction(declaration: IrFunction, data: String) { declaration.dumpLabeledElementWith(data) { declaration.typeParameters.dumpElements() + declaration.dispatchReceiverParameter?.accept(this, "\$this") + declaration.extensionReceiverParameter?.accept(this, "\$receiver") declaration.valueParameters.dumpElements() declaration.body?.accept(this, "") } 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 1433572954e..f249244411c 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 @@ -16,11 +16,13 @@ package org.jetbrains.kotlin.ir.util +import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor import org.jetbrains.kotlin.ir.IrElement import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.expressions.* +import org.jetbrains.kotlin.ir.util.RenderIrElementVisitor.Companion.ref import org.jetbrains.kotlin.ir.visitors.IrElementVisitor import org.jetbrains.kotlin.renderer.ClassifierNamePolicy import org.jetbrains.kotlin.renderer.DescriptorRenderer @@ -209,14 +211,17 @@ class RenderIrElementVisitor : IrElementVisitor { internal fun IrDeclaration.name(): String = descriptor.name.toString() - internal fun IrDeclaration.renderDeclared(): String = - DECLARATION_RENDERER.render(this.descriptor) - - internal fun DeclarationDescriptor.ref(): String = - if (this is ReceiverParameterDescriptor) - "" + internal fun DescriptorRenderer.renderDescriptor(descriptor: DeclarationDescriptor): String = + if (descriptor is ReceiverParameterDescriptor) + "" else - REFERENCE_RENDERER.render(this) + render(descriptor) + + internal fun IrDeclaration.renderDeclared(): String = + DECLARATION_RENDERER.renderDescriptor(this.descriptor) + + internal fun DeclarationDescriptor.ref(): String = + REFERENCE_RENDERER.renderDescriptor(this) internal fun KotlinType.render(): String = DECLARATION_RENDERER.renderType(this) diff --git a/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.txt b/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.txt index 8e5fc0fd0ed..c987bdec7a4 100644 --- a/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.txt +++ b/compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.txt @@ -1,6 +1,8 @@ FILE /argumentReorderingInDelegatingConstructorCall.kt CLASS CLASS Base CONSTRUCTOR public constructor Base(x: kotlin.Int, y: kotlin.Int) + VALUE_PARAMETER value-parameter x: kotlin.Int + VALUE_PARAMETER value-parameter y: kotlin.Int BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Base' @@ -9,6 +11,7 @@ FILE /argumentReorderingInDelegatingConstructorCall.kt EXPRESSION_BODY GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null @@ -18,12 +21,15 @@ FILE /argumentReorderingInDelegatingConstructorCall.kt EXPRESSION_BODY GET_VAR 'value-parameter y: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'y: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=Base origin=null CLASS CLASS Test1 CONSTRUCTOR public constructor Test1(xx: kotlin.Int, yy: kotlin.Int) + VALUE_PARAMETER value-parameter xx: kotlin.Int + VALUE_PARAMETER value-parameter yy: kotlin.Int BLOCK_BODY BLOCK type=kotlin.Unit origin=ARGUMENTS_REORDERING_FOR_CALL VAR IR_TEMPORARY_VARIABLE val tmp0_y: kotlin.Int @@ -36,6 +42,8 @@ FILE /argumentReorderingInDelegatingConstructorCall.kt INSTANCE_INITIALIZER_CALL classDescriptor='Test1' CLASS CLASS Test2 CONSTRUCTOR public constructor Test2(xx: kotlin.Int, yy: kotlin.Int) + VALUE_PARAMETER value-parameter xx: kotlin.Int + VALUE_PARAMETER value-parameter yy: kotlin.Int BLOCK_BODY BLOCK type=kotlin.Unit origin=ARGUMENTS_REORDERING_FOR_CALL VAR IR_TEMPORARY_VARIABLE val tmp0_y: kotlin.Int @@ -47,6 +55,9 @@ FILE /argumentReorderingInDelegatingConstructorCall.kt y: GET_VAR 'tmp0_y: Int' type=kotlin.Int origin=null INSTANCE_INITIALIZER_CALL classDescriptor='Test2' CONSTRUCTOR public constructor Test2(xxx: kotlin.Int, yyy: kotlin.Int, a: kotlin.Any) + VALUE_PARAMETER value-parameter xxx: kotlin.Int + VALUE_PARAMETER value-parameter yyy: kotlin.Int + VALUE_PARAMETER value-parameter a: kotlin.Any BLOCK_BODY BLOCK type=kotlin.Unit origin=ARGUMENTS_REORDERING_FOR_CALL VAR IR_TEMPORARY_VARIABLE val tmp0_yy: kotlin.Int diff --git a/compiler/testData/ir/irText/classes/classMembers.txt b/compiler/testData/ir/irText/classes/classMembers.txt index 0809a5a9532..d694149bb81 100644 --- a/compiler/testData/ir/irText/classes/classMembers.txt +++ b/compiler/testData/ir/irText/classes/classMembers.txt @@ -1,8 +1,11 @@ FILE /classMembers.kt CLASS CLASS C CONSTRUCTOR public constructor C(x: kotlin.Int, y: kotlin.Int, z: kotlin.Int = ...) - z: EXPRESSION_BODY - CONST Int type=kotlin.Int value='1' + VALUE_PARAMETER value-parameter x: kotlin.Int + VALUE_PARAMETER value-parameter y: kotlin.Int + VALUE_PARAMETER value-parameter z: kotlin.Int = ... + EXPRESSION_BODY + CONST Int type=kotlin.Int value='1' BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='C' @@ -11,6 +14,7 @@ FILE /classMembers.kt EXPRESSION_BODY GET_VAR 'value-parameter y: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'y: Int' type=kotlin.Int origin=null @@ -20,11 +24,14 @@ FILE /classMembers.kt EXPRESSION_BODY GET_VAR 'value-parameter z: Int = ...' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'z: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=C origin=null FUN DEFAULT_PROPERTY_ACCESSOR public final fun (: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter : kotlin.Int BLOCK_BODY SET_FIELD 'z: Int' type=kotlin.Unit origin=null receiver: GET_VAR '' type=C origin=null @@ -40,31 +47,39 @@ FILE /classMembers.kt EXPRESSION_BODY CONST Int type=kotlin.Int value='0' FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'property: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=C origin=null PROPERTY public final val propertyWithGet: kotlin.Int FUN public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CONST Int type=kotlin.Int value='42' PROPERTY public final var propertyWithGetAndSet: kotlin.Int FUN public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY $this: GET_VAR '' type=C origin=null FUN public final fun (value: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter value: kotlin.Int BLOCK_BODY CALL '(Int): Unit' type=kotlin.Unit origin=EQ $this: GET_VAR '' type=C origin=null : GET_VAR 'value-parameter value: Int' type=kotlin.Int origin=null FUN public final fun function(): kotlin.Unit + $this: VALUE_PARAMETER BLOCK_BODY CALL 'println(Any?): Unit' type=kotlin.Unit origin=null message: CONST String type=kotlin.String value='1' FUN public final fun kotlin.Int.memberExtensionFunction(): kotlin.Unit + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER BLOCK_BODY CALL 'println(Any?): Unit' type=kotlin.Unit origin=null message: CONST String type=kotlin.String value='2' @@ -74,16 +89,21 @@ FILE /classMembers.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='NestedClass' FUN public final fun function(): kotlin.Unit + $this: VALUE_PARAMETER BLOCK_BODY CALL 'println(Any?): Unit' type=kotlin.Unit origin=null message: CONST String type=kotlin.String value='3' FUN public final fun kotlin.Int.memberExtensionFunction(): kotlin.Unit + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER BLOCK_BODY CALL 'println(Any?): Unit' type=kotlin.Unit origin=null message: CONST String type=kotlin.String value='4' CLASS INTERFACE NestedInterface FUN public abstract fun foo(): kotlin.Unit + $this: VALUE_PARAMETER FUN public open fun bar(): kotlin.Unit + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='bar(): Unit' CALL 'foo(): Unit' type=kotlin.Unit origin=null diff --git a/compiler/testData/ir/irText/classes/dataClasses.txt b/compiler/testData/ir/irText/classes/dataClasses.txt index 6e0610f893c..33bd609c46f 100644 --- a/compiler/testData/ir/irText/classes/dataClasses.txt +++ b/compiler/testData/ir/irText/classes/dataClasses.txt @@ -1,6 +1,9 @@ FILE /dataClasses.kt CLASS CLASS Test1 CONSTRUCTOR public constructor Test1(x: kotlin.Int, y: kotlin.String, z: kotlin.Any) + VALUE_PARAMETER value-parameter x: kotlin.Int + VALUE_PARAMETER value-parameter y: kotlin.String + VALUE_PARAMETER value-parameter z: kotlin.Any BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Test1' @@ -9,6 +12,7 @@ FILE /dataClasses.kt EXPRESSION_BODY GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null @@ -18,6 +22,7 @@ FILE /dataClasses.kt EXPRESSION_BODY GET_VAR 'value-parameter y: String' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.String + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): String' GET_FIELD 'y: String' type=kotlin.String origin=null @@ -27,35 +32,43 @@ FILE /dataClasses.kt EXPRESSION_BODY GET_VAR 'value-parameter z: Any' type=kotlin.Any origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Any + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Any' GET_FIELD 'z: Any' type=kotlin.Any origin=null receiver: GET_VAR '' type=Test1 origin=null FUN GENERATED_DATA_CLASS_MEMBER public final operator fun component1(): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='component1(): Int' CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY $this: GET_VAR '' type=Test1 origin=null FUN GENERATED_DATA_CLASS_MEMBER public final operator fun component2(): kotlin.String + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='component2(): String' CALL '(): String' type=kotlin.String origin=GET_PROPERTY $this: GET_VAR '' type=Test1 origin=null FUN GENERATED_DATA_CLASS_MEMBER public final operator fun component3(): kotlin.Any + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='component3(): Any' CALL '(): Any' type=kotlin.Any origin=GET_PROPERTY $this: GET_VAR '' type=Test1 origin=null FUN GENERATED_DATA_CLASS_MEMBER public final fun copy(x: kotlin.Int = ..., y: kotlin.String = ..., z: kotlin.Any = ...): Test1 - x: EXPRESSION_BODY - CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY - $this: GET_VAR '' type=Test1 origin=null - y: EXPRESSION_BODY - CALL '(): String' type=kotlin.String origin=GET_PROPERTY - $this: GET_VAR '' type=Test1 origin=null - z: EXPRESSION_BODY - CALL '(): Any' type=kotlin.Any origin=GET_PROPERTY - $this: GET_VAR '' type=Test1 origin=null + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter x: kotlin.Int = ... + EXPRESSION_BODY + CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY + $this: GET_VAR '' type=Test1 origin=null + VALUE_PARAMETER value-parameter y: kotlin.String = ... + EXPRESSION_BODY + CALL '(): String' type=kotlin.String origin=GET_PROPERTY + $this: GET_VAR '' type=Test1 origin=null + VALUE_PARAMETER value-parameter z: kotlin.Any = ... + EXPRESSION_BODY + CALL '(): Any' type=kotlin.Any origin=GET_PROPERTY + $this: GET_VAR '' type=Test1 origin=null BLOCK_BODY RETURN type=kotlin.Nothing from='copy(Int = ..., String = ..., Any = ...): Test1' CALL 'constructor Test1(Int, String, Any)' type=Test1 origin=null @@ -63,6 +76,7 @@ FILE /dataClasses.kt y: GET_VAR 'value-parameter y: String = ...' type=kotlin.String origin=null z: GET_VAR 'value-parameter z: Any = ...' type=kotlin.Any origin=null FUN GENERATED_DATA_CLASS_MEMBER public open override fun toString(): kotlin.String + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='toString(): String' STRING_CONCATENATION type=kotlin.String @@ -80,6 +94,7 @@ FILE /dataClasses.kt $this: GET_VAR '' type=Test1 origin=null CONST String type=kotlin.String value=')' FUN GENERATED_DATA_CLASS_MEMBER public open override fun hashCode(): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY VAR IR_TEMPORARY_VARIABLE var tmp0_result: kotlin.Int CONST Int type=kotlin.Int value='0' @@ -106,6 +121,8 @@ FILE /dataClasses.kt RETURN type=kotlin.Nothing from='hashCode(): Int' GET_VAR 'tmp0_result: Int' type=kotlin.Int origin=null FUN GENERATED_DATA_CLASS_MEMBER public open override fun equals(other: kotlin.Any?): kotlin.Boolean + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter other: kotlin.Any? BLOCK_BODY WHEN type=kotlin.Unit origin=null BRANCH @@ -157,6 +174,7 @@ FILE /dataClasses.kt CONST Boolean type=kotlin.Boolean value='true' CLASS CLASS Test2 CONSTRUCTOR public constructor Test2(x: kotlin.Any?) + VALUE_PARAMETER value-parameter x: kotlin.Any? BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Test2' @@ -165,24 +183,29 @@ FILE /dataClasses.kt EXPRESSION_BODY GET_VAR 'value-parameter x: Any?' type=kotlin.Any? origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Any? + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Any?' GET_FIELD 'x: Any?' type=kotlin.Any? origin=null receiver: GET_VAR '' type=Test2 origin=null FUN GENERATED_DATA_CLASS_MEMBER public final operator fun component1(): kotlin.Any? + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='component1(): Any?' CALL '(): Any?' type=kotlin.Any? origin=GET_PROPERTY $this: GET_VAR '' type=Test2 origin=null FUN GENERATED_DATA_CLASS_MEMBER public final fun copy(x: kotlin.Any? = ...): Test2 - x: EXPRESSION_BODY - CALL '(): Any?' type=kotlin.Any? origin=GET_PROPERTY - $this: GET_VAR '' type=Test2 origin=null + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter x: kotlin.Any? = ... + EXPRESSION_BODY + CALL '(): Any?' type=kotlin.Any? origin=GET_PROPERTY + $this: GET_VAR '' type=Test2 origin=null BLOCK_BODY RETURN type=kotlin.Nothing from='copy(Any? = ...): Test2' CALL 'constructor Test2(Any?)' type=Test2 origin=null x: GET_VAR 'value-parameter x: Any? = ...' type=kotlin.Any? origin=null FUN GENERATED_DATA_CLASS_MEMBER public open override fun toString(): kotlin.String + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='toString(): String' STRING_CONCATENATION type=kotlin.String @@ -192,6 +215,7 @@ FILE /dataClasses.kt $this: GET_VAR '' type=Test2 origin=null CONST String type=kotlin.String value=')' FUN GENERATED_DATA_CLASS_MEMBER public open override fun hashCode(): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY VAR IR_TEMPORARY_VARIABLE var tmp0_result: kotlin.Int CONST Int type=kotlin.Int value='0' @@ -213,6 +237,8 @@ FILE /dataClasses.kt RETURN type=kotlin.Nothing from='hashCode(): Int' GET_VAR 'tmp0_result: Int' type=kotlin.Int origin=null FUN GENERATED_DATA_CLASS_MEMBER public open override fun equals(other: kotlin.Any?): kotlin.Boolean + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter other: kotlin.Any? BLOCK_BODY WHEN type=kotlin.Unit origin=null BRANCH diff --git a/compiler/testData/ir/irText/classes/dataClassesGeneric.txt b/compiler/testData/ir/irText/classes/dataClassesGeneric.txt index a60310f757f..38ae9c9b909 100644 --- a/compiler/testData/ir/irText/classes/dataClassesGeneric.txt +++ b/compiler/testData/ir/irText/classes/dataClassesGeneric.txt @@ -1,6 +1,9 @@ FILE /dataClassesGeneric.kt CLASS CLASS Test1 + TYPE_PARAMETER CONSTRUCTOR public constructor Test1(x: T) + TYPE_PARAMETER + VALUE_PARAMETER value-parameter x: T BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Test1' @@ -9,24 +12,29 @@ FILE /dataClassesGeneric.kt EXPRESSION_BODY GET_VAR 'value-parameter x: T' type=T origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): T + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): T' GET_FIELD 'x: T' type=T origin=null receiver: GET_VAR '' type=Test1 origin=null FUN GENERATED_DATA_CLASS_MEMBER public final operator fun component1(): T + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='component1(): T' CALL '(): T' type=T origin=GET_PROPERTY $this: GET_VAR '' type=Test1 origin=null FUN GENERATED_DATA_CLASS_MEMBER public final fun copy(x: T = ...): Test1 - x: EXPRESSION_BODY - CALL '(): T' type=T origin=GET_PROPERTY - $this: GET_VAR '' type=Test1 origin=null + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter x: T = ... + EXPRESSION_BODY + CALL '(): T' type=T origin=GET_PROPERTY + $this: GET_VAR '' type=Test1 origin=null BLOCK_BODY RETURN type=kotlin.Nothing from='copy(T = ...): Test1' CALL 'constructor Test1(T)' type=Test1 origin=null x: GET_VAR 'value-parameter x: T = ...' type=T origin=null FUN GENERATED_DATA_CLASS_MEMBER public open override fun toString(): kotlin.String + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='toString(): String' STRING_CONCATENATION type=kotlin.String @@ -36,6 +44,7 @@ FILE /dataClassesGeneric.kt $this: GET_VAR '' type=Test1 origin=null CONST String type=kotlin.String value=')' FUN GENERATED_DATA_CLASS_MEMBER public open override fun hashCode(): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY VAR IR_TEMPORARY_VARIABLE var tmp0_result: kotlin.Int CONST Int type=kotlin.Int value='0' @@ -58,6 +67,8 @@ FILE /dataClassesGeneric.kt RETURN type=kotlin.Nothing from='hashCode(): Int' GET_VAR 'tmp0_result: Int' type=kotlin.Int origin=null FUN GENERATED_DATA_CLASS_MEMBER public open override fun equals(other: kotlin.Any?): kotlin.Boolean + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter other: kotlin.Any? BLOCK_BODY WHEN type=kotlin.Unit origin=null BRANCH diff --git a/compiler/testData/ir/irText/classes/delegatedImplementation.txt b/compiler/testData/ir/irText/classes/delegatedImplementation.txt index 499c3471eca..8953453b950 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementation.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementation.txt @@ -1,57 +1,82 @@ FILE /delegatedImplementation.kt CLASS INTERFACE IBase FUN public abstract fun foo(x: kotlin.Int, s: kotlin.String): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter x: kotlin.Int + VALUE_PARAMETER value-parameter s: kotlin.String FUN public abstract fun bar(): kotlin.Int + $this: VALUE_PARAMETER FUN public abstract fun kotlin.String.qux(): kotlin.Unit + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER CLASS OBJECT BaseImpl CONSTRUCTOR private constructor BaseImpl() BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='BaseImpl' FUN public open override fun foo(x: kotlin.Int, s: kotlin.String): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter x: kotlin.Int + VALUE_PARAMETER value-parameter s: kotlin.String BLOCK_BODY FUN public open override fun bar(): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='bar(): Int' CONST Int type=kotlin.Int value='42' FUN public open override fun kotlin.String.qux(): kotlin.Unit + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER BLOCK_BODY CLASS INTERFACE IOther PROPERTY public abstract val x: kotlin.String FUN DEFAULT_PROPERTY_ACCESSOR public abstract fun (): kotlin.String + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): String' GET_FIELD 'x: String' type=kotlin.String origin=null receiver: GET_VAR '' type=IOther origin=null PROPERTY public abstract var y: kotlin.Int FUN DEFAULT_PROPERTY_ACCESSOR public abstract fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'y: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=IOther origin=null FUN DEFAULT_PROPERTY_ACCESSOR public abstract fun (: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter : kotlin.Int BLOCK_BODY SET_FIELD 'y: Int' type=kotlin.Unit origin=null receiver: GET_VAR '' type=IOther origin=null value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null PROPERTY public abstract val kotlin.Byte.z1: kotlin.Int FUN DEFAULT_PROPERTY_ACCESSOR public abstract fun kotlin.Byte.(): kotlin.Int + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='() on Byte: Int' GET_FIELD 'z1: Int on Byte' type=kotlin.Int origin=null receiver: GET_VAR '' type=IOther origin=null PROPERTY public abstract var kotlin.Byte.z2: kotlin.Int FUN DEFAULT_PROPERTY_ACCESSOR public abstract fun kotlin.Byte.(): kotlin.Int + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='() on Byte: Int' GET_FIELD 'z2: Int on Byte' type=kotlin.Int origin=null receiver: GET_VAR '' type=IOther origin=null FUN DEFAULT_PROPERTY_ACCESSOR public abstract fun kotlin.Byte.(: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter : kotlin.Int BLOCK_BODY SET_FIELD 'z2: Int on Byte' type=kotlin.Unit origin=null receiver: GET_VAR '' type=IOther origin=null value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null FUN public fun otherImpl(x0: kotlin.String, y0: kotlin.Int): IOther + VALUE_PARAMETER value-parameter x0: kotlin.String + VALUE_PARAMETER value-parameter y0: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='otherImpl(String, Int): IOther' BLOCK type=otherImpl. origin=OBJECT_LITERAL @@ -65,6 +90,7 @@ FILE /delegatedImplementation.kt EXPRESSION_BODY GET_VAR 'value-parameter x0: String' type=kotlin.String origin=null FUN DEFAULT_PROPERTY_ACCESSOR public open override fun (): kotlin.String + $this: VALUE_PARAMETER > BLOCK_BODY RETURN type=kotlin.Nothing from='(): String' GET_FIELD 'x: String' type=kotlin.String origin=null @@ -74,26 +100,36 @@ FILE /delegatedImplementation.kt EXPRESSION_BODY GET_VAR 'value-parameter y0: Int' type=kotlin.Int origin=null FUN DEFAULT_PROPERTY_ACCESSOR public open override fun (): kotlin.Int + $this: VALUE_PARAMETER > BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'y: Int' type=kotlin.Int origin=null receiver: GET_VAR '>' type=otherImpl. origin=null FUN DEFAULT_PROPERTY_ACCESSOR public open override fun (: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER > + VALUE_PARAMETER value-parameter : kotlin.Int BLOCK_BODY SET_FIELD 'y: Int' type=kotlin.Unit origin=null receiver: GET_VAR '>' type=otherImpl. origin=null value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null PROPERTY public open override val kotlin.Byte.z1: kotlin.Int FUN public open override fun kotlin.Byte.(): kotlin.Int + $this: VALUE_PARAMETER > + $receiver: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='() on Byte: Int' CONST Int type=kotlin.Int value='1' PROPERTY public open override var kotlin.Byte.z2: kotlin.Int FUN public open override fun kotlin.Byte.(): kotlin.Int + $this: VALUE_PARAMETER > + $receiver: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='() on Byte: Int' CONST Int type=kotlin.Int value='2' FUN public open override fun kotlin.Byte.(value: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER > + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter value: kotlin.Int BLOCK_BODY CALL 'constructor ()' type=otherImpl. origin=OBJECT_LITERAL CLASS CLASS Test1 @@ -105,12 +141,16 @@ FILE /delegatedImplementation.kt EXPRESSION_BODY GET_OBJECT 'BaseImpl' type=BaseImpl FUN DELEGATED_MEMBER public open override fun bar(): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='bar(): Int' CALL 'bar(): Int' type=kotlin.Int origin=null $this: GET_FIELD '`Test1$IBase$delegate`: BaseImpl' type=BaseImpl origin=null receiver: GET_VAR '' type=Test1 origin=null FUN DELEGATED_MEMBER public open override fun foo(x: kotlin.Int, s: kotlin.String): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter x: kotlin.Int + VALUE_PARAMETER value-parameter s: kotlin.String BLOCK_BODY CALL 'foo(Int, String): Unit' type=kotlin.Unit origin=null $this: GET_FIELD '`Test1$IBase$delegate`: BaseImpl' type=BaseImpl origin=null @@ -118,6 +158,8 @@ FILE /delegatedImplementation.kt x: GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=null s: GET_VAR 'value-parameter s: String' type=kotlin.String origin=null FUN DELEGATED_MEMBER public open override fun kotlin.String.qux(): kotlin.Unit + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER BLOCK_BODY CALL 'qux() on String: Unit' type=kotlin.Unit origin=null $this: GET_FIELD '`Test1$IBase$delegate`: BaseImpl' type=BaseImpl origin=null @@ -132,12 +174,16 @@ FILE /delegatedImplementation.kt EXPRESSION_BODY GET_OBJECT 'BaseImpl' type=BaseImpl FUN DELEGATED_MEMBER public open override fun bar(): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='bar(): Int' CALL 'bar(): Int' type=kotlin.Int origin=null $this: GET_FIELD '`Test2$IBase$delegate`: BaseImpl' type=BaseImpl origin=null receiver: GET_VAR '' type=Test2 origin=null FUN DELEGATED_MEMBER public open override fun foo(x: kotlin.Int, s: kotlin.String): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter x: kotlin.Int + VALUE_PARAMETER value-parameter s: kotlin.String BLOCK_BODY CALL 'foo(Int, String): Unit' type=kotlin.Unit origin=null $this: GET_FIELD '`Test2$IBase$delegate`: BaseImpl' type=BaseImpl origin=null @@ -145,6 +191,8 @@ FILE /delegatedImplementation.kt x: GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=null s: GET_VAR 'value-parameter s: String' type=kotlin.String origin=null FUN DELEGATED_MEMBER public open override fun kotlin.String.qux(): kotlin.Unit + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER BLOCK_BODY CALL 'qux() on String: Unit' type=kotlin.Unit origin=null $this: GET_FIELD '`Test2$IBase$delegate`: BaseImpl' type=BaseImpl origin=null @@ -157,6 +205,8 @@ FILE /delegatedImplementation.kt y0: CONST Int type=kotlin.Int value='42' PROPERTY DELEGATED_MEMBER public open override val kotlin.Byte.z1: kotlin.Int FUN DELEGATED_MEMBER public open override fun kotlin.Byte.(): kotlin.Int + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='() on Byte: Int' CALL '() on Byte: Int' type=kotlin.Int origin=null @@ -165,6 +215,7 @@ FILE /delegatedImplementation.kt $receiver: GET_VAR '' type=kotlin.Byte origin=null PROPERTY DELEGATED_MEMBER public open override val x: kotlin.String FUN DELEGATED_MEMBER public open override fun (): kotlin.String + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): String' CALL '(): String' type=kotlin.String origin=null @@ -172,6 +223,8 @@ FILE /delegatedImplementation.kt receiver: GET_VAR '' type=Test2 origin=null PROPERTY DELEGATED_MEMBER public open override var kotlin.Byte.z2: kotlin.Int FUN DELEGATED_MEMBER public open override fun kotlin.Byte.(): kotlin.Int + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='() on Byte: Int' CALL '() on Byte: Int' type=kotlin.Int origin=null @@ -179,6 +232,9 @@ FILE /delegatedImplementation.kt receiver: GET_VAR '' type=Test2 origin=null $receiver: GET_VAR '' type=kotlin.Byte origin=null FUN DELEGATED_MEMBER public open override fun kotlin.Byte.(: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter : kotlin.Int BLOCK_BODY CALL '(Int) on Byte: Unit' type=kotlin.Unit origin=null $this: GET_FIELD '`Test2$IOther$delegate`: IOther' type=IOther origin=null @@ -187,12 +243,15 @@ FILE /delegatedImplementation.kt : GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null PROPERTY DELEGATED_MEMBER public open override var y: kotlin.Int FUN DELEGATED_MEMBER public open override fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CALL '(): Int' type=kotlin.Int origin=null $this: GET_FIELD '`Test2$IOther$delegate`: IOther' type=IOther origin=null receiver: GET_VAR '' type=Test2 origin=null FUN DELEGATED_MEMBER public open override fun (: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter : kotlin.Int BLOCK_BODY CALL '(Int): Unit' type=kotlin.Unit origin=null $this: GET_FIELD '`Test2$IOther$delegate`: IOther' type=IOther origin=null diff --git a/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.txt b/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.txt index b59b3363b9d..b8a52465941 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.txt @@ -1,15 +1,19 @@ FILE /delegatedImplementationWithExplicitOverride.kt CLASS INTERFACE IFooBar FUN public abstract fun foo(): kotlin.Unit + $this: VALUE_PARAMETER FUN public abstract fun bar(): kotlin.Unit + $this: VALUE_PARAMETER CLASS OBJECT FooBarImpl CONSTRUCTOR private constructor FooBarImpl() BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='FooBarImpl' FUN public open override fun foo(): kotlin.Unit + $this: VALUE_PARAMETER BLOCK_BODY FUN public open override fun bar(): kotlin.Unit + $this: VALUE_PARAMETER BLOCK_BODY CLASS CLASS C CONSTRUCTOR public constructor C() @@ -20,9 +24,11 @@ FILE /delegatedImplementationWithExplicitOverride.kt EXPRESSION_BODY GET_OBJECT 'FooBarImpl' type=FooBarImpl FUN DELEGATED_MEMBER public open override fun foo(): kotlin.Unit + $this: VALUE_PARAMETER BLOCK_BODY CALL 'foo(): Unit' type=kotlin.Unit origin=null $this: GET_FIELD '`C$IFooBar$delegate`: FooBarImpl' type=FooBarImpl origin=null receiver: GET_VAR '' type=C origin=null FUN public open override fun bar(): kotlin.Unit + $this: VALUE_PARAMETER BLOCK_BODY diff --git a/compiler/testData/ir/irText/classes/delegatingConstructorCallToTypeAliasConstructor.txt b/compiler/testData/ir/irText/classes/delegatingConstructorCallToTypeAliasConstructor.txt index 7ea372e4e66..893e9b06b6b 100644 --- a/compiler/testData/ir/irText/classes/delegatingConstructorCallToTypeAliasConstructor.txt +++ b/compiler/testData/ir/irText/classes/delegatingConstructorCallToTypeAliasConstructor.txt @@ -1,6 +1,9 @@ FILE /delegatingConstructorCallToTypeAliasConstructor.kt CLASS CLASS Cell + TYPE_PARAMETER CONSTRUCTOR public constructor Cell(value: T) + TYPE_PARAMETER + VALUE_PARAMETER value-parameter value: T BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Cell' @@ -9,6 +12,7 @@ FILE /delegatingConstructorCallToTypeAliasConstructor.kt EXPRESSION_BODY GET_VAR 'value-parameter value: T' type=T origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): T + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): T' GET_FIELD 'value: T' type=T origin=null diff --git a/compiler/testData/ir/irText/classes/delegatingConstructorCallsInSecondaryConstructors.txt b/compiler/testData/ir/irText/classes/delegatingConstructorCallsInSecondaryConstructors.txt index 696f8d72a14..09668a09ba1 100644 --- a/compiler/testData/ir/irText/classes/delegatingConstructorCallsInSecondaryConstructors.txt +++ b/compiler/testData/ir/irText/classes/delegatingConstructorCallsInSecondaryConstructors.txt @@ -10,9 +10,11 @@ FILE /delegatingConstructorCallsInSecondaryConstructors.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Base()' INSTANCE_INITIALIZER_CALL classDescriptor='Test' CONSTRUCTOR public constructor Test(xx: kotlin.Int) + VALUE_PARAMETER value-parameter xx: kotlin.Int BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Base()' INSTANCE_INITIALIZER_CALL classDescriptor='Test' CONSTRUCTOR public constructor Test(xx: kotlin.Short) + VALUE_PARAMETER value-parameter xx: kotlin.Short BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Test()' diff --git a/compiler/testData/ir/irText/classes/enum.txt b/compiler/testData/ir/irText/classes/enum.txt index 652b889c98d..cf9c6be64ee 100644 --- a/compiler/testData/ir/irText/classes/enum.txt +++ b/compiler/testData/ir/irText/classes/enum.txt @@ -14,6 +14,7 @@ FILE /enum.kt SYNTHETIC_BODY kind=ENUM_VALUEOF CLASS ENUM_CLASS TestEnum2 CONSTRUCTOR private constructor TestEnum2(x: kotlin.Int) + VALUE_PARAMETER value-parameter x: kotlin.Int BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'constructor Enum(String, Int)' INSTANCE_INITIALIZER_CALL classDescriptor='TestEnum2' @@ -22,6 +23,7 @@ FILE /enum.kt EXPRESSION_BODY GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null @@ -52,16 +54,19 @@ FILE /enum.kt ENUM_CONSTRUCTOR_CALL 'constructor TestEnum3()' INSTANCE_INITIALIZER_CALL classDescriptor='TEST' FUN public open override fun foo(): kotlin.Unit + $this: VALUE_PARAMETER BLOCK_BODY CALL 'println(Any?): Unit' type=kotlin.Unit origin=null message: CONST String type=kotlin.String value='Hello, world!' FUN public abstract fun foo(): kotlin.Unit + $this: VALUE_PARAMETER FUN ENUM_CLASS_SPECIAL_MEMBER public final fun values(): kotlin.Array SYNTHETIC_BODY kind=ENUM_VALUES FUN ENUM_CLASS_SPECIAL_MEMBER public final fun valueOf(value: kotlin.String): TestEnum3 SYNTHETIC_BODY kind=ENUM_VALUEOF CLASS ENUM_CLASS TestEnum4 CONSTRUCTOR private constructor TestEnum4(x: kotlin.Int) + VALUE_PARAMETER value-parameter x: kotlin.Int BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'constructor Enum(String, Int)' INSTANCE_INITIALIZER_CALL classDescriptor='TestEnum4' @@ -70,6 +75,7 @@ FILE /enum.kt EXPRESSION_BODY GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null @@ -83,6 +89,7 @@ FILE /enum.kt x: CONST Int type=kotlin.Int value='1' INSTANCE_INITIALIZER_CALL classDescriptor='TEST1' FUN public open override fun foo(): kotlin.Unit + $this: VALUE_PARAMETER BLOCK_BODY CALL 'println(Any?): Unit' type=kotlin.Unit origin=null message: GET_ENUM 'TEST1' type=TestEnum4 @@ -97,6 +104,7 @@ FILE /enum.kt PROPERTY public final val z: kotlin.Int FIELD PROPERTY_BACKING_FIELD public final val z: kotlin.Int FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'z: Int' type=kotlin.Int origin=null @@ -108,18 +116,21 @@ FILE /enum.kt value: CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY $this: GET_VAR '' type=TestEnum4.TEST2 origin=null FUN public open override fun foo(): kotlin.Unit + $this: VALUE_PARAMETER BLOCK_BODY CALL 'println(Any?): Unit' type=kotlin.Unit origin=null message: GET_ENUM 'TEST2' type=TestEnum4 FUN public abstract fun foo(): kotlin.Unit + $this: VALUE_PARAMETER FUN ENUM_CLASS_SPECIAL_MEMBER public final fun values(): kotlin.Array SYNTHETIC_BODY kind=ENUM_VALUES FUN ENUM_CLASS_SPECIAL_MEMBER public final fun valueOf(value: kotlin.String): TestEnum4 SYNTHETIC_BODY kind=ENUM_VALUEOF CLASS ENUM_CLASS TestEnum5 CONSTRUCTOR private constructor TestEnum5(x: kotlin.Int = ...) - x: EXPRESSION_BODY - CONST Int type=kotlin.Int value='0' + VALUE_PARAMETER value-parameter x: kotlin.Int = ... + EXPRESSION_BODY + CONST Int type=kotlin.Int value='0' BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'constructor Enum(String, Int)' INSTANCE_INITIALIZER_CALL classDescriptor='TestEnum5' @@ -128,6 +139,7 @@ FILE /enum.kt EXPRESSION_BODY GET_VAR 'value-parameter x: Int = ...' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.txt b/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.txt index 2fc22922102..b9b5f12c042 100644 --- a/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.txt +++ b/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.txt @@ -1,6 +1,7 @@ FILE /enumWithSecondaryCtor.kt CLASS ENUM_CLASS Test0 CONSTRUCTOR private constructor Test0(x: kotlin.Int) + VALUE_PARAMETER value-parameter x: kotlin.Int BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'constructor Enum(String, Int)' INSTANCE_INITIALIZER_CALL classDescriptor='Test0' @@ -9,6 +10,7 @@ FILE /enumWithSecondaryCtor.kt EXPRESSION_BODY GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null @@ -25,6 +27,7 @@ FILE /enumWithSecondaryCtor.kt SYNTHETIC_BODY kind=ENUM_VALUEOF CLASS ENUM_CLASS Test1 CONSTRUCTOR private constructor Test1(x: kotlin.Int) + VALUE_PARAMETER value-parameter x: kotlin.Int BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'constructor Enum(String, Int)' INSTANCE_INITIALIZER_CALL classDescriptor='Test1' @@ -33,6 +36,7 @@ FILE /enumWithSecondaryCtor.kt EXPRESSION_BODY GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null @@ -52,6 +56,7 @@ FILE /enumWithSecondaryCtor.kt SYNTHETIC_BODY kind=ENUM_VALUEOF CLASS ENUM_CLASS Test2 CONSTRUCTOR private constructor Test2(x: kotlin.Int) + VALUE_PARAMETER value-parameter x: kotlin.Int BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'constructor Enum(String, Int)' INSTANCE_INITIALIZER_CALL classDescriptor='Test2' @@ -60,6 +65,7 @@ FILE /enumWithSecondaryCtor.kt EXPRESSION_BODY GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null @@ -72,6 +78,7 @@ FILE /enumWithSecondaryCtor.kt ENUM_CONSTRUCTOR_CALL 'constructor Test2()' INSTANCE_INITIALIZER_CALL classDescriptor='ZERO' FUN public open override fun foo(): kotlin.Unit + $this: VALUE_PARAMETER BLOCK_BODY CALL 'println(Any?): Unit' type=kotlin.Unit origin=null message: CONST String type=kotlin.String value='ZERO' @@ -84,6 +91,7 @@ FILE /enumWithSecondaryCtor.kt x: CONST Int type=kotlin.Int value='1' INSTANCE_INITIALIZER_CALL classDescriptor='ONE' FUN public open override fun foo(): kotlin.Unit + $this: VALUE_PARAMETER BLOCK_BODY CALL 'println(Any?): Unit' type=kotlin.Unit origin=null message: CONST String type=kotlin.String value='ONE' @@ -92,6 +100,7 @@ FILE /enumWithSecondaryCtor.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Test2(Int)' x: CONST Int type=kotlin.Int value='0' FUN public abstract fun foo(): kotlin.Unit + $this: VALUE_PARAMETER FUN ENUM_CLASS_SPECIAL_MEMBER public final fun values(): kotlin.Array SYNTHETIC_BODY kind=ENUM_VALUES FUN ENUM_CLASS_SPECIAL_MEMBER public final fun valueOf(value: kotlin.String): Test2 diff --git a/compiler/testData/ir/irText/classes/initBlock.txt b/compiler/testData/ir/irText/classes/initBlock.txt index bcc7d21f30d..7de3b725a75 100644 --- a/compiler/testData/ir/irText/classes/initBlock.txt +++ b/compiler/testData/ir/irText/classes/initBlock.txt @@ -9,6 +9,7 @@ FILE /initBlock.kt CALL 'println(): Unit' type=kotlin.Unit origin=null CLASS CLASS Test2 CONSTRUCTOR public constructor Test2(x: kotlin.Int) + VALUE_PARAMETER value-parameter x: kotlin.Int BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Test2' @@ -17,6 +18,7 @@ FILE /initBlock.kt EXPRESSION_BODY GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null @@ -56,6 +58,7 @@ FILE /initBlock.kt message: CONST String type=kotlin.String value='1' CLASS CLASS TestInner CONSTRUCTOR public constructor TestInner() + $this: VALUE_PARAMETER BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='TestInner' diff --git a/compiler/testData/ir/irText/classes/initVal.txt b/compiler/testData/ir/irText/classes/initVal.txt index a564f5bffba..d517d758b95 100644 --- a/compiler/testData/ir/irText/classes/initVal.txt +++ b/compiler/testData/ir/irText/classes/initVal.txt @@ -1,6 +1,7 @@ FILE /initVal.kt CLASS CLASS TestInitValFromParameter CONSTRUCTOR public constructor TestInitValFromParameter(x: kotlin.Int) + VALUE_PARAMETER value-parameter x: kotlin.Int BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='TestInitValFromParameter' @@ -9,6 +10,7 @@ FILE /initVal.kt EXPRESSION_BODY GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null @@ -23,6 +25,7 @@ FILE /initVal.kt EXPRESSION_BODY CONST Int type=kotlin.Int value='0' FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null @@ -35,6 +38,7 @@ FILE /initVal.kt PROPERTY public final val x: kotlin.Int FIELD PROPERTY_BACKING_FIELD public final val x: kotlin.Int FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/classes/initVar.txt b/compiler/testData/ir/irText/classes/initVar.txt index 40c7d6b1e4e..aef6b37cec1 100644 --- a/compiler/testData/ir/irText/classes/initVar.txt +++ b/compiler/testData/ir/irText/classes/initVar.txt @@ -1,6 +1,7 @@ FILE /initVar.kt CLASS CLASS TestInitVarFromParameter CONSTRUCTOR public constructor TestInitVarFromParameter(x: kotlin.Int) + VALUE_PARAMETER value-parameter x: kotlin.Int BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='TestInitVarFromParameter' @@ -9,11 +10,14 @@ FILE /initVar.kt EXPRESSION_BODY GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=TestInitVarFromParameter origin=null FUN DEFAULT_PROPERTY_ACCESSOR public final fun (: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter : kotlin.Int BLOCK_BODY SET_FIELD 'x: Int' type=kotlin.Unit origin=null receiver: GET_VAR '' type=TestInitVarFromParameter origin=null @@ -28,11 +32,14 @@ FILE /initVar.kt EXPRESSION_BODY CONST Int type=kotlin.Int value='0' FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=TestInitVarInClass origin=null FUN DEFAULT_PROPERTY_ACCESSOR public final fun (: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter : kotlin.Int BLOCK_BODY SET_FIELD 'x: Int' type=kotlin.Unit origin=null receiver: GET_VAR '' type=TestInitVarInClass origin=null @@ -45,11 +52,14 @@ FILE /initVar.kt PROPERTY public final var x: kotlin.Int FIELD PROPERTY_BACKING_FIELD public final var x: kotlin.Int FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=TestInitVarInInitBlock origin=null FUN DEFAULT_PROPERTY_ACCESSOR public final fun (: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter : kotlin.Int BLOCK_BODY SET_FIELD 'x: Int' type=kotlin.Unit origin=null receiver: GET_VAR '' type=TestInitVarInInitBlock origin=null @@ -69,11 +79,14 @@ FILE /initVar.kt EXPRESSION_BODY CONST Int type=kotlin.Int value='0' FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=TestInitVarWithCustomSetter origin=null FUN public final fun (value: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter value: kotlin.Int BLOCK_BODY SET_FIELD 'x: Int' type=kotlin.Unit origin=EQ receiver: GET_VAR '' type=TestInitVarWithCustomSetter origin=null @@ -82,11 +95,14 @@ FILE /initVar.kt PROPERTY public final var x: kotlin.Int FIELD PROPERTY_BACKING_FIELD public final var x: kotlin.Int FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=TestInitVarWithCustomSetterWithExplicitCtor origin=null FUN public final fun (value: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter value: kotlin.Int BLOCK_BODY SET_FIELD 'x: Int' type=kotlin.Unit origin=EQ receiver: GET_VAR '' type=TestInitVarWithCustomSetterWithExplicitCtor origin=null @@ -104,11 +120,14 @@ FILE /initVar.kt PROPERTY public final var x: kotlin.Int FIELD PROPERTY_BACKING_FIELD public final var x: kotlin.Int FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=TestInitVarWithCustomSetterInCtor origin=null FUN public final fun (value: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter value: kotlin.Int BLOCK_BODY SET_FIELD 'x: Int' type=kotlin.Unit origin=EQ receiver: GET_VAR '' type=TestInitVarWithCustomSetterInCtor origin=null diff --git a/compiler/testData/ir/irText/classes/innerClass.txt b/compiler/testData/ir/irText/classes/innerClass.txt index 2cdb5b8e8cf..4b80d121fef 100644 --- a/compiler/testData/ir/irText/classes/innerClass.txt +++ b/compiler/testData/ir/irText/classes/innerClass.txt @@ -6,11 +6,13 @@ FILE /innerClass.kt INSTANCE_INITIALIZER_CALL classDescriptor='Outer' CLASS CLASS TestInnerClass CONSTRUCTOR public constructor TestInnerClass() + $this: VALUE_PARAMETER BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='TestInnerClass' CLASS CLASS DerivedInnerClass CONSTRUCTOR public constructor DerivedInnerClass() + $this: VALUE_PARAMETER BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor TestInnerClass()' $this: GET_VAR '' type=Outer origin=null diff --git a/compiler/testData/ir/irText/classes/innerClassWithDelegatingConstructor.txt b/compiler/testData/ir/irText/classes/innerClassWithDelegatingConstructor.txt index 35bf2200b7a..5d1186d4dde 100644 --- a/compiler/testData/ir/irText/classes/innerClassWithDelegatingConstructor.txt +++ b/compiler/testData/ir/irText/classes/innerClassWithDelegatingConstructor.txt @@ -6,6 +6,8 @@ FILE /innerClassWithDelegatingConstructor.kt INSTANCE_INITIALIZER_CALL classDescriptor='Outer' CLASS CLASS Inner CONSTRUCTOR public constructor Inner(x: kotlin.Int) + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter x: kotlin.Int BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Inner' @@ -14,11 +16,13 @@ FILE /innerClassWithDelegatingConstructor.kt EXPRESSION_BODY GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=Outer.Inner origin=null CONSTRUCTOR public constructor Inner() + $this: VALUE_PARAMETER BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Inner(Int)' $this: GET_VAR '' type=Outer origin=null diff --git a/compiler/testData/ir/irText/classes/localClasses.txt b/compiler/testData/ir/irText/classes/localClasses.txt index 6a5215a3c03..3c9416b58f2 100644 --- a/compiler/testData/ir/irText/classes/localClasses.txt +++ b/compiler/testData/ir/irText/classes/localClasses.txt @@ -7,6 +7,7 @@ FILE /localClasses.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='LocalClass' FUN public final fun foo(): kotlin.Unit + $this: VALUE_PARAMETER BLOCK_BODY CALL 'foo(): Unit' type=kotlin.Unit origin=null $this: CALL 'constructor LocalClass()' type=outer.LocalClass origin=null diff --git a/compiler/testData/ir/irText/classes/objectLiteralExpressions.txt b/compiler/testData/ir/irText/classes/objectLiteralExpressions.txt index a843d268248..d37ca8448a6 100644 --- a/compiler/testData/ir/irText/classes/objectLiteralExpressions.txt +++ b/compiler/testData/ir/irText/classes/objectLiteralExpressions.txt @@ -1,6 +1,7 @@ FILE /objectLiteralExpressions.kt CLASS INTERFACE IFoo FUN public abstract fun foo(): kotlin.Unit + $this: VALUE_PARAMETER PROPERTY public val test1: kotlin.Any FIELD PROPERTY_BACKING_FIELD public val test1: kotlin.Any EXPRESSION_BODY @@ -25,6 +26,7 @@ FILE /objectLiteralExpressions.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='' FUN public open override fun foo(): kotlin.Unit + $this: VALUE_PARAMETER > BLOCK_BODY CALL 'println(Any?): Unit' type=kotlin.Unit origin=null message: CONST String type=kotlin.String value='foo' @@ -40,10 +42,12 @@ FILE /objectLiteralExpressions.kt INSTANCE_INITIALIZER_CALL classDescriptor='Outer' CLASS CLASS Inner CONSTRUCTOR public constructor Inner() + $this: VALUE_PARAMETER BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Inner' FUN public final fun test3(): Outer.Inner + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='test3(): Outer.Inner' BLOCK type=Outer.test3. origin=OBJECT_LITERAL @@ -54,11 +58,13 @@ FILE /objectLiteralExpressions.kt $this: GET_VAR '' type=Outer origin=null INSTANCE_INITIALIZER_CALL classDescriptor='' FUN public open override fun foo(): kotlin.Unit + $this: VALUE_PARAMETER > BLOCK_BODY CALL 'println(Any?): Unit' type=kotlin.Unit origin=null message: CONST String type=kotlin.String value='foo' CALL 'constructor ()' type=Outer.test3. origin=OBJECT_LITERAL FUN public fun Outer.test4(): Outer.Inner + $receiver: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='test4() on Outer: Outer.Inner' BLOCK type=test4. origin=OBJECT_LITERAL @@ -69,6 +75,7 @@ FILE /objectLiteralExpressions.kt $this: GET_VAR '' type=Outer origin=null INSTANCE_INITIALIZER_CALL classDescriptor='' FUN public open override fun foo(): kotlin.Unit + $this: VALUE_PARAMETER > BLOCK_BODY CALL 'println(Any?): Unit' type=kotlin.Unit origin=null message: CONST String type=kotlin.String value='foo' diff --git a/compiler/testData/ir/irText/classes/objectWithInitializers.txt b/compiler/testData/ir/irText/classes/objectWithInitializers.txt index 64f5a1c8b88..0d2ab6f8480 100644 --- a/compiler/testData/ir/irText/classes/objectWithInitializers.txt +++ b/compiler/testData/ir/irText/classes/objectWithInitializers.txt @@ -14,6 +14,7 @@ FILE /objectWithInitializers.kt EXPRESSION_BODY CONST Int type=kotlin.Int value='1' FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null @@ -21,6 +22,7 @@ FILE /objectWithInitializers.kt PROPERTY public final val y: kotlin.Int FIELD PROPERTY_BACKING_FIELD public final val y: kotlin.Int FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'y: Int' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/classes/outerClassAccess.txt b/compiler/testData/ir/irText/classes/outerClassAccess.txt index 04baa86dd57..8b3757e7db4 100644 --- a/compiler/testData/ir/irText/classes/outerClassAccess.txt +++ b/compiler/testData/ir/irText/classes/outerClassAccess.txt @@ -5,28 +5,35 @@ FILE /outerClassAccess.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Outer' FUN public final fun foo(): kotlin.Unit + $this: VALUE_PARAMETER BLOCK_BODY CLASS CLASS Inner CONSTRUCTOR public constructor Inner() + $this: VALUE_PARAMETER BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Inner' FUN public final fun test(): kotlin.Unit + $this: VALUE_PARAMETER BLOCK_BODY CALL 'foo(): Unit' type=kotlin.Unit origin=null $this: GET_VAR '' type=Outer origin=null CLASS CLASS Inner2 CONSTRUCTOR public constructor Inner2() + $this: VALUE_PARAMETER BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Inner2' FUN public final fun test2(): kotlin.Unit + $this: VALUE_PARAMETER BLOCK_BODY CALL 'test(): Unit' type=kotlin.Unit origin=null $this: GET_VAR '' type=Outer.Inner origin=null CALL 'foo(): Unit' type=kotlin.Unit origin=null $this: GET_VAR '' type=Outer origin=null FUN public final fun Outer.test3(): kotlin.Unit + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER BLOCK_BODY CALL 'foo(): Unit' type=kotlin.Unit origin=null $this: GET_VAR '' type=Outer origin=null diff --git a/compiler/testData/ir/irText/classes/primaryConstructor.txt b/compiler/testData/ir/irText/classes/primaryConstructor.txt index 6c00d041be0..8fa94c61c6b 100644 --- a/compiler/testData/ir/irText/classes/primaryConstructor.txt +++ b/compiler/testData/ir/irText/classes/primaryConstructor.txt @@ -1,6 +1,8 @@ FILE /primaryConstructor.kt CLASS CLASS Test1 CONSTRUCTOR public constructor Test1(x: kotlin.Int, y: kotlin.Int) + VALUE_PARAMETER value-parameter x: kotlin.Int + VALUE_PARAMETER value-parameter y: kotlin.Int BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Test1' @@ -9,6 +11,7 @@ FILE /primaryConstructor.kt EXPRESSION_BODY GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null @@ -18,12 +21,15 @@ FILE /primaryConstructor.kt EXPRESSION_BODY GET_VAR 'value-parameter y: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'y: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=Test1 origin=null CLASS CLASS Test2 CONSTRUCTOR public constructor Test2(x: kotlin.Int, y: kotlin.Int) + VALUE_PARAMETER value-parameter x: kotlin.Int + VALUE_PARAMETER value-parameter y: kotlin.Int BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Test2' @@ -32,6 +38,7 @@ FILE /primaryConstructor.kt EXPRESSION_BODY GET_VAR 'value-parameter y: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'y: Int' type=kotlin.Int origin=null @@ -41,12 +48,15 @@ FILE /primaryConstructor.kt EXPRESSION_BODY GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=null FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=Test2 origin=null CLASS CLASS Test3 CONSTRUCTOR public constructor Test3(x: kotlin.Int, y: kotlin.Int) + VALUE_PARAMETER value-parameter x: kotlin.Int + VALUE_PARAMETER value-parameter y: kotlin.Int BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Test3' @@ -55,6 +65,7 @@ FILE /primaryConstructor.kt EXPRESSION_BODY GET_VAR 'value-parameter y: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'y: Int' type=kotlin.Int origin=null @@ -62,6 +73,7 @@ FILE /primaryConstructor.kt PROPERTY public final val x: kotlin.Int FIELD PROPERTY_BACKING_FIELD public final val x: kotlin.Int FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.txt b/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.txt index f8436fe4645..e100fa8ba26 100644 --- a/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.txt +++ b/compiler/testData/ir/irText/classes/primaryConstructorWithSuperConstructorCall.txt @@ -16,6 +16,8 @@ FILE /primaryConstructorWithSuperConstructorCall.kt INSTANCE_INITIALIZER_CALL classDescriptor='TestExplicitPrimaryConstructor' CLASS CLASS TestWithDelegatingConstructor CONSTRUCTOR public constructor TestWithDelegatingConstructor(x: kotlin.Int, y: kotlin.Int) + VALUE_PARAMETER value-parameter x: kotlin.Int + VALUE_PARAMETER value-parameter y: kotlin.Int BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Base()' INSTANCE_INITIALIZER_CALL classDescriptor='TestWithDelegatingConstructor' @@ -24,6 +26,7 @@ FILE /primaryConstructorWithSuperConstructorCall.kt EXPRESSION_BODY GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null @@ -33,11 +36,13 @@ FILE /primaryConstructorWithSuperConstructorCall.kt EXPRESSION_BODY GET_VAR 'value-parameter y: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'y: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=TestWithDelegatingConstructor origin=null CONSTRUCTOR public constructor TestWithDelegatingConstructor(x: kotlin.Int) + VALUE_PARAMETER value-parameter x: kotlin.Int BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor TestWithDelegatingConstructor(Int, Int)' x: GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/classes/qualifiedSuperCalls.txt b/compiler/testData/ir/irText/classes/qualifiedSuperCalls.txt index 0383eec7856..e3e002ae0b5 100644 --- a/compiler/testData/ir/irText/classes/qualifiedSuperCalls.txt +++ b/compiler/testData/ir/irText/classes/qualifiedSuperCalls.txt @@ -1,17 +1,21 @@ FILE /qualifiedSuperCalls.kt CLASS INTERFACE ILeft FUN public open fun foo(): kotlin.Unit + $this: VALUE_PARAMETER BLOCK_BODY PROPERTY public open val bar: kotlin.Int FUN public open fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CONST Int type=kotlin.Int value='1' CLASS INTERFACE IRight FUN public open fun foo(): kotlin.Unit + $this: VALUE_PARAMETER BLOCK_BODY PROPERTY public open val bar: kotlin.Int FUN public open fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CONST Int type=kotlin.Int value='2' @@ -21,6 +25,7 @@ FILE /qualifiedSuperCalls.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='CBoth' FUN public open override fun foo(): kotlin.Unit + $this: VALUE_PARAMETER BLOCK_BODY CALL 'foo(): Unit' superQualifier=ILeft type=kotlin.Unit origin=null $this: GET_VAR '' type=CBoth origin=null @@ -28,6 +33,7 @@ FILE /qualifiedSuperCalls.kt $this: GET_VAR '' type=CBoth origin=null PROPERTY public open override val bar: kotlin.Int FUN public open override fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CALL 'plus(Int): Int' type=kotlin.Int origin=PLUS diff --git a/compiler/testData/ir/irText/classes/sealedClasses.txt b/compiler/testData/ir/irText/classes/sealedClasses.txt index d5f2f99d4c0..c708a8d1d7a 100644 --- a/compiler/testData/ir/irText/classes/sealedClasses.txt +++ b/compiler/testData/ir/irText/classes/sealedClasses.txt @@ -6,6 +6,7 @@ FILE /sealedClasses.kt INSTANCE_INITIALIZER_CALL classDescriptor='Expr' CLASS CLASS Const CONSTRUCTOR public constructor Const(number: kotlin.Double) + VALUE_PARAMETER value-parameter number: kotlin.Double BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Expr()' INSTANCE_INITIALIZER_CALL classDescriptor='Const' @@ -14,12 +15,15 @@ FILE /sealedClasses.kt EXPRESSION_BODY GET_VAR 'value-parameter number: Double' type=kotlin.Double origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Double + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Double' GET_FIELD 'number: Double' type=kotlin.Double origin=null receiver: GET_VAR '' type=Expr.Const origin=null CLASS CLASS Sum CONSTRUCTOR public constructor Sum(e1: Expr, e2: Expr) + VALUE_PARAMETER value-parameter e1: Expr + VALUE_PARAMETER value-parameter e2: Expr BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Expr()' INSTANCE_INITIALIZER_CALL classDescriptor='Sum' @@ -28,6 +32,7 @@ FILE /sealedClasses.kt EXPRESSION_BODY GET_VAR 'value-parameter e1: Expr' type=Expr origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): Expr + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Expr' GET_FIELD 'e1: Expr' type=Expr origin=null @@ -37,6 +42,7 @@ FILE /sealedClasses.kt EXPRESSION_BODY GET_VAR 'value-parameter e2: Expr' type=Expr origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): Expr + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Expr' GET_FIELD 'e2: Expr' type=Expr origin=null diff --git a/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.txt b/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.txt index c2dcf174bc6..fe7d6bbef8a 100644 --- a/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.txt +++ b/compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.txt @@ -10,6 +10,7 @@ FILE /secondaryConstructorWithInitializersFromClassBody.kt EXPRESSION_BODY CONST Int type=kotlin.Int value='0' FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null @@ -22,6 +23,7 @@ FILE /secondaryConstructorWithInitializersFromClassBody.kt PROPERTY public final val x: kotlin.Int FIELD PROPERTY_BACKING_FIELD public final val x: kotlin.Int FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null @@ -36,9 +38,11 @@ FILE /secondaryConstructorWithInitializersFromClassBody.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Base()' INSTANCE_INITIALIZER_CALL classDescriptor='TestInitBlock' CONSTRUCTOR public constructor TestInitBlock(z: kotlin.Any) + VALUE_PARAMETER value-parameter z: kotlin.Any BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Base()' INSTANCE_INITIALIZER_CALL classDescriptor='TestInitBlock' CONSTRUCTOR public constructor TestInitBlock(y: kotlin.Int) + VALUE_PARAMETER value-parameter y: kotlin.Int BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor TestInitBlock()' diff --git a/compiler/testData/ir/irText/classes/secondaryConstructors.txt b/compiler/testData/ir/irText/classes/secondaryConstructors.txt index 48c4131d851..f333781e59a 100644 --- a/compiler/testData/ir/irText/classes/secondaryConstructors.txt +++ b/compiler/testData/ir/irText/classes/secondaryConstructors.txt @@ -5,6 +5,7 @@ FILE /secondaryConstructors.kt DELEGATING_CONSTRUCTOR_CALL 'constructor C(Int)' x: CONST Int type=kotlin.Int value='0' CONSTRUCTOR public constructor C(x: kotlin.Int) + VALUE_PARAMETER value-parameter x: kotlin.Int BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='C' diff --git a/compiler/testData/ir/irText/classes/superCalls.txt b/compiler/testData/ir/irText/classes/superCalls.txt index 0053a95a1ca..0975e2d3d99 100644 --- a/compiler/testData/ir/irText/classes/superCalls.txt +++ b/compiler/testData/ir/irText/classes/superCalls.txt @@ -5,12 +5,14 @@ FILE /superCalls.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Base' FUN public open fun foo(): kotlin.Unit + $this: VALUE_PARAMETER BLOCK_BODY PROPERTY public open val bar: kotlin.String = "" FIELD PROPERTY_BACKING_FIELD public open val bar: kotlin.String = "" EXPRESSION_BODY CONST String type=kotlin.String value='' FUN DEFAULT_PROPERTY_ACCESSOR public open fun (): kotlin.String + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): String' GET_FIELD 'bar: String' type=kotlin.String origin=null @@ -21,11 +23,13 @@ FILE /superCalls.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Base()' INSTANCE_INITIALIZER_CALL classDescriptor='Derived' FUN public open override fun foo(): kotlin.Unit + $this: VALUE_PARAMETER BLOCK_BODY CALL 'foo(): Unit' superQualifier=Base type=kotlin.Unit origin=null $this: GET_VAR '' type=Derived origin=null PROPERTY public open override val bar: kotlin.String FUN public open override fun (): kotlin.String + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): String' CALL '(): String' superQualifier=Base type=kotlin.String origin=GET_PROPERTY diff --git a/compiler/testData/ir/irText/declarations/classLevelProperties.txt b/compiler/testData/ir/irText/declarations/classLevelProperties.txt index 466ac17716f..ca7f9344ec0 100644 --- a/compiler/testData/ir/irText/declarations/classLevelProperties.txt +++ b/compiler/testData/ir/irText/declarations/classLevelProperties.txt @@ -9,12 +9,14 @@ FILE /classLevelProperties.kt EXPRESSION_BODY CONST Int type=kotlin.Int value='0' FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'test1: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=C origin=null PROPERTY public final val test2: kotlin.Int FUN public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CONST Int type=kotlin.Int value='0' @@ -23,11 +25,14 @@ FILE /classLevelProperties.kt EXPRESSION_BODY CONST Int type=kotlin.Int value='0' FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'test3: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=C origin=null FUN DEFAULT_PROPERTY_ACCESSOR public final fun (: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter : kotlin.Int BLOCK_BODY SET_FIELD 'test3: Int' type=kotlin.Unit origin=null receiver: GET_VAR '' type=C origin=null @@ -37,11 +42,14 @@ FILE /classLevelProperties.kt EXPRESSION_BODY CONST Int type=kotlin.Int value='1' FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'test4: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=C origin=null FUN public final fun (value: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter value: kotlin.Int BLOCK_BODY SET_FIELD 'test4: Int' type=kotlin.Unit origin=EQ receiver: GET_VAR '' type=C origin=null @@ -51,11 +59,14 @@ FILE /classLevelProperties.kt EXPRESSION_BODY CONST Int type=kotlin.Int value='1' FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'test5: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=C origin=null FUN private final fun (: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter : kotlin.Int BLOCK_BODY SET_FIELD 'test5: Int' type=kotlin.Unit origin=null receiver: GET_VAR '' type=C origin=null @@ -65,6 +76,7 @@ FILE /classLevelProperties.kt EXPRESSION_BODY CONST Int type=kotlin.Int value='1' FUN public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'test6: Int' type=kotlin.Int origin=null @@ -81,6 +93,7 @@ FILE /classLevelProperties.kt CONST Int type=kotlin.Int value='42' CALLABLE_REFERENCE '(): Int' type=() -> kotlin.Int origin=LAMBDA FUN DELEGATED_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CALL 'getValue(Any?, KProperty<*>) on Lazy: Int' type=kotlin.Int origin=null @@ -96,6 +109,7 @@ FILE /classLevelProperties.kt : String : Int FUN DELEGATED_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CALL 'getValue(Any?, KProperty<*>) on MutableMap: Int' type=kotlin.Int origin=null @@ -105,6 +119,8 @@ FILE /classLevelProperties.kt thisRef: GET_VAR '' type=C origin=null property: CALLABLE_REFERENCE 'test8: Int' type=kotlin.reflect.KMutableProperty1 origin=PROPERTY_REFERENCE_FOR_DELEGATE FUN DELEGATED_PROPERTY_ACCESSOR public final fun (: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter : kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='(Int): Unit' CALL 'setValue(Any?, KProperty<*>, Int) on MutableMap: Unit' type=kotlin.Unit origin=null diff --git a/compiler/testData/ir/irText/declarations/defaultArguments.txt b/compiler/testData/ir/irText/declarations/defaultArguments.txt index 1263a446ecd..e04119b39ac 100644 --- a/compiler/testData/ir/irText/declarations/defaultArguments.txt +++ b/compiler/testData/ir/irText/declarations/defaultArguments.txt @@ -1,15 +1,21 @@ FILE /defaultArguments.kt FUN public fun test1(x: kotlin.Int, y: kotlin.Int = ..., z: kotlin.String = ...): kotlin.Unit - y: EXPRESSION_BODY - CONST Int type=kotlin.Int value='0' - z: EXPRESSION_BODY - CONST String type=kotlin.String value='abc' + VALUE_PARAMETER value-parameter x: kotlin.Int + VALUE_PARAMETER value-parameter y: kotlin.Int = ... + EXPRESSION_BODY + CONST Int type=kotlin.Int value='0' + VALUE_PARAMETER value-parameter z: kotlin.String = ... + EXPRESSION_BODY + CONST String type=kotlin.String value='abc' BLOCK_BODY FUN local final fun local(xx: kotlin.Int = ..., yy: kotlin.Int = ..., zz: kotlin.String = ...): kotlin.Unit - xx: EXPRESSION_BODY - GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=null - yy: EXPRESSION_BODY - GET_VAR 'value-parameter y: Int = ...' type=kotlin.Int origin=null - zz: EXPRESSION_BODY - GET_VAR 'value-parameter z: String = ...' type=kotlin.String origin=null + VALUE_PARAMETER value-parameter xx: kotlin.Int = ... + EXPRESSION_BODY + GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=null + VALUE_PARAMETER value-parameter yy: kotlin.Int = ... + EXPRESSION_BODY + GET_VAR 'value-parameter y: Int = ...' type=kotlin.Int origin=null + VALUE_PARAMETER value-parameter zz: kotlin.String = ... + EXPRESSION_BODY + GET_VAR 'value-parameter z: String = ...' type=kotlin.String origin=null BLOCK_BODY diff --git a/compiler/testData/ir/irText/declarations/delegatedProperties.txt b/compiler/testData/ir/irText/declarations/delegatedProperties.txt index 75f4c0736dc..ca32fd5176d 100644 --- a/compiler/testData/ir/irText/declarations/delegatedProperties.txt +++ b/compiler/testData/ir/irText/declarations/delegatedProperties.txt @@ -20,6 +20,7 @@ FILE /delegatedProperties.kt property: CALLABLE_REFERENCE 'test1: Int' type=kotlin.reflect.KProperty0 origin=PROPERTY_REFERENCE_FOR_DELEGATE CLASS CLASS C CONSTRUCTOR public constructor C(map: kotlin.collections.MutableMap) + VALUE_PARAMETER value-parameter map: kotlin.collections.MutableMap BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='C' @@ -28,6 +29,7 @@ FILE /delegatedProperties.kt EXPRESSION_BODY GET_VAR 'value-parameter map: MutableMap' type=kotlin.collections.MutableMap origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.collections.MutableMap + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): MutableMap' GET_FIELD 'map: MutableMap' type=kotlin.collections.MutableMap origin=null @@ -44,6 +46,7 @@ FILE /delegatedProperties.kt CONST Int type=kotlin.Int value='42' CALLABLE_REFERENCE '(): Int' type=() -> kotlin.Int origin=LAMBDA FUN DELEGATED_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CALL 'getValue(Any?, KProperty<*>) on Lazy: Int' type=kotlin.Int origin=null @@ -58,6 +61,7 @@ FILE /delegatedProperties.kt CALL '(): MutableMap' type=kotlin.collections.MutableMap origin=GET_PROPERTY $this: GET_VAR '' type=C origin=null FUN DELEGATED_PROPERTY_ACCESSOR public final fun (): kotlin.Any + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Any' CALL 'getValue(Any?, KProperty<*>) on MutableMap: Any' type=kotlin.Any origin=null @@ -67,6 +71,8 @@ FILE /delegatedProperties.kt thisRef: GET_VAR '' type=C origin=null property: CALLABLE_REFERENCE 'test3: Any' type=kotlin.reflect.KMutableProperty1 origin=PROPERTY_REFERENCE_FOR_DELEGATE FUN DELEGATED_PROPERTY_ACCESSOR public final fun (: kotlin.Any): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter : kotlin.Any BLOCK_BODY RETURN type=kotlin.Nothing from='(Any): Unit' CALL 'setValue(Any?, KProperty<*>, Any) on MutableMap: Unit' type=kotlin.Unit origin=null @@ -91,6 +97,7 @@ FILE /delegatedProperties.kt thisRef: CONST Null type=kotlin.Nothing? value='null' property: CALLABLE_REFERENCE 'test4: Any' type=kotlin.reflect.KMutableProperty0 origin=PROPERTY_REFERENCE_FOR_DELEGATE FUN DELEGATED_PROPERTY_ACCESSOR public fun (: kotlin.Any): kotlin.Unit + VALUE_PARAMETER value-parameter : kotlin.Any BLOCK_BODY RETURN type=kotlin.Nothing from='(Any): Unit' CALL 'setValue(Any?, KProperty<*>, Any) on MutableMap: Unit' type=kotlin.Unit origin=null diff --git a/compiler/testData/ir/irText/declarations/interfaceProperties.txt b/compiler/testData/ir/irText/declarations/interfaceProperties.txt index df3d162e1e8..2f2836e5aee 100644 --- a/compiler/testData/ir/irText/declarations/interfaceProperties.txt +++ b/compiler/testData/ir/irText/declarations/interfaceProperties.txt @@ -2,30 +2,38 @@ FILE /interfaceProperties.kt CLASS INTERFACE C PROPERTY public abstract val test1: kotlin.Int FUN DEFAULT_PROPERTY_ACCESSOR public abstract fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'test1: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=C origin=null PROPERTY public open val test2: kotlin.Int FUN public open fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CONST Int type=kotlin.Int value='0' PROPERTY public abstract var test3: kotlin.Int FUN DEFAULT_PROPERTY_ACCESSOR public abstract fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'test3: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=C origin=null FUN DEFAULT_PROPERTY_ACCESSOR public abstract fun (: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter : kotlin.Int BLOCK_BODY SET_FIELD 'test3: Int' type=kotlin.Unit origin=null receiver: GET_VAR '' type=C origin=null value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null PROPERTY public open var test4: kotlin.Int FUN public open fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' CONST Int type=kotlin.Int value='0' FUN public open fun (value: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter value: kotlin.Int BLOCK_BODY diff --git a/compiler/testData/ir/irText/declarations/packageLevelProperties.txt b/compiler/testData/ir/irText/declarations/packageLevelProperties.txt index 5b8cc6d7080..22fa4dc30aa 100644 --- a/compiler/testData/ir/irText/declarations/packageLevelProperties.txt +++ b/compiler/testData/ir/irText/declarations/packageLevelProperties.txt @@ -21,6 +21,7 @@ FILE /packageLevelProperties.kt RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'test3: Int' type=kotlin.Int origin=null FUN DEFAULT_PROPERTY_ACCESSOR public fun (: kotlin.Int): kotlin.Unit + VALUE_PARAMETER value-parameter : kotlin.Int BLOCK_BODY SET_FIELD 'test3: Int' type=kotlin.Unit origin=null value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null @@ -33,6 +34,7 @@ FILE /packageLevelProperties.kt RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'test4: Int' type=kotlin.Int origin=null FUN public fun (value: kotlin.Int): kotlin.Unit + VALUE_PARAMETER value-parameter value: kotlin.Int BLOCK_BODY SET_FIELD 'test4: Int' type=kotlin.Unit origin=EQ value: GET_VAR 'value-parameter value: Int' type=kotlin.Int origin=null @@ -45,6 +47,7 @@ FILE /packageLevelProperties.kt RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'test5: Int' type=kotlin.Int origin=null FUN private fun (: kotlin.Int): kotlin.Unit + VALUE_PARAMETER value-parameter : kotlin.Int BLOCK_BODY SET_FIELD 'test5: Int' type=kotlin.Unit origin=null value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null @@ -90,6 +93,7 @@ FILE /packageLevelProperties.kt thisRef: CONST Null type=kotlin.Nothing? value='null' property: CALLABLE_REFERENCE 'test8: Int' type=kotlin.reflect.KMutableProperty0 origin=PROPERTY_REFERENCE_FOR_DELEGATE FUN DELEGATED_PROPERTY_ACCESSOR public fun (: kotlin.Int): kotlin.Unit + VALUE_PARAMETER value-parameter : kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='(Int): Unit' CALL 'setValue(Any?, KProperty<*>, Int) on MutableMap: Unit' type=kotlin.Unit origin=null diff --git a/compiler/testData/ir/irText/declarations/parameters/class.kt b/compiler/testData/ir/irText/declarations/parameters/class.kt new file mode 100644 index 00000000000..ab6dcbd0976 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/class.kt @@ -0,0 +1,8 @@ +interface TestInterface { + interface TestNestedInterface +} + +class Test { + class TestNested + inner class TestInner +} \ No newline at end of file diff --git a/compiler/testData/ir/irText/declarations/parameters/class.txt b/compiler/testData/ir/irText/declarations/parameters/class.txt new file mode 100644 index 00000000000..1a18b0a4642 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/class.txt @@ -0,0 +1,27 @@ +FILE /class.kt + CLASS INTERFACE TestInterface + TYPE_PARAMETER + CLASS INTERFACE TestNestedInterface + TYPE_PARAMETER + CLASS CLASS Test + TYPE_PARAMETER + CONSTRUCTOR public constructor Test() + TYPE_PARAMETER + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + INSTANCE_INITIALIZER_CALL classDescriptor='Test' + CLASS CLASS TestNested + TYPE_PARAMETER + CONSTRUCTOR public constructor TestNested() + TYPE_PARAMETER + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + INSTANCE_INITIALIZER_CALL classDescriptor='TestNested' + CLASS CLASS TestInner + TYPE_PARAMETER + CONSTRUCTOR public constructor TestInner() + TYPE_PARAMETER + $this: VALUE_PARAMETER + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + INSTANCE_INITIALIZER_CALL classDescriptor='TestInner' diff --git a/compiler/testData/ir/irText/declarations/parameters/constructor.kt b/compiler/testData/ir/irText/declarations/parameters/constructor.kt new file mode 100644 index 00000000000..3bcfcdfc132 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/constructor.kt @@ -0,0 +1,13 @@ +class Test1(val x: T1, val y: T2) + +class Test2(x: Int, val y: String) { + inner class TestInner(val z : Z) { + constructor(z: Z, i: Int) : this(z) + } +} + +class Test3(val x: Int, val y: String = "") + +class Test4(val x: Int) { + constructor(x: Int, y: Int = 42) : this(x + y) +} \ No newline at end of file diff --git a/compiler/testData/ir/irText/declarations/parameters/constructor.txt b/compiler/testData/ir/irText/declarations/parameters/constructor.txt new file mode 100644 index 00000000000..ade3ecad840 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/constructor.txt @@ -0,0 +1,137 @@ +FILE /constructor.kt + CLASS CLASS Test1 + TYPE_PARAMETER + TYPE_PARAMETER + CONSTRUCTOR public constructor Test1(x: T1, y: T2) + TYPE_PARAMETER + TYPE_PARAMETER + VALUE_PARAMETER value-parameter x: T1 + VALUE_PARAMETER value-parameter y: T2 + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + INSTANCE_INITIALIZER_CALL classDescriptor='Test1' + PROPERTY public final val x: T1 + FIELD PROPERTY_BACKING_FIELD public final val x: T1 + EXPRESSION_BODY + GET_VAR 'value-parameter x: T1' type=T1 origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): T1 + $this: VALUE_PARAMETER + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): T1' + GET_FIELD 'x: T1' type=T1 origin=null + receiver: GET_VAR '' type=Test1 origin=null + PROPERTY public final val y: T2 + FIELD PROPERTY_BACKING_FIELD public final val y: T2 + EXPRESSION_BODY + GET_VAR 'value-parameter y: T2' type=T2 origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): T2 + $this: VALUE_PARAMETER + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): T2' + GET_FIELD 'y: T2' type=T2 origin=null + receiver: GET_VAR '' type=Test1 origin=null + CLASS CLASS Test2 + CONSTRUCTOR public constructor Test2(x: kotlin.Int, y: kotlin.String) + VALUE_PARAMETER value-parameter x: kotlin.Int + VALUE_PARAMETER value-parameter y: kotlin.String + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + INSTANCE_INITIALIZER_CALL classDescriptor='Test2' + PROPERTY public final val y: kotlin.String + FIELD PROPERTY_BACKING_FIELD public final val y: kotlin.String + EXPRESSION_BODY + GET_VAR 'value-parameter y: String' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.String + $this: VALUE_PARAMETER + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): String' + GET_FIELD 'y: String' type=kotlin.String origin=null + receiver: GET_VAR '' type=Test2 origin=null + CLASS CLASS TestInner + TYPE_PARAMETER + CONSTRUCTOR public constructor TestInner(z: Z) + TYPE_PARAMETER + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter z: Z + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + INSTANCE_INITIALIZER_CALL classDescriptor='TestInner' + PROPERTY public final val z: Z + FIELD PROPERTY_BACKING_FIELD public final val z: Z + EXPRESSION_BODY + GET_VAR 'value-parameter z: Z' type=Z origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): Z + $this: VALUE_PARAMETER + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Z' + GET_FIELD 'z: Z' type=Z origin=null + receiver: GET_VAR '' type=Test2.TestInner origin=null + CONSTRUCTOR public constructor TestInner(z: Z, i: kotlin.Int) + TYPE_PARAMETER + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter z: Z + VALUE_PARAMETER value-parameter i: kotlin.Int + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'constructor TestInner(Z)' + : Z + $this: GET_VAR '' type=Test2 origin=null + z: GET_VAR 'value-parameter z: Z' type=Z origin=null + CLASS CLASS Test3 + CONSTRUCTOR public constructor Test3(x: kotlin.Int, y: kotlin.String = ...) + VALUE_PARAMETER value-parameter x: kotlin.Int + VALUE_PARAMETER value-parameter y: kotlin.String = ... + EXPRESSION_BODY + CONST String type=kotlin.String value='' + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + INSTANCE_INITIALIZER_CALL classDescriptor='Test3' + PROPERTY public final val x: kotlin.Int + FIELD PROPERTY_BACKING_FIELD public final val x: kotlin.Int + EXPRESSION_BODY + GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_FIELD 'x: Int' type=kotlin.Int origin=null + receiver: GET_VAR '' type=Test3 origin=null + PROPERTY public final val y: kotlin.String + FIELD PROPERTY_BACKING_FIELD public final val y: kotlin.String + EXPRESSION_BODY + GET_VAR 'value-parameter y: String = ...' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.String + $this: VALUE_PARAMETER + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): String' + GET_FIELD 'y: String' type=kotlin.String origin=null + receiver: GET_VAR '' type=Test3 origin=null + CLASS CLASS Test4 + TYPE_PARAMETER + CONSTRUCTOR public constructor Test4(x: kotlin.Int) + TYPE_PARAMETER + VALUE_PARAMETER value-parameter x: kotlin.Int + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + INSTANCE_INITIALIZER_CALL classDescriptor='Test4' + PROPERTY public final val x: kotlin.Int + FIELD PROPERTY_BACKING_FIELD public final val x: kotlin.Int + EXPRESSION_BODY + GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_FIELD 'x: Int' type=kotlin.Int origin=null + receiver: GET_VAR '' type=Test4 origin=null + CONSTRUCTOR public constructor Test4(x: kotlin.Int, y: kotlin.Int = ...) + TYPE_PARAMETER + VALUE_PARAMETER value-parameter x: kotlin.Int + VALUE_PARAMETER value-parameter y: kotlin.Int = ... + EXPRESSION_BODY + CONST Int type=kotlin.Int value='42' + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'constructor Test4(Int)' + : T + x: CALL 'plus(Int): Int' type=kotlin.Int origin=PLUS + $this: GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=null + other: GET_VAR 'value-parameter y: Int = ...' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt new file mode 100644 index 00000000000..08fc7e3ab1b --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt @@ -0,0 +1 @@ +data class Test(val x: T, val y: String = "") \ No newline at end of file diff --git a/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.txt b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.txt new file mode 100644 index 00000000000..6852e979193 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.txt @@ -0,0 +1,146 @@ +FILE /dataClassMembers.kt + CLASS CLASS Test + TYPE_PARAMETER + CONSTRUCTOR public constructor Test(x: T, y: kotlin.String = ...) + TYPE_PARAMETER + VALUE_PARAMETER value-parameter x: T + VALUE_PARAMETER value-parameter y: kotlin.String = ... + EXPRESSION_BODY + CONST String type=kotlin.String value='' + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + INSTANCE_INITIALIZER_CALL classDescriptor='Test' + PROPERTY public final val x: T + FIELD PROPERTY_BACKING_FIELD public final val x: T + EXPRESSION_BODY + GET_VAR 'value-parameter x: T' type=T origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): T + $this: VALUE_PARAMETER + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): T' + GET_FIELD 'x: T' type=T origin=null + receiver: GET_VAR '' type=Test origin=null + PROPERTY public final val y: kotlin.String + FIELD PROPERTY_BACKING_FIELD public final val y: kotlin.String + EXPRESSION_BODY + GET_VAR 'value-parameter y: String = ...' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.String + $this: VALUE_PARAMETER + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): String' + GET_FIELD 'y: String' type=kotlin.String origin=null + receiver: GET_VAR '' type=Test origin=null + FUN GENERATED_DATA_CLASS_MEMBER public final operator fun component1(): T + $this: VALUE_PARAMETER + BLOCK_BODY + RETURN type=kotlin.Nothing from='component1(): T' + CALL '(): T' type=T origin=GET_PROPERTY + $this: GET_VAR '' type=Test origin=null + FUN GENERATED_DATA_CLASS_MEMBER public final operator fun component2(): kotlin.String + $this: VALUE_PARAMETER + BLOCK_BODY + RETURN type=kotlin.Nothing from='component2(): String' + CALL '(): String' type=kotlin.String origin=GET_PROPERTY + $this: GET_VAR '' type=Test origin=null + FUN GENERATED_DATA_CLASS_MEMBER public final fun copy(x: T = ..., y: kotlin.String = ...): Test + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter x: T = ... + EXPRESSION_BODY + CALL '(): T' type=T origin=GET_PROPERTY + $this: GET_VAR '' type=Test origin=null + VALUE_PARAMETER value-parameter y: kotlin.String = ... + EXPRESSION_BODY + CALL '(): String' type=kotlin.String origin=GET_PROPERTY + $this: GET_VAR '' type=Test origin=null + BLOCK_BODY + RETURN type=kotlin.Nothing from='copy(T = ..., String = ...): Test' + CALL 'constructor Test(T, String = ...)' type=Test origin=null + x: GET_VAR 'value-parameter x: T = ...' type=T origin=null + y: GET_VAR 'value-parameter y: String = ...' type=kotlin.String origin=null + FUN GENERATED_DATA_CLASS_MEMBER public open override fun toString(): kotlin.String + $this: VALUE_PARAMETER + BLOCK_BODY + RETURN type=kotlin.Nothing from='toString(): String' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value='Test(' + CONST String type=kotlin.String value='x=' + CALL '(): T' type=T origin=GET_PROPERTY + $this: GET_VAR '' type=Test origin=null + CONST String type=kotlin.String value=', ' + CONST String type=kotlin.String value='y=' + CALL '(): String' type=kotlin.String origin=GET_PROPERTY + $this: GET_VAR '' type=Test origin=null + CONST String type=kotlin.String value=')' + FUN GENERATED_DATA_CLASS_MEMBER public open override fun hashCode(): kotlin.Int + $this: VALUE_PARAMETER + BLOCK_BODY + VAR IR_TEMPORARY_VARIABLE var tmp0_result: kotlin.Int + CONST Int type=kotlin.Int value='0' + SET_VAR 'tmp0_result: Int' type=kotlin.Unit origin=EQ + BLOCK type=kotlin.Int origin=null + VAR IR_TEMPORARY_VARIABLE val tmp1: T + CALL '(): T' type=T origin=GET_PROPERTY + $this: GET_VAR '' type=Test origin=null + WHEN type=kotlin.Int origin=null + BRANCH + if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ + arg0: GET_VAR 'tmp1: T' type=T origin=null + arg1: CONST Null type=kotlin.Nothing? value='null' + then: CONST Int type=kotlin.Int value='0' + BRANCH + if: CONST Boolean type=kotlin.Boolean value='true' + then: CALL 'hashCode(): Int' type=kotlin.Int origin=null + $this: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any + GET_VAR 'tmp1: T' type=T origin=null + SET_VAR 'tmp0_result: Int' type=kotlin.Unit origin=EQ + CALL 'plus(Int): Int' type=kotlin.Int origin=null + $this: CALL 'times(Int): Int' type=kotlin.Int origin=null + $this: GET_VAR 'tmp0_result: Int' type=kotlin.Int origin=null + other: CONST Int type=kotlin.Int value='31' + other: CALL 'hashCode(): Int' type=kotlin.Int origin=null + $this: CALL '(): String' type=kotlin.String origin=GET_PROPERTY + $this: GET_VAR '' type=Test origin=null + RETURN type=kotlin.Nothing from='hashCode(): Int' + GET_VAR 'tmp0_result: Int' type=kotlin.Int origin=null + FUN GENERATED_DATA_CLASS_MEMBER public open override fun equals(other: kotlin.Any?): kotlin.Boolean + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter other: kotlin.Any? + BLOCK_BODY + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'EQEQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQEQ + arg0: GET_VAR '' type=Test origin=null + arg1: GET_VAR 'value-parameter other: Any?' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='equals(Any?): Boolean' + CONST Boolean type=kotlin.Boolean value='true' + WHEN type=kotlin.Unit origin=null + BRANCH + if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=Test + GET_VAR 'value-parameter other: Any?' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='equals(Any?): Boolean' + CONST Boolean type=kotlin.Boolean value='false' + VAR IR_TEMPORARY_VARIABLE val tmp0_other_with_cast: Test + TYPE_OP type=Test origin=CAST typeOperand=Test + GET_VAR 'value-parameter other: Any?' type=kotlin.Any? origin=null + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'NOT(Boolean): Boolean' type=kotlin.Boolean origin=EXCLEQ + arg0: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EXCLEQ + arg0: CALL '(): T' type=T origin=GET_PROPERTY + $this: GET_VAR '' type=Test origin=null + arg1: CALL '(): T' type=T origin=GET_PROPERTY + $this: GET_VAR 'tmp0_other_with_cast: Test' type=Test origin=null + then: RETURN type=kotlin.Nothing from='equals(Any?): Boolean' + CONST Boolean type=kotlin.Boolean value='false' + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'NOT(Boolean): Boolean' type=kotlin.Boolean origin=EXCLEQ + arg0: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EXCLEQ + arg0: CALL '(): String' type=kotlin.String origin=GET_PROPERTY + $this: GET_VAR '' type=Test origin=null + arg1: CALL '(): String' type=kotlin.String origin=GET_PROPERTY + $this: GET_VAR 'tmp0_other_with_cast: Test' type=Test origin=null + then: RETURN type=kotlin.Nothing from='equals(Any?): Boolean' + CONST Boolean type=kotlin.Boolean value='false' + RETURN type=kotlin.Nothing from='equals(Any?): Boolean' + CONST Boolean type=kotlin.Boolean value='true' diff --git a/compiler/testData/ir/irText/declarations/parameters/defaultPropertyAccessors.kt b/compiler/testData/ir/irText/declarations/parameters/defaultPropertyAccessors.kt new file mode 100644 index 00000000000..6c0c3111e5e --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/defaultPropertyAccessors.kt @@ -0,0 +1,14 @@ +val test1 = 42 + +var test2 = 42 + +class Host { + val testMember1 = 42 + + var testMember2 = 42 +} + +class InPrimaryCtor( + val testInPrimaryCtor1: T, + var testInPrimaryCtor2: Int = 42 +) \ No newline at end of file diff --git a/compiler/testData/ir/irText/declarations/parameters/defaultPropertyAccessors.txt b/compiler/testData/ir/irText/declarations/parameters/defaultPropertyAccessors.txt new file mode 100644 index 00000000000..fb7bf5ae7cf --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/defaultPropertyAccessors.txt @@ -0,0 +1,92 @@ +FILE /defaultPropertyAccessors.kt + PROPERTY public val test1: kotlin.Int = 42 + FIELD PROPERTY_BACKING_FIELD public val test1: kotlin.Int = 42 + EXPRESSION_BODY + CONST Int type=kotlin.Int value='42' + FUN DEFAULT_PROPERTY_ACCESSOR public fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_FIELD 'test1: Int' type=kotlin.Int origin=null + PROPERTY public var test2: kotlin.Int + FIELD PROPERTY_BACKING_FIELD public var test2: kotlin.Int + EXPRESSION_BODY + CONST Int type=kotlin.Int value='42' + FUN DEFAULT_PROPERTY_ACCESSOR public fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_FIELD 'test2: Int' type=kotlin.Int origin=null + FUN DEFAULT_PROPERTY_ACCESSOR public fun (: kotlin.Int): kotlin.Unit + VALUE_PARAMETER value-parameter : kotlin.Int + BLOCK_BODY + SET_FIELD 'test2: Int' type=kotlin.Unit origin=null + value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null + CLASS CLASS Host + CONSTRUCTOR public constructor Host() + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + INSTANCE_INITIALIZER_CALL classDescriptor='Host' + PROPERTY public final val testMember1: kotlin.Int = 42 + FIELD PROPERTY_BACKING_FIELD public final val testMember1: kotlin.Int = 42 + EXPRESSION_BODY + CONST Int type=kotlin.Int value='42' + FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_FIELD 'testMember1: Int' type=kotlin.Int origin=null + receiver: GET_VAR '' type=Host origin=null + PROPERTY public final var testMember2: kotlin.Int + FIELD PROPERTY_BACKING_FIELD public final var testMember2: kotlin.Int + EXPRESSION_BODY + CONST Int type=kotlin.Int value='42' + FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_FIELD 'testMember2: Int' type=kotlin.Int origin=null + receiver: GET_VAR '' type=Host origin=null + FUN DEFAULT_PROPERTY_ACCESSOR public final fun (: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter : kotlin.Int + BLOCK_BODY + SET_FIELD 'testMember2: Int' type=kotlin.Unit origin=null + receiver: GET_VAR '' type=Host origin=null + value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null + CLASS CLASS InPrimaryCtor + TYPE_PARAMETER + CONSTRUCTOR public constructor InPrimaryCtor(testInPrimaryCtor1: T, testInPrimaryCtor2: kotlin.Int = ...) + TYPE_PARAMETER + VALUE_PARAMETER value-parameter testInPrimaryCtor1: T + VALUE_PARAMETER value-parameter testInPrimaryCtor2: kotlin.Int = ... + EXPRESSION_BODY + CONST Int type=kotlin.Int value='42' + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + INSTANCE_INITIALIZER_CALL classDescriptor='InPrimaryCtor' + PROPERTY public final val testInPrimaryCtor1: T + FIELD PROPERTY_BACKING_FIELD public final val testInPrimaryCtor1: T + EXPRESSION_BODY + GET_VAR 'value-parameter testInPrimaryCtor1: T' type=T origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): T + $this: VALUE_PARAMETER + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): T' + GET_FIELD 'testInPrimaryCtor1: T' type=T origin=null + receiver: GET_VAR '' type=InPrimaryCtor origin=null + PROPERTY public final var testInPrimaryCtor2: kotlin.Int + FIELD PROPERTY_BACKING_FIELD public final var testInPrimaryCtor2: kotlin.Int + EXPRESSION_BODY + GET_VAR 'value-parameter testInPrimaryCtor2: Int = ...' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_FIELD 'testInPrimaryCtor2: Int' type=kotlin.Int origin=null + receiver: GET_VAR '' type=InPrimaryCtor origin=null + FUN DEFAULT_PROPERTY_ACCESSOR public final fun (: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter : kotlin.Int + BLOCK_BODY + SET_FIELD 'testInPrimaryCtor2: Int' type=kotlin.Unit origin=null + receiver: GET_VAR '' type=InPrimaryCtor origin=null + value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.kt b/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.kt new file mode 100644 index 00000000000..bf93d9971ea --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.kt @@ -0,0 +1,7 @@ +interface IBase { + fun foo(x: Int) + val bar: Int + fun qux(t: T, x: X) +} + +class Test(impl: IBase) : IBase by impl \ No newline at end of file diff --git a/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.txt b/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.txt new file mode 100644 index 00000000000..296efc71936 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.txt @@ -0,0 +1,57 @@ +FILE /delegatedMembers.kt + CLASS INTERFACE IBase + TYPE_PARAMETER + FUN public abstract fun foo(x: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter x: kotlin.Int + PROPERTY public abstract val bar: kotlin.Int + FUN DEFAULT_PROPERTY_ACCESSOR public abstract fun (): kotlin.Int + $this: VALUE_PARAMETER + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_FIELD 'bar: Int' type=kotlin.Int origin=null + receiver: GET_VAR '' type=IBase origin=null + FUN public abstract fun qux(t: T, x: X): kotlin.Unit + TYPE_PARAMETER + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter t: T + VALUE_PARAMETER value-parameter x: X + CLASS CLASS Test + TYPE_PARAMETER + CONSTRUCTOR public constructor Test(impl: IBase) + TYPE_PARAMETER + VALUE_PARAMETER value-parameter impl: IBase + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + INSTANCE_INITIALIZER_CALL classDescriptor='Test' + FIELD DELEGATE val `Test$IBase$delegate`: IBase + EXPRESSION_BODY + GET_VAR 'value-parameter impl: IBase' type=IBase origin=null + FUN DELEGATED_MEMBER public open override fun qux(t: TT, x: X): kotlin.Unit + TYPE_PARAMETER + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter t: TT + VALUE_PARAMETER value-parameter x: X + BLOCK_BODY + CALL 'qux(TT, X): Unit' type=kotlin.Unit origin=null + $this: GET_FIELD '`Test$IBase$delegate`: IBase' type=IBase origin=null + receiver: GET_VAR '' type=Test origin=null + t: GET_VAR 'value-parameter t: TT' type=TT origin=null + x: TYPE_OP type=X origin=IMPLICIT_CAST typeOperand=X + GET_VAR 'value-parameter x: X' type=X origin=null + FUN DELEGATED_MEMBER public open override fun foo(x: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter x: kotlin.Int + BLOCK_BODY + CALL 'foo(Int): Unit' type=kotlin.Unit origin=null + $this: GET_FIELD '`Test$IBase$delegate`: IBase' type=IBase origin=null + receiver: GET_VAR '' type=Test origin=null + x: GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=null + PROPERTY DELEGATED_MEMBER public open override val bar: kotlin.Int + FUN DELEGATED_MEMBER public open override fun (): kotlin.Int + $this: VALUE_PARAMETER + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + CALL '(): Int' type=kotlin.Int origin=null + $this: GET_FIELD '`Test$IBase$delegate`: IBase' type=IBase origin=null + receiver: GET_VAR '' type=Test origin=null diff --git a/compiler/testData/ir/irText/declarations/parameters/fun.kt b/compiler/testData/ir/irText/declarations/parameters/fun.kt new file mode 100644 index 00000000000..db33117f471 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/fun.kt @@ -0,0 +1,13 @@ +fun test1(i: Int, j: T) {} + +fun test2(i: Int = 0, j: String = "") {} + +fun test3(vararg args: String) {} + +fun String.textExt1(i: Int, j: String) {} + +class Host { + fun String.testMembetExt1(i: Int, j: String) {} + + fun String.testMembetExt2(i: Int, j: T) {} +} \ No newline at end of file diff --git a/compiler/testData/ir/irText/declarations/parameters/fun.txt b/compiler/testData/ir/irText/declarations/parameters/fun.txt new file mode 100644 index 00000000000..5404345f27e --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/fun.txt @@ -0,0 +1,40 @@ +FILE /fun.kt + FUN public fun test1(i: kotlin.Int, j: T): kotlin.Unit + TYPE_PARAMETER + VALUE_PARAMETER value-parameter i: kotlin.Int + VALUE_PARAMETER value-parameter j: T + BLOCK_BODY + FUN public fun test2(i: kotlin.Int = ..., j: kotlin.String = ...): kotlin.Unit + VALUE_PARAMETER value-parameter i: kotlin.Int = ... + EXPRESSION_BODY + CONST Int type=kotlin.Int value='0' + VALUE_PARAMETER value-parameter j: kotlin.String = ... + EXPRESSION_BODY + CONST String type=kotlin.String value='' + BLOCK_BODY + FUN public fun test3(vararg args: kotlin.String): kotlin.Unit + VALUE_PARAMETER value-parameter vararg args: kotlin.String + BLOCK_BODY + FUN public fun kotlin.String.textExt1(i: kotlin.Int, j: kotlin.String): kotlin.Unit + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter i: kotlin.Int + VALUE_PARAMETER value-parameter j: kotlin.String + BLOCK_BODY + CLASS CLASS Host + CONSTRUCTOR public constructor Host() + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + INSTANCE_INITIALIZER_CALL classDescriptor='Host' + FUN public final fun kotlin.String.testMembetExt1(i: kotlin.Int, j: kotlin.String): kotlin.Unit + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter i: kotlin.Int + VALUE_PARAMETER value-parameter j: kotlin.String + BLOCK_BODY + FUN public final fun kotlin.String.testMembetExt2(i: kotlin.Int, j: T): kotlin.Unit + TYPE_PARAMETER + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter i: kotlin.Int + VALUE_PARAMETER value-parameter j: T + BLOCK_BODY diff --git a/compiler/testData/ir/irText/declarations/parameters/lambdas.kt b/compiler/testData/ir/irText/declarations/parameters/lambdas.kt new file mode 100644 index 00000000000..28e24ef8626 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/lambdas.kt @@ -0,0 +1,4 @@ +val test1 : (String) -> String = { it } +val test2 : Any.(Any) -> Any = { it.hashCode() } +val test3 = { i: Int, j: Int -> } +val test4 = fun (i: Int, j: Int) {} \ No newline at end of file diff --git a/compiler/testData/ir/irText/declarations/parameters/lambdas.txt b/compiler/testData/ir/irText/declarations/parameters/lambdas.txt new file mode 100644 index 00000000000..147c849b4a4 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/lambdas.txt @@ -0,0 +1,59 @@ +FILE /lambdas.kt + PROPERTY public val test1: (kotlin.String) -> kotlin.String + FIELD PROPERTY_BACKING_FIELD public val test1: (kotlin.String) -> kotlin.String + EXPRESSION_BODY + BLOCK type=(kotlin.String) -> kotlin.String origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun (it: kotlin.String): kotlin.String + VALUE_PARAMETER value-parameter it: kotlin.String + BLOCK_BODY + RETURN type=kotlin.Nothing from='(String): String' + GET_VAR 'value-parameter it: String' type=kotlin.String origin=null + CALLABLE_REFERENCE '(String): String' type=(kotlin.String) -> kotlin.String origin=LAMBDA + FUN DEFAULT_PROPERTY_ACCESSOR public fun (): (kotlin.String) -> kotlin.String + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): (String) -> String' + GET_FIELD 'test1: (String) -> String' type=(kotlin.String) -> kotlin.String origin=null + PROPERTY public val test2: kotlin.Any.(kotlin.Any) -> kotlin.Any + FIELD PROPERTY_BACKING_FIELD public val test2: kotlin.Any.(kotlin.Any) -> kotlin.Any + EXPRESSION_BODY + BLOCK type=kotlin.Any.(kotlin.Any) -> kotlin.Int origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun kotlin.Any.(it: kotlin.Any): kotlin.Int + $receiver: VALUE_PARAMETER (Any) on Any: Int> + VALUE_PARAMETER value-parameter it: kotlin.Any + BLOCK_BODY + RETURN type=kotlin.Nothing from='(Any) on Any: Int' + CALL 'hashCode(): Int' type=kotlin.Int origin=null + $this: GET_VAR 'value-parameter it: Any' type=kotlin.Any origin=null + CALLABLE_REFERENCE '(Any) on Any: Int' type=kotlin.Any.(kotlin.Any) -> kotlin.Int origin=LAMBDA + FUN DEFAULT_PROPERTY_ACCESSOR public fun (): kotlin.Any.(kotlin.Any) -> kotlin.Any + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Any.(Any) -> Any' + GET_FIELD 'test2: Any.(Any) -> Any' type=kotlin.Any.(kotlin.Any) -> kotlin.Any origin=null + PROPERTY public val test3: (kotlin.Int, kotlin.Int) -> kotlin.Unit + FIELD PROPERTY_BACKING_FIELD public val test3: (kotlin.Int, kotlin.Int) -> kotlin.Unit + EXPRESSION_BODY + BLOCK type=(kotlin.Int, kotlin.Int) -> kotlin.Unit origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun (i: kotlin.Int, j: kotlin.Int): kotlin.Unit + VALUE_PARAMETER value-parameter i: kotlin.Int + VALUE_PARAMETER value-parameter j: kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(Int, Int): Unit' + GET_OBJECT 'Unit' type=kotlin.Unit + CALLABLE_REFERENCE '(Int, Int): Unit' type=(kotlin.Int, kotlin.Int) -> kotlin.Unit origin=LAMBDA + FUN DEFAULT_PROPERTY_ACCESSOR public fun (): (kotlin.Int, kotlin.Int) -> kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): (Int, Int) -> Unit' + GET_FIELD 'test3: (Int, Int) -> Unit' type=(kotlin.Int, kotlin.Int) -> kotlin.Unit origin=null + PROPERTY public val test4: (kotlin.Int, kotlin.Int) -> kotlin.Unit + FIELD PROPERTY_BACKING_FIELD public val test4: (kotlin.Int, kotlin.Int) -> kotlin.Unit + EXPRESSION_BODY + BLOCK type=(kotlin.Int, kotlin.Int) -> kotlin.Unit origin=ANONYMOUS_FUNCTION + FUN local final fun (i: kotlin.Int, j: kotlin.Int): kotlin.Unit + VALUE_PARAMETER value-parameter i: kotlin.Int + VALUE_PARAMETER value-parameter j: kotlin.Int + BLOCK_BODY + CALLABLE_REFERENCE '(Int, Int): Unit' type=(kotlin.Int, kotlin.Int) -> kotlin.Unit origin=ANONYMOUS_FUNCTION + FUN DEFAULT_PROPERTY_ACCESSOR public fun (): (kotlin.Int, kotlin.Int) -> kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): (Int, Int) -> Unit' + GET_FIELD 'test4: (Int, Int) -> Unit' type=(kotlin.Int, kotlin.Int) -> kotlin.Unit origin=null diff --git a/compiler/testData/ir/irText/declarations/parameters/localFun.kt b/compiler/testData/ir/irText/declarations/parameters/localFun.kt new file mode 100644 index 00000000000..ede202e4db9 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/localFun.kt @@ -0,0 +1,9 @@ +fun outer() { + fun test1(i: Int, j: T) {} + + fun test2(i: Int = 0, j: String = "") {} + + fun test3(vararg args: String) {} + + fun String.textExt1(i: Int, j: TT) {} +} \ No newline at end of file diff --git a/compiler/testData/ir/irText/declarations/parameters/localFun.txt b/compiler/testData/ir/irText/declarations/parameters/localFun.txt new file mode 100644 index 00000000000..40edb4fe986 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/localFun.txt @@ -0,0 +1,25 @@ +FILE /localFun.kt + FUN public fun outer(): kotlin.Unit + TYPE_PARAMETER + BLOCK_BODY + FUN local final fun test1(i: kotlin.Int, j: T): kotlin.Unit + TYPE_PARAMETER + VALUE_PARAMETER value-parameter i: kotlin.Int + VALUE_PARAMETER value-parameter j: T + BLOCK_BODY + FUN local final fun test2(i: kotlin.Int = ..., j: kotlin.String = ...): kotlin.Unit + VALUE_PARAMETER value-parameter i: kotlin.Int = ... + EXPRESSION_BODY + CONST Int type=kotlin.Int value='0' + VALUE_PARAMETER value-parameter j: kotlin.String = ... + EXPRESSION_BODY + CONST String type=kotlin.String value='' + BLOCK_BODY + FUN local final fun test3(vararg args: kotlin.String): kotlin.Unit + VALUE_PARAMETER value-parameter vararg args: kotlin.String + BLOCK_BODY + FUN local final fun kotlin.String.textExt1(i: kotlin.Int, j: TT): kotlin.Unit + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter i: kotlin.Int + VALUE_PARAMETER value-parameter j: TT + BLOCK_BODY diff --git a/compiler/testData/ir/irText/declarations/parameters/propertyAccessors.kt b/compiler/testData/ir/irText/declarations/parameters/propertyAccessors.kt new file mode 100644 index 00000000000..819253f0b46 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/propertyAccessors.kt @@ -0,0 +1,25 @@ +val test1 get() = 42 + +var test2 get() = 42; set(value) {} + +val String.testExt1 get() = 42 + +var String.testExt2 get() = 42; set(value) {} + +val T.testExt3 get() = 42 + +var T.testExt4 get() = 42; set(value) {} + +class Host { + val testMem1 get() = 42 + + var testMem2 get() = 42; set(value) {} + + val String.testMemExt1 get() = 42 + + var String.testMemExt2 get() = 42; set(value) {} + + val TT.testMemExt3 get() = 42 + + var TT.testMemExt4 get() = 42; set(value) {} +} \ No newline at end of file diff --git a/compiler/testData/ir/irText/declarations/parameters/propertyAccessors.txt b/compiler/testData/ir/irText/declarations/parameters/propertyAccessors.txt new file mode 100644 index 00000000000..9150ad1d94c --- /dev/null +++ b/compiler/testData/ir/irText/declarations/parameters/propertyAccessors.txt @@ -0,0 +1,107 @@ +FILE /propertyAccessors.kt + PROPERTY public val test1: kotlin.Int + FUN public fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + CONST Int type=kotlin.Int value='42' + PROPERTY public var test2: kotlin.Int + FUN public fun (): kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + CONST Int type=kotlin.Int value='42' + FUN public fun (value: kotlin.Int): kotlin.Unit + VALUE_PARAMETER value-parameter value: kotlin.Int + BLOCK_BODY + PROPERTY public val kotlin.String.testExt1: kotlin.Int + FUN public fun kotlin.String.(): kotlin.Int + $receiver: VALUE_PARAMETER + BLOCK_BODY + RETURN type=kotlin.Nothing from='() on String: Int' + CONST Int type=kotlin.Int value='42' + PROPERTY public var kotlin.String.testExt2: kotlin.Int + FUN public fun kotlin.String.(): kotlin.Int + $receiver: VALUE_PARAMETER + BLOCK_BODY + RETURN type=kotlin.Nothing from='() on String: Int' + CONST Int type=kotlin.Int value='42' + FUN public fun kotlin.String.(value: kotlin.Int): kotlin.Unit + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter value: kotlin.Int + BLOCK_BODY + PROPERTY public val T.testExt3: kotlin.Int + FUN public fun T.(): kotlin.Int + $receiver: VALUE_PARAMETER + BLOCK_BODY + RETURN type=kotlin.Nothing from='() on T: Int' + CONST Int type=kotlin.Int value='42' + PROPERTY public var T.testExt4: kotlin.Int + FUN public fun T.(): kotlin.Int + $receiver: VALUE_PARAMETER + BLOCK_BODY + RETURN type=kotlin.Nothing from='() on T: Int' + CONST Int type=kotlin.Int value='42' + FUN public fun T.(value: kotlin.Int): kotlin.Unit + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter value: kotlin.Int + BLOCK_BODY + CLASS CLASS Host + TYPE_PARAMETER + CONSTRUCTOR public constructor Host() + TYPE_PARAMETER + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + INSTANCE_INITIALIZER_CALL classDescriptor='Host' + PROPERTY public final val testMem1: kotlin.Int + FUN public final fun (): kotlin.Int + $this: VALUE_PARAMETER + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + CONST Int type=kotlin.Int value='42' + PROPERTY public final var testMem2: kotlin.Int + FUN public final fun (): kotlin.Int + $this: VALUE_PARAMETER + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + CONST Int type=kotlin.Int value='42' + FUN public final fun (value: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter value: kotlin.Int + BLOCK_BODY + PROPERTY public final val kotlin.String.testMemExt1: kotlin.Int + FUN public final fun kotlin.String.(): kotlin.Int + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER + BLOCK_BODY + RETURN type=kotlin.Nothing from='() on String: Int' + CONST Int type=kotlin.Int value='42' + PROPERTY public final var kotlin.String.testMemExt2: kotlin.Int + FUN public final fun kotlin.String.(): kotlin.Int + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER + BLOCK_BODY + RETURN type=kotlin.Nothing from='() on String: Int' + CONST Int type=kotlin.Int value='42' + FUN public final fun kotlin.String.(value: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter value: kotlin.Int + BLOCK_BODY + PROPERTY public final val TT.testMemExt3: kotlin.Int + FUN public final fun TT.(): kotlin.Int + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER + BLOCK_BODY + RETURN type=kotlin.Nothing from='() on TT: Int' + CONST Int type=kotlin.Int value='42' + PROPERTY public final var TT.testMemExt4: kotlin.Int + FUN public final fun TT.(): kotlin.Int + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER + BLOCK_BODY + RETURN type=kotlin.Nothing from='() on TT: Int' + CONST Int type=kotlin.Int value='42' + FUN public final fun TT.(value: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter value: kotlin.Int + BLOCK_BODY diff --git a/compiler/testData/ir/irText/declarations/primaryCtorDefaultArguments.txt b/compiler/testData/ir/irText/declarations/primaryCtorDefaultArguments.txt index 5980a6e072b..40f186e5d47 100644 --- a/compiler/testData/ir/irText/declarations/primaryCtorDefaultArguments.txt +++ b/compiler/testData/ir/irText/declarations/primaryCtorDefaultArguments.txt @@ -1,8 +1,9 @@ FILE /primaryCtorDefaultArguments.kt CLASS CLASS Test CONSTRUCTOR public constructor Test(x: kotlin.Int = ...) - x: EXPRESSION_BODY - CONST Int type=kotlin.Int value='0' + VALUE_PARAMETER value-parameter x: kotlin.Int = ... + EXPRESSION_BODY + CONST Int type=kotlin.Int value='0' BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Test' @@ -11,6 +12,7 @@ FILE /primaryCtorDefaultArguments.kt EXPRESSION_BODY GET_VAR 'value-parameter x: Int = ...' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/declarations/primaryCtorProperties.txt b/compiler/testData/ir/irText/declarations/primaryCtorProperties.txt index 24777292434..cb9fe2251a0 100644 --- a/compiler/testData/ir/irText/declarations/primaryCtorProperties.txt +++ b/compiler/testData/ir/irText/declarations/primaryCtorProperties.txt @@ -1,6 +1,8 @@ FILE /primaryCtorProperties.kt CLASS CLASS C CONSTRUCTOR public constructor C(test1: kotlin.Int, test2: kotlin.Int) + VALUE_PARAMETER value-parameter test1: kotlin.Int + VALUE_PARAMETER value-parameter test2: kotlin.Int BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='C' @@ -9,6 +11,7 @@ FILE /primaryCtorProperties.kt EXPRESSION_BODY GET_VAR 'value-parameter test1: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'test1: Int' type=kotlin.Int origin=null @@ -18,11 +21,14 @@ FILE /primaryCtorProperties.kt EXPRESSION_BODY GET_VAR 'value-parameter test2: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'test2: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=C origin=null FUN DEFAULT_PROPERTY_ACCESSOR public final fun (: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter : kotlin.Int BLOCK_BODY SET_FIELD 'test2: Int' type=kotlin.Unit origin=null receiver: GET_VAR '' type=C origin=null diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.txt b/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.txt index 235ce96de69..82b621aacff 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.txt @@ -1,6 +1,7 @@ FILE /differentReceivers.kt CLASS CLASS MyClass CONSTRUCTOR public constructor MyClass(value: kotlin.String) + VALUE_PARAMETER value-parameter value: kotlin.String BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='MyClass' @@ -9,16 +10,23 @@ FILE /differentReceivers.kt EXPRESSION_BODY GET_VAR 'value-parameter value: String' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.String + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): String' GET_FIELD 'value: String' type=kotlin.String origin=null receiver: GET_VAR '' type=MyClass origin=null FUN public operator fun MyClass.provideDelegate(host: kotlin.Any?, p: kotlin.Any): kotlin.String + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter host: kotlin.Any? + VALUE_PARAMETER value-parameter p: kotlin.Any BLOCK_BODY RETURN type=kotlin.Nothing from='provideDelegate(Any?, Any) on MyClass: String' CALL '(): String' type=kotlin.String origin=GET_PROPERTY $this: GET_VAR '' type=MyClass origin=null FUN public operator fun kotlin.String.getValue(receiver: kotlin.Any?, p: kotlin.Any): kotlin.String + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter receiver: kotlin.Any? + VALUE_PARAMETER value-parameter p: kotlin.Any BLOCK_BODY RETURN type=kotlin.Nothing from='getValue(Any?, Any) on String: String' GET_VAR '' type=kotlin.String origin=null diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/local.txt b/compiler/testData/ir/irText/declarations/provideDelegate/local.txt index 8e9a639f109..d1abfe857e4 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/local.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/local.txt @@ -1,6 +1,7 @@ FILE /local.kt CLASS CLASS Delegate CONSTRUCTOR public constructor Delegate(value: kotlin.String) + VALUE_PARAMETER value-parameter value: kotlin.String BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Delegate' @@ -9,17 +10,22 @@ FILE /local.kt EXPRESSION_BODY GET_VAR 'value-parameter value: String' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.String + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): String' GET_FIELD 'value: String' type=kotlin.String origin=null receiver: GET_VAR '' type=Delegate origin=null FUN public final operator fun getValue(thisRef: kotlin.Any?, property: kotlin.Any?): kotlin.String + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter thisRef: kotlin.Any? + VALUE_PARAMETER value-parameter property: kotlin.Any? BLOCK_BODY RETURN type=kotlin.Nothing from='getValue(Any?, Any?): String' CALL '(): String' type=kotlin.String origin=GET_PROPERTY $this: GET_VAR '' type=Delegate origin=null CLASS CLASS DelegateProvider CONSTRUCTOR public constructor DelegateProvider(value: kotlin.String) + VALUE_PARAMETER value-parameter value: kotlin.String BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='DelegateProvider' @@ -28,11 +34,15 @@ FILE /local.kt EXPRESSION_BODY GET_VAR 'value-parameter value: String' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.String + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): String' GET_FIELD 'value: String' type=kotlin.String origin=null receiver: GET_VAR '' type=DelegateProvider origin=null FUN public final operator fun provideDelegate(thisRef: kotlin.Any?, property: kotlin.Any?): Delegate + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter thisRef: kotlin.Any? + VALUE_PARAMETER value-parameter property: kotlin.Any? BLOCK_BODY RETURN type=kotlin.Nothing from='provideDelegate(Any?, Any?): Delegate' CALL 'constructor Delegate(String)' type=Delegate origin=null diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.txt b/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.txt index f866f2f0a64..6145c61b10a 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.txt @@ -1,6 +1,7 @@ FILE /localDifferentReceivers.kt CLASS CLASS MyClass CONSTRUCTOR public constructor MyClass(value: kotlin.String) + VALUE_PARAMETER value-parameter value: kotlin.String BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='MyClass' @@ -9,16 +10,23 @@ FILE /localDifferentReceivers.kt EXPRESSION_BODY GET_VAR 'value-parameter value: String' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.String + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): String' GET_FIELD 'value: String' type=kotlin.String origin=null receiver: GET_VAR '' type=MyClass origin=null FUN public operator fun MyClass.provideDelegate(host: kotlin.Any?, p: kotlin.Any): kotlin.String + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter host: kotlin.Any? + VALUE_PARAMETER value-parameter p: kotlin.Any BLOCK_BODY RETURN type=kotlin.Nothing from='provideDelegate(Any?, Any) on MyClass: String' CALL '(): String' type=kotlin.String origin=GET_PROPERTY $this: GET_VAR '' type=MyClass origin=null FUN public operator fun kotlin.String.getValue(receiver: kotlin.Any?, p: kotlin.Any): kotlin.String + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter receiver: kotlin.Any? + VALUE_PARAMETER value-parameter p: kotlin.Any BLOCK_BODY RETURN type=kotlin.Nothing from='getValue(Any?, Any) on String: String' GET_VAR '' type=kotlin.String origin=null diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/member.txt b/compiler/testData/ir/irText/declarations/provideDelegate/member.txt index 3828f1233d7..9e15dafe257 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/member.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/member.txt @@ -1,6 +1,7 @@ FILE /member.kt CLASS CLASS Delegate CONSTRUCTOR public constructor Delegate(value: kotlin.String) + VALUE_PARAMETER value-parameter value: kotlin.String BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Delegate' @@ -9,17 +10,22 @@ FILE /member.kt EXPRESSION_BODY GET_VAR 'value-parameter value: String' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.String + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): String' GET_FIELD 'value: String' type=kotlin.String origin=null receiver: GET_VAR '' type=Delegate origin=null FUN public final operator fun getValue(thisRef: kotlin.Any?, property: kotlin.Any?): kotlin.String + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter thisRef: kotlin.Any? + VALUE_PARAMETER value-parameter property: kotlin.Any? BLOCK_BODY RETURN type=kotlin.Nothing from='getValue(Any?, Any?): String' CALL '(): String' type=kotlin.String origin=GET_PROPERTY $this: GET_VAR '' type=Delegate origin=null CLASS CLASS DelegateProvider CONSTRUCTOR public constructor DelegateProvider(value: kotlin.String) + VALUE_PARAMETER value-parameter value: kotlin.String BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='DelegateProvider' @@ -28,11 +34,15 @@ FILE /member.kt EXPRESSION_BODY GET_VAR 'value-parameter value: String' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.String + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): String' GET_FIELD 'value: String' type=kotlin.String origin=null receiver: GET_VAR '' type=DelegateProvider origin=null FUN public final operator fun provideDelegate(thisRef: kotlin.Any?, property: kotlin.Any?): Delegate + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter thisRef: kotlin.Any? + VALUE_PARAMETER value-parameter property: kotlin.Any? BLOCK_BODY RETURN type=kotlin.Nothing from='provideDelegate(Any?, Any?): Delegate' CALL 'constructor Delegate(String)' type=Delegate origin=null @@ -52,6 +62,7 @@ FILE /member.kt thisRef: GET_VAR '' type=Host origin=null property: CALLABLE_REFERENCE 'testMember: String' type=kotlin.reflect.KProperty1 origin=PROPERTY_REFERENCE_FOR_DELEGATE FUN DELEGATED_PROPERTY_ACCESSOR public final fun (): kotlin.String + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): String' CALL 'getValue(Any?, Any?): String' type=kotlin.String origin=null diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.txt b/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.txt index 51b20c2c02c..f8a7cf94266 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.txt @@ -6,6 +6,7 @@ FILE /memberExtension.kt INSTANCE_INITIALIZER_CALL classDescriptor='Host' CLASS CLASS StringDelegate CONSTRUCTOR public constructor StringDelegate(s: kotlin.String) + VALUE_PARAMETER value-parameter s: kotlin.String BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='StringDelegate' @@ -14,11 +15,15 @@ FILE /memberExtension.kt EXPRESSION_BODY GET_VAR 'value-parameter s: String' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.String + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): String' GET_FIELD 's: String' type=kotlin.String origin=null receiver: GET_VAR '' type=Host.StringDelegate origin=null FUN public final operator fun getValue(receiver: kotlin.String, p: kotlin.Any): kotlin.String + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter receiver: kotlin.String + VALUE_PARAMETER value-parameter p: kotlin.Any BLOCK_BODY RETURN type=kotlin.Nothing from='getValue(String, Any): String' CALL 'plus(Any?): String' type=kotlin.String origin=PLUS @@ -26,6 +31,10 @@ FILE /memberExtension.kt other: CALL '(): String' type=kotlin.String origin=GET_PROPERTY $this: GET_VAR '' type=Host.StringDelegate origin=null FUN public final operator fun kotlin.String.provideDelegate(host: kotlin.Any?, p: kotlin.Any): Host.StringDelegate + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter host: kotlin.Any? + VALUE_PARAMETER value-parameter p: kotlin.Any BLOCK_BODY RETURN type=kotlin.Nothing from='provideDelegate(Any?, Any) on String: Host.StringDelegate' CALL 'constructor StringDelegate(String)' type=Host.StringDelegate origin=null @@ -39,6 +48,8 @@ FILE /memberExtension.kt host: GET_VAR '' type=Host origin=null p: CALLABLE_REFERENCE 'plusK: String on String' type=kotlin.reflect.KProperty2 origin=PROPERTY_REFERENCE_FOR_DELEGATE FUN DELEGATED_PROPERTY_ACCESSOR public final fun kotlin.String.(): kotlin.String + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='() on String: String' CALL 'getValue(String, Any): String' type=kotlin.String origin=null @@ -53,6 +64,7 @@ FILE /memberExtension.kt $this: GET_VAR '' type=Host origin=null $receiver: CONST String type=kotlin.String value='O' FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.String + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): String' GET_FIELD 'ok: String' type=kotlin.String origin=null diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/topLevel.txt b/compiler/testData/ir/irText/declarations/provideDelegate/topLevel.txt index 028b55e077b..8beb2e14e79 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/topLevel.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/topLevel.txt @@ -1,6 +1,7 @@ FILE /topLevel.kt CLASS CLASS Delegate CONSTRUCTOR public constructor Delegate(value: kotlin.String) + VALUE_PARAMETER value-parameter value: kotlin.String BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Delegate' @@ -9,17 +10,22 @@ FILE /topLevel.kt EXPRESSION_BODY GET_VAR 'value-parameter value: String' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.String + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): String' GET_FIELD 'value: String' type=kotlin.String origin=null receiver: GET_VAR '' type=Delegate origin=null FUN public final operator fun getValue(thisRef: kotlin.Any?, property: kotlin.Any?): kotlin.String + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter thisRef: kotlin.Any? + VALUE_PARAMETER value-parameter property: kotlin.Any? BLOCK_BODY RETURN type=kotlin.Nothing from='getValue(Any?, Any?): String' CALL '(): String' type=kotlin.String origin=GET_PROPERTY $this: GET_VAR '' type=Delegate origin=null CLASS CLASS DelegateProvider CONSTRUCTOR public constructor DelegateProvider(value: kotlin.String) + VALUE_PARAMETER value-parameter value: kotlin.String BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='DelegateProvider' @@ -28,11 +34,15 @@ FILE /topLevel.kt EXPRESSION_BODY GET_VAR 'value-parameter value: String' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.String + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): String' GET_FIELD 'value: String' type=kotlin.String origin=null receiver: GET_VAR '' type=DelegateProvider origin=null FUN public final operator fun provideDelegate(thisRef: kotlin.Any?, property: kotlin.Any?): Delegate + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter thisRef: kotlin.Any? + VALUE_PARAMETER value-parameter property: kotlin.Any? BLOCK_BODY RETURN type=kotlin.Nothing from='provideDelegate(Any?, Any?): Delegate' CALL 'constructor Delegate(String)' type=Delegate origin=null diff --git a/compiler/testData/ir/irText/errors/suppressedNonPublicCall.txt b/compiler/testData/ir/irText/errors/suppressedNonPublicCall.txt index 1dc77ae02c8..b904d1eed06 100644 --- a/compiler/testData/ir/irText/errors/suppressedNonPublicCall.txt +++ b/compiler/testData/ir/irText/errors/suppressedNonPublicCall.txt @@ -5,8 +5,10 @@ FILE /suppressedNonPublicCall.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='C' FUN internal final fun bar(): kotlin.Unit + $this: VALUE_PARAMETER BLOCK_BODY FUN public inline fun C.foo(): kotlin.Unit + $receiver: VALUE_PARAMETER BLOCK_BODY CALL 'bar(): Unit' type=kotlin.Unit origin=null $this: GET_VAR '' type=C origin=null diff --git a/compiler/testData/ir/irText/expressions/arrayAccess.txt b/compiler/testData/ir/irText/expressions/arrayAccess.txt index 04165f801ae..7529665e588 100644 --- a/compiler/testData/ir/irText/expressions/arrayAccess.txt +++ b/compiler/testData/ir/irText/expressions/arrayAccess.txt @@ -12,6 +12,7 @@ FILE /arrayAccess.kt RETURN type=kotlin.Nothing from='foo(): Int' CONST Int type=kotlin.Int value='1' FUN public fun test(a: kotlin.IntArray): kotlin.Int + VALUE_PARAMETER value-parameter a: kotlin.IntArray BLOCK_BODY RETURN type=kotlin.Nothing from='test(IntArray): Int' CALL 'plus(Int): Int' type=kotlin.Int origin=PLUS diff --git a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.txt b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.txt index 4623f7c2525..76039929072 100644 --- a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.txt +++ b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment1.txt @@ -13,6 +13,7 @@ FILE /arrayAugmentedAssignment1.kt CONST Int type=kotlin.Int value='42' CLASS CLASS C CONSTRUCTOR public constructor C(x: kotlin.IntArray) + VALUE_PARAMETER value-parameter x: kotlin.IntArray BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='C' @@ -21,6 +22,7 @@ FILE /arrayAugmentedAssignment1.kt EXPRESSION_BODY GET_VAR 'value-parameter x: IntArray' type=kotlin.IntArray origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.IntArray + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): IntArray' GET_FIELD 'x: IntArray' type=kotlin.IntArray origin=null @@ -58,6 +60,7 @@ FILE /arrayAugmentedAssignment1.kt index: GET_VAR 'tmp1_index0: Int' type=kotlin.Int origin=null other: CONST Int type=kotlin.Int value='2' FUN public fun testMember(c: C): kotlin.Unit + VALUE_PARAMETER value-parameter c: C BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit BLOCK type=kotlin.Int origin=POSTFIX_INCR diff --git a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.txt b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.txt index ab9318d6751..df279a5e941 100644 --- a/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.txt +++ b/compiler/testData/ir/irText/expressions/arrayAugmentedAssignment2.txt @@ -1,9 +1,17 @@ FILE /arrayAugmentedAssignment2.kt CLASS INTERFACE IA FUN public abstract operator fun get(index: kotlin.String): kotlin.Int + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter index: kotlin.String CLASS INTERFACE IB FUN public abstract operator fun IA.set(index: kotlin.String, value: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter index: kotlin.String + VALUE_PARAMETER value-parameter value: kotlin.Int FUN public fun IB.test(a: IA): kotlin.Unit + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter a: IA BLOCK_BODY BLOCK type=kotlin.Unit origin=PLUSEQ VAR IR_TEMPORARY_VARIABLE val tmp0_array: IA diff --git a/compiler/testData/ir/irText/expressions/assignments.txt b/compiler/testData/ir/irText/expressions/assignments.txt index 4fc50dfdf5f..0924e8c5501 100644 --- a/compiler/testData/ir/irText/expressions/assignments.txt +++ b/compiler/testData/ir/irText/expressions/assignments.txt @@ -1,6 +1,7 @@ FILE /assignments.kt CLASS CLASS Ref CONSTRUCTOR public constructor Ref(x: kotlin.Int) + VALUE_PARAMETER value-parameter x: kotlin.Int BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Ref' @@ -9,11 +10,14 @@ FILE /assignments.kt EXPRESSION_BODY GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=Ref origin=null FUN DEFAULT_PROPERTY_ACCESSOR public final fun (: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter : kotlin.Int BLOCK_BODY SET_FIELD 'x: Int' type=kotlin.Unit origin=null receiver: GET_VAR '' type=Ref origin=null @@ -29,6 +33,7 @@ FILE /assignments.kt $this: GET_VAR 'x: Int' type=kotlin.Int origin=null other: CONST Int type=kotlin.Int value='1' FUN public fun test2(r: Ref): kotlin.Unit + VALUE_PARAMETER value-parameter r: Ref BLOCK_BODY CALL '(Int): Unit' type=kotlin.Unit origin=EQ $this: GET_VAR 'value-parameter r: Ref' type=Ref origin=null diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignment1.txt b/compiler/testData/ir/irText/expressions/augmentedAssignment1.txt index 5f3f20251a4..32a0d5411b6 100644 --- a/compiler/testData/ir/irText/expressions/augmentedAssignment1.txt +++ b/compiler/testData/ir/irText/expressions/augmentedAssignment1.txt @@ -8,6 +8,7 @@ FILE /augmentedAssignment1.kt RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'p: Int' type=kotlin.Int origin=null FUN DEFAULT_PROPERTY_ACCESSOR public fun (: kotlin.Int): kotlin.Unit + VALUE_PARAMETER value-parameter : kotlin.Int BLOCK_BODY SET_FIELD 'p: Int' type=kotlin.Unit origin=null value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignment2.txt b/compiler/testData/ir/irText/expressions/augmentedAssignment2.txt index 2499e3c7bff..38dccd17831 100644 --- a/compiler/testData/ir/irText/expressions/augmentedAssignment2.txt +++ b/compiler/testData/ir/irText/expressions/augmentedAssignment2.txt @@ -5,14 +5,24 @@ FILE /augmentedAssignment2.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='A' FUN public operator fun A.plusAssign(s: kotlin.String): kotlin.Unit + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter s: kotlin.String BLOCK_BODY FUN public operator fun A.minusAssign(s: kotlin.String): kotlin.Unit + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter s: kotlin.String BLOCK_BODY FUN public operator fun A.timesAssign(s: kotlin.String): kotlin.Unit + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter s: kotlin.String BLOCK_BODY FUN public operator fun A.divAssign(s: kotlin.String): kotlin.Unit + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter s: kotlin.String BLOCK_BODY FUN public operator fun A.modAssign(s: kotlin.String): kotlin.Unit + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter s: kotlin.String BLOCK_BODY PROPERTY public val p: A FIELD PROPERTY_BACKING_FIELD public val p: A diff --git a/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.txt b/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.txt index 8eba030793a..d9cbb532eb4 100644 --- a/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.txt +++ b/compiler/testData/ir/irText/expressions/augmentedAssignmentWithExpression.txt @@ -5,8 +5,11 @@ FILE /augmentedAssignmentWithExpression.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Host' FUN public final operator fun plusAssign(x: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter x: kotlin.Int BLOCK_BODY FUN public final fun test1(): kotlin.Unit + $this: VALUE_PARAMETER BLOCK_BODY CALL 'plusAssign(Int): Unit' type=kotlin.Unit origin=PLUSEQ $this: GET_VAR '' type=Host origin=null @@ -16,6 +19,7 @@ FILE /augmentedAssignmentWithExpression.kt RETURN type=kotlin.Nothing from='foo(): Host' CALL 'constructor Host()' type=Host origin=null FUN public fun Host.test2(): kotlin.Unit + $receiver: VALUE_PARAMETER BLOCK_BODY CALL 'plusAssign(Int): Unit' type=kotlin.Unit origin=PLUSEQ $this: GET_VAR '' type=Host origin=null @@ -26,6 +30,7 @@ FILE /augmentedAssignmentWithExpression.kt $this: CALL 'foo(): Host' type=Host origin=null x: CONST Int type=kotlin.Int value='1' FUN public fun test4(a: () -> Host): kotlin.Unit + VALUE_PARAMETER value-parameter a: () -> Host BLOCK_BODY CALL 'plusAssign(Int): Unit' type=kotlin.Unit origin=PLUSEQ $this: CALL 'invoke(): Host' type=Host origin=INVOKE diff --git a/compiler/testData/ir/irText/expressions/bangbang.txt b/compiler/testData/ir/irText/expressions/bangbang.txt index c40f06db4de..39de9ac8d57 100644 --- a/compiler/testData/ir/irText/expressions/bangbang.txt +++ b/compiler/testData/ir/irText/expressions/bangbang.txt @@ -1,5 +1,6 @@ FILE /bangbang.kt FUN public fun test1(a: kotlin.Any?): kotlin.Any + VALUE_PARAMETER value-parameter a: kotlin.Any? BLOCK_BODY RETURN type=kotlin.Nothing from='test1(Any?): Any' BLOCK type=kotlin.Any origin=EXCLEXCL @@ -15,6 +16,7 @@ FILE /bangbang.kt if: CONST Boolean type=kotlin.Boolean value='true' then: GET_VAR 'tmp0_notnull: Any?' type=kotlin.Any? origin=null FUN public fun test2(a: kotlin.Any?): kotlin.Int + VALUE_PARAMETER value-parameter a: kotlin.Any? BLOCK_BODY RETURN type=kotlin.Nothing from='test2(Any?): Int' BLOCK type=kotlin.Int origin=EXCLEXCL diff --git a/compiler/testData/ir/irText/expressions/booleanConstsInAndAndOrOr.txt b/compiler/testData/ir/irText/expressions/booleanConstsInAndAndOrOr.txt index c4a0bbb5c80..c58b993128f 100644 --- a/compiler/testData/ir/irText/expressions/booleanConstsInAndAndOrOr.txt +++ b/compiler/testData/ir/irText/expressions/booleanConstsInAndAndOrOr.txt @@ -1,5 +1,6 @@ FILE /booleanConstsInAndAndOrOr.kt FUN public fun test1(b: kotlin.Boolean): kotlin.Unit + VALUE_PARAMETER value-parameter b: kotlin.Boolean BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit WHEN type=kotlin.Boolean origin=ANDAND @@ -11,6 +12,7 @@ FILE /booleanConstsInAndAndOrOr.kt if: CONST Boolean type=kotlin.Boolean value='true' then: CONST Boolean type=kotlin.Boolean value='false' FUN public fun test2(b: kotlin.Boolean): kotlin.Unit + VALUE_PARAMETER value-parameter b: kotlin.Boolean BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit WHEN type=kotlin.Boolean origin=OROR diff --git a/compiler/testData/ir/irText/expressions/booleanOperators.txt b/compiler/testData/ir/irText/expressions/booleanOperators.txt index 56cd31a3894..3fd66304359 100644 --- a/compiler/testData/ir/irText/expressions/booleanOperators.txt +++ b/compiler/testData/ir/irText/expressions/booleanOperators.txt @@ -1,5 +1,7 @@ FILE /booleanOperators.kt FUN public fun test1(a: kotlin.Boolean, b: kotlin.Boolean): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Boolean + VALUE_PARAMETER value-parameter b: kotlin.Boolean BLOCK_BODY RETURN type=kotlin.Nothing from='test1(Boolean, Boolean): Boolean' WHEN type=kotlin.Boolean origin=ANDAND @@ -10,6 +12,8 @@ FILE /booleanOperators.kt if: CONST Boolean type=kotlin.Boolean value='true' then: CONST Boolean type=kotlin.Boolean value='false' FUN public fun test2(a: kotlin.Boolean, b: kotlin.Boolean): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Boolean + VALUE_PARAMETER value-parameter b: kotlin.Boolean BLOCK_BODY RETURN type=kotlin.Nothing from='test2(Boolean, Boolean): Boolean' WHEN type=kotlin.Boolean origin=OROR @@ -20,12 +24,16 @@ FILE /booleanOperators.kt if: CONST Boolean type=kotlin.Boolean value='true' then: GET_VAR 'value-parameter b: Boolean' type=kotlin.Boolean origin=null FUN public fun test1x(a: kotlin.Boolean, b: kotlin.Boolean): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Boolean + VALUE_PARAMETER value-parameter b: kotlin.Boolean BLOCK_BODY RETURN type=kotlin.Nothing from='test1x(Boolean, Boolean): Boolean' CALL 'and(Boolean): Boolean' type=kotlin.Boolean origin=null $this: GET_VAR 'value-parameter a: Boolean' type=kotlin.Boolean origin=null other: GET_VAR 'value-parameter b: Boolean' type=kotlin.Boolean origin=null FUN public fun test2x(a: kotlin.Boolean, b: kotlin.Boolean): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Boolean + VALUE_PARAMETER value-parameter b: kotlin.Boolean BLOCK_BODY RETURN type=kotlin.Nothing from='test2x(Boolean, Boolean): Boolean' CALL 'or(Boolean): Boolean' type=kotlin.Boolean origin=null diff --git a/compiler/testData/ir/irText/expressions/boundCallableReferences.txt b/compiler/testData/ir/irText/expressions/boundCallableReferences.txt index 2017667cacf..715a775170f 100644 --- a/compiler/testData/ir/irText/expressions/boundCallableReferences.txt +++ b/compiler/testData/ir/irText/expressions/boundCallableReferences.txt @@ -5,17 +5,20 @@ FILE /boundCallableReferences.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='A' FUN public final fun foo(): kotlin.Unit + $this: VALUE_PARAMETER BLOCK_BODY PROPERTY public final val bar: kotlin.Int = 0 FIELD PROPERTY_BACKING_FIELD public final val bar: kotlin.Int = 0 EXPRESSION_BODY CONST Int type=kotlin.Int value='0' FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'bar: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=A origin=null FUN public fun A.qux(): kotlin.Unit + $receiver: VALUE_PARAMETER BLOCK_BODY PROPERTY public val test1: kotlin.reflect.KFunction0 FIELD PROPERTY_BACKING_FIELD public val test1: kotlin.reflect.KFunction0 diff --git a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.txt b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.txt index 368cfc6bd79..e79fe25c195 100644 --- a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.txt +++ b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.txt @@ -1,5 +1,6 @@ FILE /breakContinueInLoopHeader.kt FUN public fun test1(c: kotlin.Boolean?): kotlin.Unit + VALUE_PARAMETER value-parameter c: kotlin.Boolean? BLOCK_BODY WHILE label=L origin=WHILE_LOOP condition: CONST Boolean type=kotlin.Boolean value='true' @@ -18,6 +19,7 @@ FILE /breakContinueInLoopHeader.kt if: CONST Boolean type=kotlin.Boolean value='true' then: GET_VAR 'tmp0_elvis_lhs: Boolean?' type=kotlin.Boolean? origin=null FUN public fun test2(c: kotlin.Boolean?): kotlin.Unit + VALUE_PARAMETER value-parameter c: kotlin.Boolean? BLOCK_BODY WHILE label=L origin=WHILE_LOOP condition: CONST Boolean type=kotlin.Boolean value='true' @@ -36,6 +38,7 @@ FILE /breakContinueInLoopHeader.kt if: CONST Boolean type=kotlin.Boolean value='true' then: GET_VAR 'tmp0_elvis_lhs: Boolean?' type=kotlin.Boolean? origin=null FUN public fun test3(ss: kotlin.collections.List?): kotlin.Unit + VALUE_PARAMETER value-parameter ss: kotlin.collections.List? BLOCK_BODY WHILE label=L origin=WHILE_LOOP condition: CONST Boolean type=kotlin.Boolean value='true' @@ -63,6 +66,7 @@ FILE /breakContinueInLoopHeader.kt CALL 'next(): String' type=kotlin.String origin=FOR_LOOP_NEXT $this: GET_VAR 'tmp1_iterator: Iterator' type=kotlin.collections.Iterator origin=null FUN public fun test4(ss: kotlin.collections.List?): kotlin.Unit + VALUE_PARAMETER value-parameter ss: kotlin.collections.List? BLOCK_BODY WHILE label=L origin=WHILE_LOOP condition: CONST Boolean type=kotlin.Boolean value='true' diff --git a/compiler/testData/ir/irText/expressions/callWithReorderedArguments.txt b/compiler/testData/ir/irText/expressions/callWithReorderedArguments.txt index 954f2b2cf25..7fd464fa7f2 100644 --- a/compiler/testData/ir/irText/expressions/callWithReorderedArguments.txt +++ b/compiler/testData/ir/irText/expressions/callWithReorderedArguments.txt @@ -1,5 +1,7 @@ FILE /callWithReorderedArguments.kt FUN public fun foo(a: kotlin.Int, b: kotlin.Int): kotlin.Unit + VALUE_PARAMETER value-parameter a: kotlin.Int + VALUE_PARAMETER value-parameter b: kotlin.Int BLOCK_BODY FUN public fun noReorder1(): kotlin.Int BLOCK_BODY diff --git a/compiler/testData/ir/irText/expressions/calls.txt b/compiler/testData/ir/irText/expressions/calls.txt index 1bb6ac5149c..6df64196b27 100644 --- a/compiler/testData/ir/irText/expressions/calls.txt +++ b/compiler/testData/ir/irText/expressions/calls.txt @@ -1,15 +1,19 @@ FILE /calls.kt FUN public fun foo(x: kotlin.Int, y: kotlin.Int): kotlin.Int + VALUE_PARAMETER value-parameter x: kotlin.Int + VALUE_PARAMETER value-parameter y: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='foo(Int, Int): Int' GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=null FUN public fun bar(x: kotlin.Int): kotlin.Int + VALUE_PARAMETER value-parameter x: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='bar(Int): Int' CALL 'foo(Int, Int): Int' type=kotlin.Int origin=null x: GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=null y: CONST Int type=kotlin.Int value='1' FUN public fun qux(x: kotlin.Int): kotlin.Int + VALUE_PARAMETER value-parameter x: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='qux(Int): Int' CALL 'foo(Int, Int): Int' type=kotlin.Int origin=null @@ -18,16 +22,21 @@ FILE /calls.kt y: GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=null y: GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=null FUN public fun kotlin.Int.ext1(): kotlin.Int + $receiver: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='ext1() on Int: Int' GET_VAR '' type=kotlin.Int origin=null FUN public fun kotlin.Int.ext2(x: kotlin.Int): kotlin.Int + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter x: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='ext2(Int) on Int: Int' CALL 'foo(Int, Int): Int' type=kotlin.Int origin=null x: GET_VAR '' type=kotlin.Int origin=null y: GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=null FUN public fun kotlin.Int.ext3(x: kotlin.Int): kotlin.Int + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter x: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='ext3(Int) on Int: Int' CALL 'foo(Int, Int): Int' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/expressions/chainOfSafeCalls.txt b/compiler/testData/ir/irText/expressions/chainOfSafeCalls.txt index fe3643eb3fb..2b6b5e55df6 100644 --- a/compiler/testData/ir/irText/expressions/chainOfSafeCalls.txt +++ b/compiler/testData/ir/irText/expressions/chainOfSafeCalls.txt @@ -5,14 +5,17 @@ FILE /chainOfSafeCalls.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='C' FUN public final fun foo(): C + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='foo(): C' GET_VAR '' type=C origin=null FUN public final fun bar(): C? + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='bar(): C?' GET_VAR '' type=C origin=null FUN public fun test(nc: C?): C? + VALUE_PARAMETER value-parameter nc: C? BLOCK_BODY RETURN type=kotlin.Nothing from='test(C?): C?' BLOCK type=C? origin=SAFE_CALL diff --git a/compiler/testData/ir/irText/expressions/coercionToUnit.txt b/compiler/testData/ir/irText/expressions/coercionToUnit.txt index f0c65f576a8..fb7cd5db2a6 100644 --- a/compiler/testData/ir/irText/expressions/coercionToUnit.txt +++ b/compiler/testData/ir/irText/expressions/coercionToUnit.txt @@ -14,6 +14,7 @@ FILE /coercionToUnit.kt RETURN type=kotlin.Nothing from='(): () -> Unit' GET_FIELD 'test1: () -> Unit' type=() -> kotlin.Unit origin=null FUN public fun test2(mc: kotlin.collections.MutableCollection): kotlin.Unit + VALUE_PARAMETER value-parameter mc: kotlin.collections.MutableCollection BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit CALL 'add(String): Boolean' type=kotlin.Boolean origin=null diff --git a/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.txt b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.txt index fc73b4e5291..67e236019a4 100644 --- a/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.txt +++ b/compiler/testData/ir/irText/expressions/complexAugmentedAssignment.txt @@ -9,11 +9,14 @@ FILE /complexAugmentedAssignment.kt EXPRESSION_BODY CONST Int type=kotlin.Int value='0' FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x1: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=X1 origin=null FUN DEFAULT_PROPERTY_ACCESSOR public final fun (: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter : kotlin.Int BLOCK_BODY SET_FIELD 'x1: Int' type=kotlin.Unit origin=null receiver: GET_VAR '' type=X1 origin=null @@ -28,11 +31,14 @@ FILE /complexAugmentedAssignment.kt EXPRESSION_BODY CONST Int type=kotlin.Int value='0' FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x2: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=X1.X2 origin=null FUN DEFAULT_PROPERTY_ACCESSOR public final fun (: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter : kotlin.Int BLOCK_BODY SET_FIELD 'x2: Int' type=kotlin.Unit origin=null receiver: GET_VAR '' type=X1.X2 origin=null @@ -47,16 +53,20 @@ FILE /complexAugmentedAssignment.kt EXPRESSION_BODY CONST Int type=kotlin.Int value='0' FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x3: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=X1.X2.X3 origin=null FUN DEFAULT_PROPERTY_ACCESSOR public final fun (: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter : kotlin.Int BLOCK_BODY SET_FIELD 'x3: Int' type=kotlin.Unit origin=null receiver: GET_VAR '' type=X1.X2.X3 origin=null value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null FUN public fun test1(a: kotlin.IntArray): kotlin.Unit + VALUE_PARAMETER value-parameter a: kotlin.IntArray BLOCK_BODY VAR var i: kotlin.Int CONST Int type=kotlin.Int value='0' @@ -125,8 +135,9 @@ FILE /complexAugmentedAssignment.kt GET_VAR 'tmp5: Int' type=kotlin.Int origin=null CLASS CLASS B CONSTRUCTOR public constructor B(s: kotlin.Int = ...) - s: EXPRESSION_BODY - CONST Int type=kotlin.Int value='0' + VALUE_PARAMETER value-parameter s: kotlin.Int = ... + EXPRESSION_BODY + CONST Int type=kotlin.Int value='0' BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='B' @@ -135,11 +146,14 @@ FILE /complexAugmentedAssignment.kt EXPRESSION_BODY GET_VAR 'value-parameter s: Int = ...' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 's: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=B origin=null FUN DEFAULT_PROPERTY_ACCESSOR public final fun (: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter : kotlin.Int BLOCK_BODY SET_FIELD 's: Int' type=kotlin.Unit origin=null receiver: GET_VAR '' type=B origin=null @@ -150,6 +164,9 @@ FILE /complexAugmentedAssignment.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Host' FUN public final operator fun B.plusAssign(b: B): kotlin.Unit + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter b: B BLOCK_BODY BLOCK type=kotlin.Unit origin=PLUSEQ VAR IR_TEMPORARY_VARIABLE val tmp0_this: B @@ -162,6 +179,8 @@ FILE /complexAugmentedAssignment.kt other: CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY $this: GET_VAR 'value-parameter b: B' type=B origin=null FUN public fun Host.test3(v: B): kotlin.Unit + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter v: B BLOCK_BODY CALL 'plusAssign(B) on B: Unit' type=kotlin.Unit origin=PLUSEQ $this: GET_VAR '' type=Host origin=null diff --git a/compiler/testData/ir/irText/expressions/conventionComparisons.txt b/compiler/testData/ir/irText/expressions/conventionComparisons.txt index 1d6a43e2235..c25016cbcd5 100644 --- a/compiler/testData/ir/irText/expressions/conventionComparisons.txt +++ b/compiler/testData/ir/irText/expressions/conventionComparisons.txt @@ -2,7 +2,13 @@ FILE /conventionComparisons.kt CLASS INTERFACE IA CLASS INTERFACE IB FUN public abstract operator fun IA.compareTo(other: IA): kotlin.Int + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter other: IA FUN public fun IB.test1(a1: IA, a2: IA): kotlin.Boolean + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter a1: IA + VALUE_PARAMETER value-parameter a2: IA BLOCK_BODY RETURN type=kotlin.Nothing from='test1(IA, IA) on IB: Boolean' CALL 'GT0(Int): Boolean' type=kotlin.Boolean origin=GT @@ -11,6 +17,9 @@ FILE /conventionComparisons.kt $receiver: GET_VAR 'value-parameter a1: IA' type=IA origin=null other: GET_VAR 'value-parameter a2: IA' type=IA origin=null FUN public fun IB.test2(a1: IA, a2: IA): kotlin.Boolean + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter a1: IA + VALUE_PARAMETER value-parameter a2: IA BLOCK_BODY RETURN type=kotlin.Nothing from='test2(IA, IA) on IB: Boolean' CALL 'GTEQ0(Int): Boolean' type=kotlin.Boolean origin=GTEQ @@ -19,6 +28,9 @@ FILE /conventionComparisons.kt $receiver: GET_VAR 'value-parameter a1: IA' type=IA origin=null other: GET_VAR 'value-parameter a2: IA' type=IA origin=null FUN public fun IB.test3(a1: IA, a2: IA): kotlin.Boolean + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter a1: IA + VALUE_PARAMETER value-parameter a2: IA BLOCK_BODY RETURN type=kotlin.Nothing from='test3(IA, IA) on IB: Boolean' CALL 'LT0(Int): Boolean' type=kotlin.Boolean origin=LT @@ -27,6 +39,9 @@ FILE /conventionComparisons.kt $receiver: GET_VAR 'value-parameter a1: IA' type=IA origin=null other: GET_VAR 'value-parameter a2: IA' type=IA origin=null FUN public fun IB.test4(a1: IA, a2: IA): kotlin.Boolean + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter a1: IA + VALUE_PARAMETER value-parameter a2: IA BLOCK_BODY RETURN type=kotlin.Nothing from='test4(IA, IA) on IB: Boolean' CALL 'LTEQ0(Int): Boolean' type=kotlin.Boolean origin=LTEQ diff --git a/compiler/testData/ir/irText/expressions/destructuring1.txt b/compiler/testData/ir/irText/expressions/destructuring1.txt index d198ab574ef..30919374b96 100644 --- a/compiler/testData/ir/irText/expressions/destructuring1.txt +++ b/compiler/testData/ir/irText/expressions/destructuring1.txt @@ -10,14 +10,19 @@ FILE /destructuring1.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='B' FUN public final operator fun A.component1(): kotlin.Int + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='component1() on A: Int' CONST Int type=kotlin.Int value='1' FUN public final operator fun A.component2(): kotlin.Int + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='component2() on A: Int' CONST Int type=kotlin.Int value='2' FUN public fun B.test(): kotlin.Unit + $receiver: VALUE_PARAMETER BLOCK_BODY COMPOSITE type=kotlin.Unit origin=DESTRUCTURING_DECLARATION VAR IR_TEMPORARY_VARIABLE val tmp0_container: A diff --git a/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.txt b/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.txt index af7780dfa4a..76bdbe6ae0c 100644 --- a/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.txt +++ b/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.txt @@ -10,18 +10,25 @@ FILE /destructuringWithUnderscore.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='B' FUN public final operator fun A.component1(): kotlin.Int + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='component1() on A: Int' CONST Int type=kotlin.Int value='1' FUN public final operator fun A.component2(): kotlin.Int + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='component2() on A: Int' CONST Int type=kotlin.Int value='2' FUN public final operator fun A.component3(): kotlin.Int + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='component3() on A: Int' CONST Int type=kotlin.Int value='3' FUN public fun B.test(): kotlin.Unit + $receiver: VALUE_PARAMETER BLOCK_BODY COMPOSITE type=kotlin.Unit origin=DESTRUCTURING_DECLARATION VAR IR_TEMPORARY_VARIABLE val tmp0_container: A diff --git a/compiler/testData/ir/irText/expressions/dotQualified.txt b/compiler/testData/ir/irText/expressions/dotQualified.txt index cc1016f8b66..e3d000709b0 100644 --- a/compiler/testData/ir/irText/expressions/dotQualified.txt +++ b/compiler/testData/ir/irText/expressions/dotQualified.txt @@ -1,10 +1,12 @@ FILE /dotQualified.kt FUN public fun length(s: kotlin.String): kotlin.Int + VALUE_PARAMETER value-parameter s: kotlin.String BLOCK_BODY RETURN type=kotlin.Nothing from='length(String): Int' CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY $this: GET_VAR 'value-parameter s: String' type=kotlin.String origin=null FUN public fun lengthN(s: kotlin.String?): kotlin.Int? + VALUE_PARAMETER value-parameter s: kotlin.String? BLOCK_BODY RETURN type=kotlin.Nothing from='lengthN(String?): Int?' BLOCK type=kotlin.Int? origin=SAFE_CALL diff --git a/compiler/testData/ir/irText/expressions/elvis.txt b/compiler/testData/ir/irText/expressions/elvis.txt index f72c3ea6741..b1c43d1e48a 100644 --- a/compiler/testData/ir/irText/expressions/elvis.txt +++ b/compiler/testData/ir/irText/expressions/elvis.txt @@ -12,6 +12,8 @@ FILE /elvis.kt RETURN type=kotlin.Nothing from='foo(): Any?' CONST Null type=kotlin.Nothing? value='null' FUN public fun test1(a: kotlin.Any?, b: kotlin.Any): kotlin.Any + VALUE_PARAMETER value-parameter a: kotlin.Any? + VALUE_PARAMETER value-parameter b: kotlin.Any BLOCK_BODY RETURN type=kotlin.Nothing from='test1(Any?, Any): Any' BLOCK type=kotlin.Any origin=ELVIS @@ -27,6 +29,8 @@ FILE /elvis.kt if: CONST Boolean type=kotlin.Boolean value='true' then: GET_VAR 'tmp0_elvis_lhs: Any?' type=kotlin.Any? origin=null FUN public fun test2(a: kotlin.String?, b: kotlin.Any): kotlin.Any + VALUE_PARAMETER value-parameter a: kotlin.String? + VALUE_PARAMETER value-parameter b: kotlin.Any BLOCK_BODY RETURN type=kotlin.Nothing from='test2(String?, Any): Any' BLOCK type=kotlin.Any origin=ELVIS @@ -42,6 +46,8 @@ FILE /elvis.kt if: CONST Boolean type=kotlin.Boolean value='true' then: GET_VAR 'tmp0_elvis_lhs: String?' type=kotlin.String? origin=null FUN public fun test3(a: kotlin.Any?, b: kotlin.Any?): kotlin.String + VALUE_PARAMETER value-parameter a: kotlin.Any? + VALUE_PARAMETER value-parameter b: kotlin.Any? BLOCK_BODY WHEN type=kotlin.Unit origin=null BRANCH @@ -71,6 +77,7 @@ FILE /elvis.kt then: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String GET_VAR 'tmp0_elvis_lhs: Any?' type=kotlin.Any? origin=null FUN public fun test4(x: kotlin.Any): kotlin.Any + VALUE_PARAMETER value-parameter x: kotlin.Any BLOCK_BODY RETURN type=kotlin.Nothing from='test4(Any): Any' BLOCK type=kotlin.Any origin=ELVIS @@ -86,6 +93,7 @@ FILE /elvis.kt if: CONST Boolean type=kotlin.Boolean value='true' then: GET_VAR 'tmp0_elvis_lhs: Any?' type=kotlin.Any? origin=null FUN public fun test5(x: kotlin.Any): kotlin.Any + VALUE_PARAMETER value-parameter x: kotlin.Any BLOCK_BODY RETURN type=kotlin.Nothing from='test5(Any): Any' BLOCK type=kotlin.Any origin=ELVIS diff --git a/compiler/testData/ir/irText/expressions/equality.txt b/compiler/testData/ir/irText/expressions/equality.txt index 2f9859f049a..da2ee6adcc8 100644 --- a/compiler/testData/ir/irText/expressions/equality.txt +++ b/compiler/testData/ir/irText/expressions/equality.txt @@ -1,11 +1,15 @@ FILE /equality.kt FUN public fun test1(a: kotlin.Int, b: kotlin.Int): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Int + VALUE_PARAMETER value-parameter b: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='test1(Int, Int): Boolean' CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'value-parameter a: Int' type=kotlin.Int origin=null arg1: GET_VAR 'value-parameter b: Int' type=kotlin.Int origin=null FUN public fun test2(a: kotlin.Int, b: kotlin.Int): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Int + VALUE_PARAMETER value-parameter b: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='test2(Int, Int): Boolean' CALL 'NOT(Boolean): Boolean' type=kotlin.Boolean origin=EXCLEQ @@ -13,6 +17,8 @@ FILE /equality.kt arg0: GET_VAR 'value-parameter a: Int' type=kotlin.Int origin=null arg1: GET_VAR 'value-parameter b: Int' type=kotlin.Int origin=null FUN public fun test3(a: kotlin.Any?, b: kotlin.Any?): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Any? + VALUE_PARAMETER value-parameter b: kotlin.Any? BLOCK_BODY RETURN type=kotlin.Nothing from='test3(Any?, Any?): Boolean' CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ diff --git a/compiler/testData/ir/irText/expressions/extensionPropertyGetterCall.txt b/compiler/testData/ir/irText/expressions/extensionPropertyGetterCall.txt index 62be9045e78..cb641fef80d 100644 --- a/compiler/testData/ir/irText/expressions/extensionPropertyGetterCall.txt +++ b/compiler/testData/ir/irText/expressions/extensionPropertyGetterCall.txt @@ -1,10 +1,12 @@ FILE /extensionPropertyGetterCall.kt PROPERTY public val kotlin.String.okext: kotlin.String FUN public fun kotlin.String.(): kotlin.String + $receiver: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='() on String: String' CONST String type=kotlin.String value='OK' FUN public fun kotlin.String.test5(): kotlin.String + $receiver: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='test5() on String: String' CALL '() on String: String' type=kotlin.String origin=GET_PROPERTY diff --git a/compiler/testData/ir/irText/expressions/field.txt b/compiler/testData/ir/irText/expressions/field.txt index c9d9628147a..0293dab1e1e 100644 --- a/compiler/testData/ir/irText/expressions/field.txt +++ b/compiler/testData/ir/irText/expressions/field.txt @@ -8,6 +8,7 @@ FILE /field.kt RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'testSimple: Int' type=kotlin.Int origin=null FUN public fun (value: kotlin.Int): kotlin.Unit + VALUE_PARAMETER value-parameter value: kotlin.Int BLOCK_BODY SET_FIELD 'testSimple: Int' type=kotlin.Unit origin=EQ value: GET_VAR 'value-parameter value: Int' type=kotlin.Int origin=null @@ -20,6 +21,7 @@ FILE /field.kt RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'testAugmented: Int' type=kotlin.Int origin=null FUN public fun (value: kotlin.Int): kotlin.Unit + VALUE_PARAMETER value-parameter value: kotlin.Int BLOCK_BODY SET_FIELD 'testAugmented: Int' type=kotlin.Unit origin=PLUSEQ value: CALL 'plus(Int): Int' type=kotlin.Int origin=PLUSEQ diff --git a/compiler/testData/ir/irText/expressions/for.txt b/compiler/testData/ir/irText/expressions/for.txt index 335bc57312a..c66440bc126 100644 --- a/compiler/testData/ir/irText/expressions/for.txt +++ b/compiler/testData/ir/irText/expressions/for.txt @@ -1,5 +1,6 @@ FILE /for.kt FUN public fun testEmpty(ss: kotlin.collections.List): kotlin.Unit + VALUE_PARAMETER value-parameter ss: kotlin.collections.List BLOCK_BODY BLOCK type=kotlin.Unit origin=FOR_LOOP VAR IR_TEMPORARY_VARIABLE val tmp0_iterator: kotlin.collections.Iterator @@ -13,6 +14,7 @@ FILE /for.kt CALL 'next(): String' type=kotlin.String origin=FOR_LOOP_NEXT $this: GET_VAR 'tmp0_iterator: Iterator' type=kotlin.collections.Iterator origin=null FUN public fun testIterable(ss: kotlin.collections.List): kotlin.Unit + VALUE_PARAMETER value-parameter ss: kotlin.collections.List BLOCK_BODY BLOCK type=kotlin.Unit origin=FOR_LOOP VAR IR_TEMPORARY_VARIABLE val tmp0_iterator: kotlin.collections.Iterator @@ -29,6 +31,7 @@ FILE /for.kt CALL 'println(Any?): Unit' type=kotlin.Unit origin=null message: GET_VAR 's: String' type=kotlin.String origin=null FUN public fun testDestructuring(pp: kotlin.collections.List>): kotlin.Unit + VALUE_PARAMETER value-parameter pp: kotlin.collections.List> BLOCK_BODY BLOCK type=kotlin.Unit origin=FOR_LOOP VAR IR_TEMPORARY_VARIABLE val tmp0_iterator: kotlin.collections.Iterator> diff --git a/compiler/testData/ir/irText/expressions/forWithBreakContinue.txt b/compiler/testData/ir/irText/expressions/forWithBreakContinue.txt index 9371b7ebad6..328b16ca13f 100644 --- a/compiler/testData/ir/irText/expressions/forWithBreakContinue.txt +++ b/compiler/testData/ir/irText/expressions/forWithBreakContinue.txt @@ -1,5 +1,6 @@ FILE /forWithBreakContinue.kt FUN public fun testForBreak1(ss: kotlin.collections.List): kotlin.Unit + VALUE_PARAMETER value-parameter ss: kotlin.collections.List BLOCK_BODY BLOCK type=kotlin.Unit origin=FOR_LOOP VAR IR_TEMPORARY_VARIABLE val tmp0_iterator: kotlin.collections.Iterator @@ -15,6 +16,7 @@ FILE /forWithBreakContinue.kt BLOCK type=kotlin.Nothing origin=null BREAK label=null loop.label=null FUN public fun testForBreak2(ss: kotlin.collections.List): kotlin.Unit + VALUE_PARAMETER value-parameter ss: kotlin.collections.List BLOCK_BODY BLOCK type=kotlin.Unit origin=FOR_LOOP VAR IR_TEMPORARY_VARIABLE val tmp0_iterator: kotlin.collections.Iterator @@ -45,6 +47,7 @@ FILE /forWithBreakContinue.kt BREAK label=null loop.label=INNER BREAK label=OUTER loop.label=OUTER FUN public fun testForContinue1(ss: kotlin.collections.List): kotlin.Unit + VALUE_PARAMETER value-parameter ss: kotlin.collections.List BLOCK_BODY BLOCK type=kotlin.Unit origin=FOR_LOOP VAR IR_TEMPORARY_VARIABLE val tmp0_iterator: kotlin.collections.Iterator @@ -60,6 +63,7 @@ FILE /forWithBreakContinue.kt BLOCK type=kotlin.Nothing origin=null CONTINUE label=null loop.label=null FUN public fun testForContinue2(ss: kotlin.collections.List): kotlin.Unit + VALUE_PARAMETER value-parameter ss: kotlin.collections.List BLOCK_BODY BLOCK type=kotlin.Unit origin=FOR_LOOP VAR IR_TEMPORARY_VARIABLE val tmp0_iterator: kotlin.collections.Iterator diff --git a/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.txt b/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.txt index 1d64e755c08..ba59479ec68 100644 --- a/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.txt +++ b/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.txt @@ -6,6 +6,7 @@ FILE /forWithImplicitReceivers.kt INSTANCE_INITIALIZER_CALL classDescriptor='FiveTimes' CLASS CLASS IntCell CONSTRUCTOR public constructor IntCell(value: kotlin.Int) + VALUE_PARAMETER value-parameter value: kotlin.Int BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='IntCell' @@ -14,22 +15,29 @@ FILE /forWithImplicitReceivers.kt EXPRESSION_BODY GET_VAR 'value-parameter value: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'value: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=IntCell origin=null FUN DEFAULT_PROPERTY_ACCESSOR public final fun (: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter : kotlin.Int BLOCK_BODY SET_FIELD 'value: Int' type=kotlin.Unit origin=null receiver: GET_VAR '' type=IntCell origin=null value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null CLASS INTERFACE IReceiver FUN public open operator fun FiveTimes.iterator(): IntCell + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='iterator() on FiveTimes: IntCell' CALL 'constructor IntCell(Int)' type=IntCell origin=null value: CONST Int type=kotlin.Int value='5' FUN public open operator fun IntCell.hasNext(): kotlin.Boolean + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='hasNext() on IntCell: Boolean' CALL 'GT0(Int): Boolean' type=kotlin.Boolean origin=GT @@ -38,6 +46,8 @@ FILE /forWithImplicitReceivers.kt $this: GET_VAR '' type=IntCell origin=null other: CONST Int type=kotlin.Int value='0' FUN public open operator fun IntCell.next(): kotlin.Int + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='next() on IntCell: Int' BLOCK type=kotlin.Int origin=POSTFIX_DECR @@ -53,6 +63,7 @@ FILE /forWithImplicitReceivers.kt $this: GET_VAR 'tmp1: Int' type=kotlin.Int origin=null GET_VAR 'tmp1: Int' type=kotlin.Int origin=null FUN public fun IReceiver.test(): kotlin.Unit + $receiver: VALUE_PARAMETER BLOCK_BODY BLOCK type=kotlin.Unit origin=FOR_LOOP VAR IR_TEMPORARY_VARIABLE val tmp0_iterator: IntCell diff --git a/compiler/testData/ir/irText/expressions/identity.txt b/compiler/testData/ir/irText/expressions/identity.txt index cd691db4138..9781b2a7126 100644 --- a/compiler/testData/ir/irText/expressions/identity.txt +++ b/compiler/testData/ir/irText/expressions/identity.txt @@ -1,11 +1,15 @@ FILE /identity.kt FUN public fun test1(a: kotlin.Int, b: kotlin.Int): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Int + VALUE_PARAMETER value-parameter b: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='test1(Int, Int): Boolean' CALL 'EQEQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQEQ arg0: GET_VAR 'value-parameter a: Int' type=kotlin.Int origin=null arg1: GET_VAR 'value-parameter b: Int' type=kotlin.Int origin=null FUN public fun test2(a: kotlin.Int, b: kotlin.Int): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Int + VALUE_PARAMETER value-parameter b: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='test2(Int, Int): Boolean' CALL 'NOT(Boolean): Boolean' type=kotlin.Boolean origin=EXCLEQEQ @@ -13,6 +17,8 @@ FILE /identity.kt arg0: GET_VAR 'value-parameter a: Int' type=kotlin.Int origin=null arg1: GET_VAR 'value-parameter b: Int' type=kotlin.Int origin=null FUN public fun test3(a: kotlin.Any?, b: kotlin.Any?): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Any? + VALUE_PARAMETER value-parameter b: kotlin.Any? BLOCK_BODY RETURN type=kotlin.Nothing from='test3(Any?, Any?): Boolean' CALL 'EQEQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQEQ diff --git a/compiler/testData/ir/irText/expressions/ifElseIf.txt b/compiler/testData/ir/irText/expressions/ifElseIf.txt index 6a9ab55a400..d835543dc96 100644 --- a/compiler/testData/ir/irText/expressions/ifElseIf.txt +++ b/compiler/testData/ir/irText/expressions/ifElseIf.txt @@ -1,5 +1,6 @@ FILE /ifElseIf.kt FUN public fun test(i: kotlin.Int): kotlin.Int + VALUE_PARAMETER value-parameter i: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='test(Int): Int' WHEN type=kotlin.Int origin=WHEN diff --git a/compiler/testData/ir/irText/expressions/in.txt b/compiler/testData/ir/irText/expressions/in.txt index 7df900e9e88..cf80f536b8b 100644 --- a/compiler/testData/ir/irText/expressions/in.txt +++ b/compiler/testData/ir/irText/expressions/in.txt @@ -1,11 +1,15 @@ FILE /in.kt FUN public fun test1(a: kotlin.Any, x: kotlin.collections.Collection): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Any + VALUE_PARAMETER value-parameter x: kotlin.collections.Collection BLOCK_BODY RETURN type=kotlin.Nothing from='test1(Any, Collection): Boolean' CALL 'contains(Any): Boolean' type=kotlin.Boolean origin=IN $this: GET_VAR 'value-parameter x: Collection' type=kotlin.collections.Collection origin=null element: GET_VAR 'value-parameter a: Any' type=kotlin.Any origin=null FUN public fun test2(a: kotlin.Any, x: kotlin.collections.Collection): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Any + VALUE_PARAMETER value-parameter x: kotlin.collections.Collection BLOCK_BODY RETURN type=kotlin.Nothing from='test2(Any, Collection): Boolean' CALL 'NOT(Boolean): Boolean' type=kotlin.Boolean origin=NOT_IN @@ -13,12 +17,18 @@ FILE /in.kt $this: GET_VAR 'value-parameter x: Collection' type=kotlin.collections.Collection origin=null element: GET_VAR 'value-parameter a: Any' type=kotlin.Any origin=null FUN public fun test3(a: T, x: kotlin.collections.Collection): kotlin.Boolean + TYPE_PARAMETER + VALUE_PARAMETER value-parameter a: T + VALUE_PARAMETER value-parameter x: kotlin.collections.Collection BLOCK_BODY RETURN type=kotlin.Nothing from='test3(T, Collection): Boolean' CALL 'contains(T): Boolean' type=kotlin.Boolean origin=IN $this: GET_VAR 'value-parameter x: Collection' type=kotlin.collections.Collection origin=null element: GET_VAR 'value-parameter a: T' type=T origin=null FUN public fun test4(a: T, x: kotlin.collections.Collection): kotlin.Boolean + TYPE_PARAMETER + VALUE_PARAMETER value-parameter a: T + VALUE_PARAMETER value-parameter x: kotlin.collections.Collection BLOCK_BODY RETURN type=kotlin.Nothing from='test4(T, Collection): Boolean' CALL 'NOT(Boolean): Boolean' type=kotlin.Boolean origin=NOT_IN diff --git a/compiler/testData/ir/irText/expressions/incrementDecrement.txt b/compiler/testData/ir/irText/expressions/incrementDecrement.txt index 0f03c9dfff0..967727da6ab 100644 --- a/compiler/testData/ir/irText/expressions/incrementDecrement.txt +++ b/compiler/testData/ir/irText/expressions/incrementDecrement.txt @@ -8,6 +8,7 @@ FILE /incrementDecrement.kt RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'p: Int' type=kotlin.Int origin=null FUN DEFAULT_PROPERTY_ACCESSOR public fun (: kotlin.Int): kotlin.Unit + VALUE_PARAMETER value-parameter : kotlin.Int BLOCK_BODY SET_FIELD 'p: Int' type=kotlin.Unit origin=null value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.txt b/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.txt index 6ca8296bd08..e066fbfe0cf 100644 --- a/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.txt +++ b/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.txt @@ -10,11 +10,14 @@ FILE /Derived.kt receiver: GET_VAR '' type=Derived origin=null value: CONST Int type=kotlin.Int value='0' FUN public final fun getValue(): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='getValue(): Int' GET_FIELD 'value: Int' type=kotlin.Int origin=GET_PROPERTY receiver: GET_VAR '' type=Derived origin=null FUN public final fun setValue(value: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter value: kotlin.Int BLOCK_BODY SET_FIELD 'value: Int' type=kotlin.Unit origin=EQ receiver: GET_VAR '' type=Derived origin=null diff --git a/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.txt b/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.txt index 53d7f68bb51..cd71df883f1 100644 --- a/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.txt +++ b/compiler/testData/ir/irText/expressions/jvmStaticFieldReference.txt @@ -15,6 +15,7 @@ FILE /jvmStaticFieldReference.kt RETURN type=kotlin.Nothing from='(): Any' CONST Int type=kotlin.Int value='42' FUN public fun (value: kotlin.Any): kotlin.Unit + VALUE_PARAMETER value-parameter value: kotlin.Any BLOCK_BODY CALL 'println(String!): Unit' type=kotlin.Unit origin=null $this: TYPE_OP type=java.io.PrintStream origin=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream @@ -38,6 +39,7 @@ FILE /jvmStaticFieldReference.kt p0: CONST String type=kotlin.String value='TestClass/test' CONST Int type=kotlin.Int value='42' FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'test: Int' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/expressions/membersImportedFromObject.txt b/compiler/testData/ir/irText/expressions/membersImportedFromObject.txt index 2b5108d989c..8f37c291d39 100644 --- a/compiler/testData/ir/irText/expressions/membersImportedFromObject.txt +++ b/compiler/testData/ir/irText/expressions/membersImportedFromObject.txt @@ -5,10 +5,13 @@ FILE /membersImportedFromObject.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='A' FUN public final fun foo(): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='foo(): Int' CONST Int type=kotlin.Int value='1' FUN public final fun kotlin.Int.fooExt(): kotlin.Int + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='fooExt() on Int: Int' CONST Int type=kotlin.Int value='2' @@ -17,12 +20,15 @@ FILE /membersImportedFromObject.kt EXPRESSION_BODY CONST Int type=kotlin.Int value='42' FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'bar: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=A origin=null PROPERTY public final val kotlin.Int.barExt: kotlin.Int FUN public final fun kotlin.Int.(): kotlin.Int + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='() on Int: Int' CONST Int type=kotlin.Int value='43' diff --git a/compiler/testData/ir/irText/expressions/objectAsCallable.txt b/compiler/testData/ir/irText/expressions/objectAsCallable.txt index 148dba68b1f..3db13ccf9f9 100644 --- a/compiler/testData/ir/irText/expressions/objectAsCallable.txt +++ b/compiler/testData/ir/irText/expressions/objectAsCallable.txt @@ -16,10 +16,14 @@ FILE /objectAsCallable.kt FUN ENUM_CLASS_SPECIAL_MEMBER public final fun valueOf(value: kotlin.String): En SYNTHETIC_BODY kind=ENUM_VALUEOF FUN public operator fun A.invoke(i: kotlin.Int): kotlin.Int + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter i: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='invoke(Int) on A: Int' GET_VAR 'value-parameter i: Int' type=kotlin.Int origin=null FUN public operator fun En.invoke(i: kotlin.Int): kotlin.Int + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter i: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='invoke(Int) on En: Int' GET_VAR 'value-parameter i: Int' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/expressions/primitiveComparisons.txt b/compiler/testData/ir/irText/expressions/primitiveComparisons.txt index c4234cd0fd6..2cbe232d197 100644 --- a/compiler/testData/ir/irText/expressions/primitiveComparisons.txt +++ b/compiler/testData/ir/irText/expressions/primitiveComparisons.txt @@ -1,5 +1,7 @@ FILE /primitiveComparisons.kt FUN public fun btest1(a: kotlin.Byte, b: kotlin.Byte): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Byte + VALUE_PARAMETER value-parameter b: kotlin.Byte BLOCK_BODY RETURN type=kotlin.Nothing from='btest1(Byte, Byte): Boolean' CALL 'GT0(Int): Boolean' type=kotlin.Boolean origin=GT @@ -7,6 +9,8 @@ FILE /primitiveComparisons.kt $this: GET_VAR 'value-parameter a: Byte' type=kotlin.Byte origin=null other: GET_VAR 'value-parameter b: Byte' type=kotlin.Byte origin=null FUN public fun btest2(a: kotlin.Byte, b: kotlin.Byte): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Byte + VALUE_PARAMETER value-parameter b: kotlin.Byte BLOCK_BODY RETURN type=kotlin.Nothing from='btest2(Byte, Byte): Boolean' CALL 'LT0(Int): Boolean' type=kotlin.Boolean origin=LT @@ -14,6 +18,8 @@ FILE /primitiveComparisons.kt $this: GET_VAR 'value-parameter a: Byte' type=kotlin.Byte origin=null other: GET_VAR 'value-parameter b: Byte' type=kotlin.Byte origin=null FUN public fun btest3(a: kotlin.Byte, b: kotlin.Byte): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Byte + VALUE_PARAMETER value-parameter b: kotlin.Byte BLOCK_BODY RETURN type=kotlin.Nothing from='btest3(Byte, Byte): Boolean' CALL 'GTEQ0(Int): Boolean' type=kotlin.Boolean origin=GTEQ @@ -21,6 +27,8 @@ FILE /primitiveComparisons.kt $this: GET_VAR 'value-parameter a: Byte' type=kotlin.Byte origin=null other: GET_VAR 'value-parameter b: Byte' type=kotlin.Byte origin=null FUN public fun btest4(a: kotlin.Byte, b: kotlin.Byte): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Byte + VALUE_PARAMETER value-parameter b: kotlin.Byte BLOCK_BODY RETURN type=kotlin.Nothing from='btest4(Byte, Byte): Boolean' CALL 'LTEQ0(Int): Boolean' type=kotlin.Boolean origin=LTEQ @@ -28,6 +36,8 @@ FILE /primitiveComparisons.kt $this: GET_VAR 'value-parameter a: Byte' type=kotlin.Byte origin=null other: GET_VAR 'value-parameter b: Byte' type=kotlin.Byte origin=null FUN public fun stest1(a: kotlin.Short, b: kotlin.Short): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Short + VALUE_PARAMETER value-parameter b: kotlin.Short BLOCK_BODY RETURN type=kotlin.Nothing from='stest1(Short, Short): Boolean' CALL 'GT0(Int): Boolean' type=kotlin.Boolean origin=GT @@ -35,6 +45,8 @@ FILE /primitiveComparisons.kt $this: GET_VAR 'value-parameter a: Short' type=kotlin.Short origin=null other: GET_VAR 'value-parameter b: Short' type=kotlin.Short origin=null FUN public fun stest2(a: kotlin.Short, b: kotlin.Short): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Short + VALUE_PARAMETER value-parameter b: kotlin.Short BLOCK_BODY RETURN type=kotlin.Nothing from='stest2(Short, Short): Boolean' CALL 'LT0(Int): Boolean' type=kotlin.Boolean origin=LT @@ -42,6 +54,8 @@ FILE /primitiveComparisons.kt $this: GET_VAR 'value-parameter a: Short' type=kotlin.Short origin=null other: GET_VAR 'value-parameter b: Short' type=kotlin.Short origin=null FUN public fun stest3(a: kotlin.Short, b: kotlin.Short): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Short + VALUE_PARAMETER value-parameter b: kotlin.Short BLOCK_BODY RETURN type=kotlin.Nothing from='stest3(Short, Short): Boolean' CALL 'GTEQ0(Int): Boolean' type=kotlin.Boolean origin=GTEQ @@ -49,6 +63,8 @@ FILE /primitiveComparisons.kt $this: GET_VAR 'value-parameter a: Short' type=kotlin.Short origin=null other: GET_VAR 'value-parameter b: Short' type=kotlin.Short origin=null FUN public fun stest4(a: kotlin.Short, b: kotlin.Short): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Short + VALUE_PARAMETER value-parameter b: kotlin.Short BLOCK_BODY RETURN type=kotlin.Nothing from='stest4(Short, Short): Boolean' CALL 'LTEQ0(Int): Boolean' type=kotlin.Boolean origin=LTEQ @@ -56,6 +72,8 @@ FILE /primitiveComparisons.kt $this: GET_VAR 'value-parameter a: Short' type=kotlin.Short origin=null other: GET_VAR 'value-parameter b: Short' type=kotlin.Short origin=null FUN public fun itest1(a: kotlin.Int, b: kotlin.Int): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Int + VALUE_PARAMETER value-parameter b: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='itest1(Int, Int): Boolean' CALL 'GT0(Int): Boolean' type=kotlin.Boolean origin=GT @@ -63,6 +81,8 @@ FILE /primitiveComparisons.kt $this: GET_VAR 'value-parameter a: Int' type=kotlin.Int origin=null other: GET_VAR 'value-parameter b: Int' type=kotlin.Int origin=null FUN public fun itest2(a: kotlin.Int, b: kotlin.Int): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Int + VALUE_PARAMETER value-parameter b: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='itest2(Int, Int): Boolean' CALL 'LT0(Int): Boolean' type=kotlin.Boolean origin=LT @@ -70,6 +90,8 @@ FILE /primitiveComparisons.kt $this: GET_VAR 'value-parameter a: Int' type=kotlin.Int origin=null other: GET_VAR 'value-parameter b: Int' type=kotlin.Int origin=null FUN public fun itest3(a: kotlin.Int, b: kotlin.Int): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Int + VALUE_PARAMETER value-parameter b: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='itest3(Int, Int): Boolean' CALL 'GTEQ0(Int): Boolean' type=kotlin.Boolean origin=GTEQ @@ -77,6 +99,8 @@ FILE /primitiveComparisons.kt $this: GET_VAR 'value-parameter a: Int' type=kotlin.Int origin=null other: GET_VAR 'value-parameter b: Int' type=kotlin.Int origin=null FUN public fun itest4(a: kotlin.Int, b: kotlin.Int): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Int + VALUE_PARAMETER value-parameter b: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='itest4(Int, Int): Boolean' CALL 'LTEQ0(Int): Boolean' type=kotlin.Boolean origin=LTEQ @@ -84,6 +108,8 @@ FILE /primitiveComparisons.kt $this: GET_VAR 'value-parameter a: Int' type=kotlin.Int origin=null other: GET_VAR 'value-parameter b: Int' type=kotlin.Int origin=null FUN public fun ltest1(a: kotlin.Long, b: kotlin.Long): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Long + VALUE_PARAMETER value-parameter b: kotlin.Long BLOCK_BODY RETURN type=kotlin.Nothing from='ltest1(Long, Long): Boolean' CALL 'GT0(Int): Boolean' type=kotlin.Boolean origin=GT @@ -91,6 +117,8 @@ FILE /primitiveComparisons.kt $this: GET_VAR 'value-parameter a: Long' type=kotlin.Long origin=null other: GET_VAR 'value-parameter b: Long' type=kotlin.Long origin=null FUN public fun ltest2(a: kotlin.Long, b: kotlin.Long): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Long + VALUE_PARAMETER value-parameter b: kotlin.Long BLOCK_BODY RETURN type=kotlin.Nothing from='ltest2(Long, Long): Boolean' CALL 'LT0(Int): Boolean' type=kotlin.Boolean origin=LT @@ -98,6 +126,8 @@ FILE /primitiveComparisons.kt $this: GET_VAR 'value-parameter a: Long' type=kotlin.Long origin=null other: GET_VAR 'value-parameter b: Long' type=kotlin.Long origin=null FUN public fun ltest3(a: kotlin.Long, b: kotlin.Long): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Long + VALUE_PARAMETER value-parameter b: kotlin.Long BLOCK_BODY RETURN type=kotlin.Nothing from='ltest3(Long, Long): Boolean' CALL 'GTEQ0(Int): Boolean' type=kotlin.Boolean origin=GTEQ @@ -105,6 +135,8 @@ FILE /primitiveComparisons.kt $this: GET_VAR 'value-parameter a: Long' type=kotlin.Long origin=null other: GET_VAR 'value-parameter b: Long' type=kotlin.Long origin=null FUN public fun ltest4(a: kotlin.Long, b: kotlin.Long): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Long + VALUE_PARAMETER value-parameter b: kotlin.Long BLOCK_BODY RETURN type=kotlin.Nothing from='ltest4(Long, Long): Boolean' CALL 'LTEQ0(Int): Boolean' type=kotlin.Boolean origin=LTEQ @@ -112,6 +144,8 @@ FILE /primitiveComparisons.kt $this: GET_VAR 'value-parameter a: Long' type=kotlin.Long origin=null other: GET_VAR 'value-parameter b: Long' type=kotlin.Long origin=null FUN public fun ftest1(a: kotlin.Float, b: kotlin.Float): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Float + VALUE_PARAMETER value-parameter b: kotlin.Float BLOCK_BODY RETURN type=kotlin.Nothing from='ftest1(Float, Float): Boolean' CALL 'GT0(Int): Boolean' type=kotlin.Boolean origin=GT @@ -119,6 +153,8 @@ FILE /primitiveComparisons.kt $this: GET_VAR 'value-parameter a: Float' type=kotlin.Float origin=null other: GET_VAR 'value-parameter b: Float' type=kotlin.Float origin=null FUN public fun ftest2(a: kotlin.Float, b: kotlin.Float): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Float + VALUE_PARAMETER value-parameter b: kotlin.Float BLOCK_BODY RETURN type=kotlin.Nothing from='ftest2(Float, Float): Boolean' CALL 'LT0(Int): Boolean' type=kotlin.Boolean origin=LT @@ -126,6 +162,8 @@ FILE /primitiveComparisons.kt $this: GET_VAR 'value-parameter a: Float' type=kotlin.Float origin=null other: GET_VAR 'value-parameter b: Float' type=kotlin.Float origin=null FUN public fun ftest3(a: kotlin.Float, b: kotlin.Float): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Float + VALUE_PARAMETER value-parameter b: kotlin.Float BLOCK_BODY RETURN type=kotlin.Nothing from='ftest3(Float, Float): Boolean' CALL 'GTEQ0(Int): Boolean' type=kotlin.Boolean origin=GTEQ @@ -133,6 +171,8 @@ FILE /primitiveComparisons.kt $this: GET_VAR 'value-parameter a: Float' type=kotlin.Float origin=null other: GET_VAR 'value-parameter b: Float' type=kotlin.Float origin=null FUN public fun ftest4(a: kotlin.Float, b: kotlin.Float): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Float + VALUE_PARAMETER value-parameter b: kotlin.Float BLOCK_BODY RETURN type=kotlin.Nothing from='ftest4(Float, Float): Boolean' CALL 'LTEQ0(Int): Boolean' type=kotlin.Boolean origin=LTEQ @@ -140,6 +180,8 @@ FILE /primitiveComparisons.kt $this: GET_VAR 'value-parameter a: Float' type=kotlin.Float origin=null other: GET_VAR 'value-parameter b: Float' type=kotlin.Float origin=null FUN public fun dtest1(a: kotlin.Double, b: kotlin.Double): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Double + VALUE_PARAMETER value-parameter b: kotlin.Double BLOCK_BODY RETURN type=kotlin.Nothing from='dtest1(Double, Double): Boolean' CALL 'GT0(Int): Boolean' type=kotlin.Boolean origin=GT @@ -147,6 +189,8 @@ FILE /primitiveComparisons.kt $this: GET_VAR 'value-parameter a: Double' type=kotlin.Double origin=null other: GET_VAR 'value-parameter b: Double' type=kotlin.Double origin=null FUN public fun dtest2(a: kotlin.Double, b: kotlin.Double): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Double + VALUE_PARAMETER value-parameter b: kotlin.Double BLOCK_BODY RETURN type=kotlin.Nothing from='dtest2(Double, Double): Boolean' CALL 'LT0(Int): Boolean' type=kotlin.Boolean origin=LT @@ -154,6 +198,8 @@ FILE /primitiveComparisons.kt $this: GET_VAR 'value-parameter a: Double' type=kotlin.Double origin=null other: GET_VAR 'value-parameter b: Double' type=kotlin.Double origin=null FUN public fun dtest3(a: kotlin.Double, b: kotlin.Double): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Double + VALUE_PARAMETER value-parameter b: kotlin.Double BLOCK_BODY RETURN type=kotlin.Nothing from='dtest3(Double, Double): Boolean' CALL 'GTEQ0(Int): Boolean' type=kotlin.Boolean origin=GTEQ @@ -161,6 +207,8 @@ FILE /primitiveComparisons.kt $this: GET_VAR 'value-parameter a: Double' type=kotlin.Double origin=null other: GET_VAR 'value-parameter b: Double' type=kotlin.Double origin=null FUN public fun dtest4(a: kotlin.Double, b: kotlin.Double): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.Double + VALUE_PARAMETER value-parameter b: kotlin.Double BLOCK_BODY RETURN type=kotlin.Nothing from='dtest4(Double, Double): Boolean' CALL 'LTEQ0(Int): Boolean' type=kotlin.Boolean origin=LTEQ diff --git a/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.txt b/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.txt index b6ec50e0b0f..f905f0b33ec 100644 --- a/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.txt +++ b/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.txt @@ -76,17 +76,19 @@ FILE /primitivesImplicitConversions.kt CALL 'unaryMinus(): Int' type=kotlin.Int origin=null $this: CONST Int type=kotlin.Int value='1' FUN public fun testImplicitArguments(x: kotlin.Long = ...): kotlin.Unit - x: EXPRESSION_BODY - TYPE_OP type=kotlin.Long origin=IMPLICIT_INTEGER_COERCION typeOperand=kotlin.Long - CALL 'unaryMinus(): Int' type=kotlin.Int origin=null - $this: CONST Int type=kotlin.Int value='1' - BLOCK_BODY - CLASS CLASS TestImplicitArguments - CONSTRUCTOR public constructor TestImplicitArguments(x: kotlin.Long = ...) - x: EXPRESSION_BODY + VALUE_PARAMETER value-parameter x: kotlin.Long = ... + EXPRESSION_BODY TYPE_OP type=kotlin.Long origin=IMPLICIT_INTEGER_COERCION typeOperand=kotlin.Long CALL 'unaryMinus(): Int' type=kotlin.Int origin=null $this: CONST Int type=kotlin.Int value='1' + BLOCK_BODY + CLASS CLASS TestImplicitArguments + CONSTRUCTOR public constructor TestImplicitArguments(x: kotlin.Long = ...) + VALUE_PARAMETER value-parameter x: kotlin.Long = ... + EXPRESSION_BODY + TYPE_OP type=kotlin.Long origin=IMPLICIT_INTEGER_COERCION typeOperand=kotlin.Long + CALL 'unaryMinus(): Int' type=kotlin.Int origin=null + $this: CONST Int type=kotlin.Int value='1' BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='TestImplicitArguments' @@ -95,6 +97,7 @@ FILE /primitivesImplicitConversions.kt EXPRESSION_BODY GET_VAR 'value-parameter x: Long = ...' type=kotlin.Long origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Long + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Long' GET_FIELD 'x: Long' type=kotlin.Long origin=null diff --git a/compiler/testData/ir/irText/expressions/references.txt b/compiler/testData/ir/irText/expressions/references.txt index bf96be2f129..36cf9ffeefb 100644 --- a/compiler/testData/ir/irText/expressions/references.txt +++ b/compiler/testData/ir/irText/expressions/references.txt @@ -25,6 +25,7 @@ FILE /references.kt RETURN type=kotlin.Nothing from='test1(): String' CALL '(): String' type=kotlin.String origin=GET_PROPERTY FUN public fun test2(x: kotlin.String): kotlin.String + VALUE_PARAMETER value-parameter x: kotlin.String BLOCK_BODY RETURN type=kotlin.Nothing from='test2(String): String' GET_VAR 'value-parameter x: String' type=kotlin.String origin=null @@ -40,10 +41,12 @@ FILE /references.kt CALL '(): String' type=kotlin.String origin=GET_PROPERTY PROPERTY public val kotlin.String.okext: kotlin.String FUN public fun kotlin.String.(): kotlin.String + $receiver: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='() on String: String' CONST String type=kotlin.String value='OK' FUN public fun kotlin.String.test5(): kotlin.String + $receiver: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='test5() on String: String' CALL '() on String: String' type=kotlin.String origin=GET_PROPERTY diff --git a/compiler/testData/ir/irText/expressions/reflectionLiterals.txt b/compiler/testData/ir/irText/expressions/reflectionLiterals.txt index 12543c2d4be..b1195750a05 100644 --- a/compiler/testData/ir/irText/expressions/reflectionLiterals.txt +++ b/compiler/testData/ir/irText/expressions/reflectionLiterals.txt @@ -5,6 +5,7 @@ FILE /reflectionLiterals.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='A' FUN public final fun foo(): kotlin.Unit + $this: VALUE_PARAMETER BLOCK_BODY FUN public fun bar(): kotlin.Unit BLOCK_BODY diff --git a/compiler/testData/ir/irText/expressions/safeAssignment.txt b/compiler/testData/ir/irText/expressions/safeAssignment.txt index 8aec87aa003..6a22c7c7477 100644 --- a/compiler/testData/ir/irText/expressions/safeAssignment.txt +++ b/compiler/testData/ir/irText/expressions/safeAssignment.txt @@ -1,6 +1,7 @@ FILE /safeAssignment.kt CLASS CLASS C CONSTRUCTOR public constructor C(x: kotlin.Int) + VALUE_PARAMETER value-parameter x: kotlin.Int BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='C' @@ -9,16 +10,20 @@ FILE /safeAssignment.kt EXPRESSION_BODY GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=C origin=null FUN DEFAULT_PROPERTY_ACCESSOR public final fun (: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter : kotlin.Int BLOCK_BODY SET_FIELD 'x: Int' type=kotlin.Unit origin=null receiver: GET_VAR '' type=C origin=null value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null FUN public fun test(nc: C?): kotlin.Unit + VALUE_PARAMETER value-parameter nc: C? BLOCK_BODY BLOCK type=kotlin.Unit origin=SAFE_CALL VAR IR_TEMPORARY_VARIABLE val tmp0_safe_receiver: C? diff --git a/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.txt b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.txt index a0fd02db78a..f06d2feaa76 100644 --- a/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.txt +++ b/compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.txt @@ -6,12 +6,16 @@ FILE /safeCallWithIncrementDecrement.kt INSTANCE_INITIALIZER_CALL classDescriptor='C' PROPERTY public var test.C?.p: kotlin.Int FUN public fun test.C?.(): kotlin.Int + $receiver: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='() on C?: Int' CONST Int type=kotlin.Int value='42' FUN public fun test.C?.(value: kotlin.Int): kotlin.Unit + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter value: kotlin.Int BLOCK_BODY FUN public operator fun kotlin.Int?.inc(): kotlin.Int? + $receiver: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='inc() on Int?: Int?' BLOCK type=kotlin.Int? origin=SAFE_CALL @@ -28,12 +32,18 @@ FILE /safeCallWithIncrementDecrement.kt then: CALL 'inc(): Int' type=kotlin.Int origin=null $this: GET_VAR 'tmp0_safe_receiver: Int?' type=kotlin.Int? origin=null FUN public operator fun kotlin.Int?.get(index: kotlin.Int): kotlin.Int + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter index: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='get(Int) on Int?: Int' CONST Int type=kotlin.Int value='42' FUN public operator fun kotlin.Int?.set(index: kotlin.Int, value: kotlin.Int): kotlin.Unit + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter index: kotlin.Int + VALUE_PARAMETER value-parameter value: kotlin.Int BLOCK_BODY FUN public fun testProperty(nc: test.C?): kotlin.Unit + VALUE_PARAMETER value-parameter nc: test.C? BLOCK_BODY BLOCK type=kotlin.Unit origin=SAFE_CALL VAR IR_TEMPORARY_VARIABLE val tmp0_safe_receiver: test.C? @@ -61,6 +71,7 @@ FILE /safeCallWithIncrementDecrement.kt $receiver: GET_VAR 'tmp2: Int' type=kotlin.Int origin=null GET_VAR 'tmp2: Int' type=kotlin.Int origin=null FUN public fun testArrayAccess(nc: test.C?): kotlin.Unit + VALUE_PARAMETER value-parameter nc: test.C? BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit BLOCK type=kotlin.Int origin=POSTFIX_INCR diff --git a/compiler/testData/ir/irText/expressions/safeCalls.txt b/compiler/testData/ir/irText/expressions/safeCalls.txt index 4c6b538678c..4d8d1f55f02 100644 --- a/compiler/testData/ir/irText/expressions/safeCalls.txt +++ b/compiler/testData/ir/irText/expressions/safeCalls.txt @@ -1,6 +1,7 @@ FILE /safeCalls.kt CLASS CLASS Ref CONSTRUCTOR public constructor Ref(value: kotlin.Int) + VALUE_PARAMETER value-parameter value: kotlin.Int BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Ref' @@ -9,22 +10,28 @@ FILE /safeCalls.kt EXPRESSION_BODY GET_VAR 'value-parameter value: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'value: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=Ref origin=null FUN DEFAULT_PROPERTY_ACCESSOR public final fun (: kotlin.Int): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter : kotlin.Int BLOCK_BODY SET_FIELD 'value: Int' type=kotlin.Unit origin=null receiver: GET_VAR '' type=Ref origin=null value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null CLASS INTERFACE IHost FUN public open fun kotlin.String.extLength(): kotlin.Int + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='extLength() on String: Int' CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY $this: GET_VAR '' type=kotlin.String origin=null FUN public fun test1(x: kotlin.String?): kotlin.Int? + VALUE_PARAMETER value-parameter x: kotlin.String? BLOCK_BODY RETURN type=kotlin.Nothing from='test1(String?): Int?' BLOCK type=kotlin.Int? origin=SAFE_CALL @@ -41,6 +48,7 @@ FILE /safeCalls.kt then: CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY $this: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null FUN public fun test2(x: kotlin.String?): kotlin.Int? + VALUE_PARAMETER value-parameter x: kotlin.String? BLOCK_BODY RETURN type=kotlin.Nothing from='test2(String?): Int?' BLOCK type=kotlin.Int? origin=SAFE_CALL @@ -57,6 +65,8 @@ FILE /safeCalls.kt then: CALL 'hashCode(): Int' type=kotlin.Int origin=null $this: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null FUN public fun test3(x: kotlin.String?, y: kotlin.Any?): kotlin.Boolean? + VALUE_PARAMETER value-parameter x: kotlin.String? + VALUE_PARAMETER value-parameter y: kotlin.Any? BLOCK_BODY RETURN type=kotlin.Nothing from='test3(String?, Any?): Boolean?' BLOCK type=kotlin.Boolean? origin=SAFE_CALL @@ -74,6 +84,7 @@ FILE /safeCalls.kt $this: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null other: GET_VAR 'value-parameter y: Any?' type=kotlin.Any? origin=null FUN public fun test4(x: Ref?): kotlin.Unit + VALUE_PARAMETER value-parameter x: Ref? BLOCK_BODY BLOCK type=kotlin.Unit origin=SAFE_CALL VAR IR_TEMPORARY_VARIABLE val tmp0_safe_receiver: Ref? @@ -91,6 +102,8 @@ FILE /safeCalls.kt $this: GET_VAR 'tmp0_safe_receiver: Ref?' type=Ref? origin=null : CONST Int type=kotlin.Int value='0' FUN public fun IHost.test5(s: kotlin.String?): kotlin.Int? + $receiver: VALUE_PARAMETER + VALUE_PARAMETER value-parameter s: kotlin.String? BLOCK_BODY RETURN type=kotlin.Nothing from='test5(String?) on IHost: Int?' BLOCK type=kotlin.Int? origin=SAFE_CALL @@ -108,6 +121,7 @@ FILE /safeCalls.kt $this: GET_VAR '' type=IHost origin=null $receiver: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null FUN public fun kotlin.Int.foo(): kotlin.Int + $receiver: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='foo() on Int: Int' CONST Int type=kotlin.Int value='239' diff --git a/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.txt b/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.txt index 3b7264d9f75..d2c021e74c8 100644 --- a/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.txt +++ b/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.txt @@ -5,6 +5,8 @@ FILE /Derived.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Base()' INSTANCE_INITIALIZER_CALL classDescriptor='Derived' FUN public final fun setValue(v: kotlin.Any): kotlin.Unit + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter v: kotlin.Any BLOCK_BODY WHEN type=kotlin.Unit origin=null BRANCH diff --git a/compiler/testData/ir/irText/expressions/simpleOperators.txt b/compiler/testData/ir/irText/expressions/simpleOperators.txt index 88b59070266..1e5adf1a796 100644 --- a/compiler/testData/ir/irText/expressions/simpleOperators.txt +++ b/compiler/testData/ir/irText/expressions/simpleOperators.txt @@ -1,65 +1,87 @@ FILE /simpleOperators.kt FUN public fun test1(a: kotlin.Int, b: kotlin.Int): kotlin.Int + VALUE_PARAMETER value-parameter a: kotlin.Int + VALUE_PARAMETER value-parameter b: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='test1(Int, Int): Int' CALL 'plus(Int): Int' type=kotlin.Int origin=PLUS $this: GET_VAR 'value-parameter a: Int' type=kotlin.Int origin=null other: GET_VAR 'value-parameter b: Int' type=kotlin.Int origin=null FUN public fun test2(a: kotlin.Int, b: kotlin.Int): kotlin.Int + VALUE_PARAMETER value-parameter a: kotlin.Int + VALUE_PARAMETER value-parameter b: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='test2(Int, Int): Int' CALL 'minus(Int): Int' type=kotlin.Int origin=MINUS $this: GET_VAR 'value-parameter a: Int' type=kotlin.Int origin=null other: GET_VAR 'value-parameter b: Int' type=kotlin.Int origin=null FUN public fun test3(a: kotlin.Int, b: kotlin.Int): kotlin.Int + VALUE_PARAMETER value-parameter a: kotlin.Int + VALUE_PARAMETER value-parameter b: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='test3(Int, Int): Int' CALL 'times(Int): Int' type=kotlin.Int origin=MUL $this: GET_VAR 'value-parameter a: Int' type=kotlin.Int origin=null other: GET_VAR 'value-parameter b: Int' type=kotlin.Int origin=null FUN public fun test4(a: kotlin.Int, b: kotlin.Int): kotlin.Int + VALUE_PARAMETER value-parameter a: kotlin.Int + VALUE_PARAMETER value-parameter b: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='test4(Int, Int): Int' CALL 'div(Int): Int' type=kotlin.Int origin=DIV $this: GET_VAR 'value-parameter a: Int' type=kotlin.Int origin=null other: GET_VAR 'value-parameter b: Int' type=kotlin.Int origin=null FUN public fun test5(a: kotlin.Int, b: kotlin.Int): kotlin.Int + VALUE_PARAMETER value-parameter a: kotlin.Int + VALUE_PARAMETER value-parameter b: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='test5(Int, Int): Int' CALL 'rem(Int): Int' type=kotlin.Int origin=PERC $this: GET_VAR 'value-parameter a: Int' type=kotlin.Int origin=null other: GET_VAR 'value-parameter b: Int' type=kotlin.Int origin=null FUN public fun test6(a: kotlin.Int, b: kotlin.Int): kotlin.ranges.IntRange + VALUE_PARAMETER value-parameter a: kotlin.Int + VALUE_PARAMETER value-parameter b: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='test6(Int, Int): IntRange' CALL 'rangeTo(Int): IntRange' type=kotlin.ranges.IntRange origin=RANGE $this: GET_VAR 'value-parameter a: Int' type=kotlin.Int origin=null other: GET_VAR 'value-parameter b: Int' type=kotlin.Int origin=null FUN public fun test1x(a: kotlin.Int, b: kotlin.Int): kotlin.Int + VALUE_PARAMETER value-parameter a: kotlin.Int + VALUE_PARAMETER value-parameter b: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='test1x(Int, Int): Int' CALL 'plus(Int): Int' type=kotlin.Int origin=null $this: GET_VAR 'value-parameter a: Int' type=kotlin.Int origin=null other: GET_VAR 'value-parameter b: Int' type=kotlin.Int origin=null FUN public fun test2x(a: kotlin.Int, b: kotlin.Int): kotlin.Int + VALUE_PARAMETER value-parameter a: kotlin.Int + VALUE_PARAMETER value-parameter b: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='test2x(Int, Int): Int' CALL 'minus(Int): Int' type=kotlin.Int origin=null $this: GET_VAR 'value-parameter a: Int' type=kotlin.Int origin=null other: GET_VAR 'value-parameter b: Int' type=kotlin.Int origin=null FUN public fun test3x(a: kotlin.Int, b: kotlin.Int): kotlin.Int + VALUE_PARAMETER value-parameter a: kotlin.Int + VALUE_PARAMETER value-parameter b: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='test3x(Int, Int): Int' CALL 'times(Int): Int' type=kotlin.Int origin=null $this: GET_VAR 'value-parameter a: Int' type=kotlin.Int origin=null other: GET_VAR 'value-parameter b: Int' type=kotlin.Int origin=null FUN public fun test4x(a: kotlin.Int, b: kotlin.Int): kotlin.Int + VALUE_PARAMETER value-parameter a: kotlin.Int + VALUE_PARAMETER value-parameter b: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='test4x(Int, Int): Int' CALL 'div(Int): Int' type=kotlin.Int origin=null $this: GET_VAR 'value-parameter a: Int' type=kotlin.Int origin=null other: GET_VAR 'value-parameter b: Int' type=kotlin.Int origin=null FUN public fun test5x(a: kotlin.Int, b: kotlin.Int): kotlin.Int + VALUE_PARAMETER value-parameter a: kotlin.Int + VALUE_PARAMETER value-parameter b: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='test5x(Int, Int): Int' CALL 'mod(Int): Int' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/expressions/simpleUnaryOperators.txt b/compiler/testData/ir/irText/expressions/simpleUnaryOperators.txt index e09f3a3a94d..caabe1e8cf1 100644 --- a/compiler/testData/ir/irText/expressions/simpleUnaryOperators.txt +++ b/compiler/testData/ir/irText/expressions/simpleUnaryOperators.txt @@ -1,5 +1,6 @@ FILE /simpleUnaryOperators.kt FUN public fun test1(x: kotlin.Int): kotlin.Int + VALUE_PARAMETER value-parameter x: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='test1(Int): Int' CALL 'unaryMinus(): Int' type=kotlin.Int origin=UMINUS @@ -9,6 +10,7 @@ FILE /simpleUnaryOperators.kt RETURN type=kotlin.Nothing from='test2(): Int' CONST Int type=kotlin.Int value='-42' FUN public fun test3(x: kotlin.Int): kotlin.Int + VALUE_PARAMETER value-parameter x: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='test3(Int): Int' CALL 'unaryPlus(): Int' type=kotlin.Int origin=UPLUS @@ -18,6 +20,7 @@ FILE /simpleUnaryOperators.kt RETURN type=kotlin.Nothing from='test4(): Int' CONST Int type=kotlin.Int value='42' FUN public fun test5(x: kotlin.Boolean): kotlin.Boolean + VALUE_PARAMETER value-parameter x: kotlin.Boolean BLOCK_BODY RETURN type=kotlin.Nothing from='test5(Boolean): Boolean' CALL 'not(): Boolean' type=kotlin.Boolean origin=EXCL diff --git a/compiler/testData/ir/irText/expressions/smartCasts.txt b/compiler/testData/ir/irText/expressions/smartCasts.txt index 49f9ff1f5d3..219131c73b9 100644 --- a/compiler/testData/ir/irText/expressions/smartCasts.txt +++ b/compiler/testData/ir/irText/expressions/smartCasts.txt @@ -1,17 +1,22 @@ FILE /smartCasts.kt FUN public fun expectsString(s: kotlin.String): kotlin.Unit + VALUE_PARAMETER value-parameter s: kotlin.String BLOCK_BODY FUN public fun expectsInt(i: kotlin.Int): kotlin.Unit + VALUE_PARAMETER value-parameter i: kotlin.Int BLOCK_BODY FUN public fun overloaded(s: kotlin.String): kotlin.String + VALUE_PARAMETER value-parameter s: kotlin.String BLOCK_BODY RETURN type=kotlin.Nothing from='overloaded(String): String' GET_VAR 'value-parameter s: String' type=kotlin.String origin=null FUN public fun overloaded(x: kotlin.Any): kotlin.Any + VALUE_PARAMETER value-parameter x: kotlin.Any BLOCK_BODY RETURN type=kotlin.Nothing from='overloaded(Any): Any' GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null FUN public fun test1(x: kotlin.Any): kotlin.Unit + VALUE_PARAMETER value-parameter x: kotlin.Any BLOCK_BODY WHEN type=kotlin.Unit origin=null BRANCH @@ -35,6 +40,7 @@ FILE /smartCasts.kt s: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null FUN public fun test2(x: kotlin.Any): kotlin.String + VALUE_PARAMETER value-parameter x: kotlin.Any BLOCK_BODY WHEN type=kotlin.Unit origin=null BRANCH @@ -47,6 +53,7 @@ FILE /smartCasts.kt s: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null FUN public fun test3(x: kotlin.Any): kotlin.String + VALUE_PARAMETER value-parameter x: kotlin.Any BLOCK_BODY WHEN type=kotlin.Unit origin=null BRANCH diff --git a/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.txt b/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.txt index 692f6dc7543..ae26f3cef71 100644 --- a/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.txt +++ b/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.txt @@ -2,14 +2,17 @@ FILE /smartCastsWithDestructuring.kt CLASS INTERFACE I1 CLASS INTERFACE I2 FUN public operator fun I1.component1(): kotlin.Int + $receiver: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='component1() on I1: Int' CONST Int type=kotlin.Int value='1' FUN public operator fun I2.component2(): kotlin.String + $receiver: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='component2() on I2: String' CONST String type=kotlin.String value='' FUN public fun test(x: I1): kotlin.Unit + VALUE_PARAMETER value-parameter x: I1 BLOCK_BODY WHEN type=kotlin.Unit origin=null BRANCH diff --git a/compiler/testData/ir/irText/expressions/smoke.txt b/compiler/testData/ir/irText/expressions/smoke.txt index 99df983ba1e..d8f5812ca3f 100644 --- a/compiler/testData/ir/irText/expressions/smoke.txt +++ b/compiler/testData/ir/irText/expressions/smoke.txt @@ -25,6 +25,7 @@ FILE /smoke.kt RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'testSimpleVar: Int' type=kotlin.Int origin=null FUN DEFAULT_PROPERTY_ACCESSOR public fun (: kotlin.Int): kotlin.Unit + VALUE_PARAMETER value-parameter : kotlin.Int BLOCK_BODY SET_FIELD 'testSimpleVar: Int' type=kotlin.Unit origin=null value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null @@ -34,4 +35,5 @@ FILE /smoke.kt RETURN type=kotlin.Nothing from='(): Int' CONST Int type=kotlin.Int value='42' FUN public fun (v: kotlin.Int): kotlin.Unit + VALUE_PARAMETER value-parameter v: kotlin.Int BLOCK_BODY diff --git a/compiler/testData/ir/irText/expressions/stringComparisons.txt b/compiler/testData/ir/irText/expressions/stringComparisons.txt index d88a60a060b..b46fe808e87 100644 --- a/compiler/testData/ir/irText/expressions/stringComparisons.txt +++ b/compiler/testData/ir/irText/expressions/stringComparisons.txt @@ -1,5 +1,7 @@ FILE /stringComparisons.kt FUN public fun test1(a: kotlin.String, b: kotlin.String): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.String + VALUE_PARAMETER value-parameter b: kotlin.String BLOCK_BODY RETURN type=kotlin.Nothing from='test1(String, String): Boolean' CALL 'GT0(Int): Boolean' type=kotlin.Boolean origin=GT @@ -7,6 +9,8 @@ FILE /stringComparisons.kt $this: GET_VAR 'value-parameter a: String' type=kotlin.String origin=null other: GET_VAR 'value-parameter b: String' type=kotlin.String origin=null FUN public fun test2(a: kotlin.String, b: kotlin.String): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.String + VALUE_PARAMETER value-parameter b: kotlin.String BLOCK_BODY RETURN type=kotlin.Nothing from='test2(String, String): Boolean' CALL 'LT0(Int): Boolean' type=kotlin.Boolean origin=LT @@ -14,6 +18,8 @@ FILE /stringComparisons.kt $this: GET_VAR 'value-parameter a: String' type=kotlin.String origin=null other: GET_VAR 'value-parameter b: String' type=kotlin.String origin=null FUN public fun test3(a: kotlin.String, b: kotlin.String): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.String + VALUE_PARAMETER value-parameter b: kotlin.String BLOCK_BODY RETURN type=kotlin.Nothing from='test3(String, String): Boolean' CALL 'GTEQ0(Int): Boolean' type=kotlin.Boolean origin=GTEQ @@ -21,6 +27,8 @@ FILE /stringComparisons.kt $this: GET_VAR 'value-parameter a: String' type=kotlin.String origin=null other: GET_VAR 'value-parameter b: String' type=kotlin.String origin=null FUN public fun test4(a: kotlin.String, b: kotlin.String): kotlin.Boolean + VALUE_PARAMETER value-parameter a: kotlin.String + VALUE_PARAMETER value-parameter b: kotlin.String BLOCK_BODY RETURN type=kotlin.Nothing from='test4(String, String): Boolean' CALL 'LTEQ0(Int): Boolean' type=kotlin.Boolean origin=LTEQ diff --git a/compiler/testData/ir/irText/expressions/stringPlus.txt b/compiler/testData/ir/irText/expressions/stringPlus.txt index 7257d57ee39..55075659f22 100644 --- a/compiler/testData/ir/irText/expressions/stringPlus.txt +++ b/compiler/testData/ir/irText/expressions/stringPlus.txt @@ -1,11 +1,15 @@ FILE /stringPlus.kt FUN public fun test1(a: kotlin.String, b: kotlin.Any): kotlin.String + VALUE_PARAMETER value-parameter a: kotlin.String + VALUE_PARAMETER value-parameter b: kotlin.Any BLOCK_BODY RETURN type=kotlin.Nothing from='test1(String, Any): String' CALL 'plus(Any?): String' type=kotlin.String origin=PLUS $this: GET_VAR 'value-parameter a: String' type=kotlin.String origin=null other: GET_VAR 'value-parameter b: Any' type=kotlin.Any origin=null FUN public fun test2(a: kotlin.String, b: kotlin.Int): kotlin.String + VALUE_PARAMETER value-parameter a: kotlin.String + VALUE_PARAMETER value-parameter b: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='test2(String, Int): String' CALL 'plus(Any?): String' type=kotlin.String origin=PLUS @@ -14,6 +18,8 @@ FILE /stringPlus.kt other: CONST String type=kotlin.String value='+' other: GET_VAR 'value-parameter b: Int' type=kotlin.Int origin=null FUN public fun test3(a: kotlin.String, b: kotlin.Int): kotlin.String + VALUE_PARAMETER value-parameter a: kotlin.String + VALUE_PARAMETER value-parameter b: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='test3(String, Int): String' CALL 'plus(Any?): String' type=kotlin.String origin=PLUS diff --git a/compiler/testData/ir/irText/expressions/throw.txt b/compiler/testData/ir/irText/expressions/throw.txt index 889ddcebb28..4122369011c 100644 --- a/compiler/testData/ir/irText/expressions/throw.txt +++ b/compiler/testData/ir/irText/expressions/throw.txt @@ -4,6 +4,7 @@ FILE /throw.kt THROW type=kotlin.Nothing CALL 'constructor Throwable()' type=kotlin.Throwable origin=null FUN public fun testImplicitCast(a: kotlin.Any): kotlin.Unit + VALUE_PARAMETER value-parameter a: kotlin.Any BLOCK_BODY WHEN type=kotlin.Unit origin=null BRANCH diff --git a/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.txt b/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.txt index 4d0961bab9e..6f34e838fba 100644 --- a/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.txt +++ b/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.txt @@ -1,5 +1,6 @@ FILE /tryCatchWithImplicitCast.kt FUN public fun testImplicitCast(a: kotlin.Any): kotlin.Unit + VALUE_PARAMETER value-parameter a: kotlin.Any BLOCK_BODY WHEN type=kotlin.Unit origin=null BRANCH diff --git a/compiler/testData/ir/irText/expressions/typeArguments.txt b/compiler/testData/ir/irText/expressions/typeArguments.txt index 396538b88b5..90006b6953e 100644 --- a/compiler/testData/ir/irText/expressions/typeArguments.txt +++ b/compiler/testData/ir/irText/expressions/typeArguments.txt @@ -1,5 +1,6 @@ FILE /typeArguments.kt FUN public fun test1(x: kotlin.Any): kotlin.Boolean + VALUE_PARAMETER value-parameter x: kotlin.Any BLOCK_BODY RETURN type=kotlin.Nothing from='test1(Any): Boolean' WHEN type=kotlin.Boolean origin=ANDAND diff --git a/compiler/testData/ir/irText/expressions/typeOperators.txt b/compiler/testData/ir/irText/expressions/typeOperators.txt index 26a1acf7d1b..53ab9a2de17 100644 --- a/compiler/testData/ir/irText/expressions/typeOperators.txt +++ b/compiler/testData/ir/irText/expressions/typeOperators.txt @@ -1,21 +1,25 @@ FILE /typeOperators.kt CLASS INTERFACE IThing FUN public fun test1(x: kotlin.Any): kotlin.Boolean + VALUE_PARAMETER value-parameter x: kotlin.Any BLOCK_BODY RETURN type=kotlin.Nothing from='test1(Any): Boolean' TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=IThing GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null FUN public fun test2(x: kotlin.Any): kotlin.Boolean + VALUE_PARAMETER value-parameter x: kotlin.Any BLOCK_BODY RETURN type=kotlin.Nothing from='test2(Any): Boolean' TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=IThing GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null FUN public fun test3(x: kotlin.Any): IThing + VALUE_PARAMETER value-parameter x: kotlin.Any BLOCK_BODY RETURN type=kotlin.Nothing from='test3(Any): IThing' TYPE_OP type=IThing origin=CAST typeOperand=IThing GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null FUN public fun test4(x: kotlin.Any): IThing? + VALUE_PARAMETER value-parameter x: kotlin.Any BLOCK_BODY RETURN type=kotlin.Nothing from='test4(Any): IThing?' TYPE_OP type=IThing? origin=SAFE_CAST typeOperand=IThing diff --git a/compiler/testData/ir/irText/expressions/varargWithImplicitCast.txt b/compiler/testData/ir/irText/expressions/varargWithImplicitCast.txt index c872d4e556f..cf2eb7bda51 100644 --- a/compiler/testData/ir/irText/expressions/varargWithImplicitCast.txt +++ b/compiler/testData/ir/irText/expressions/varargWithImplicitCast.txt @@ -1,5 +1,6 @@ FILE /varargWithImplicitCast.kt FUN public fun testScalar(a: kotlin.Any): kotlin.IntArray + VALUE_PARAMETER value-parameter a: kotlin.Any BLOCK_BODY WHEN type=kotlin.Unit origin=null BRANCH @@ -13,6 +14,7 @@ FILE /varargWithImplicitCast.kt TYPE_OP type=kotlin.Int origin=IMPLICIT_CAST typeOperand=kotlin.Int GET_VAR 'value-parameter a: Any' type=kotlin.Any origin=null FUN public fun testSpread(a: kotlin.Any): kotlin.IntArray + VALUE_PARAMETER value-parameter a: kotlin.Any BLOCK_BODY WHEN type=kotlin.Unit origin=null BRANCH diff --git a/compiler/testData/ir/irText/expressions/variableAsFunctionCall.txt b/compiler/testData/ir/irText/expressions/variableAsFunctionCall.txt index 7424d401249..9f5130c78e5 100644 --- a/compiler/testData/ir/irText/expressions/variableAsFunctionCall.txt +++ b/compiler/testData/ir/irText/expressions/variableAsFunctionCall.txt @@ -1,5 +1,6 @@ FILE /variableAsFunctionCall.kt FUN public fun kotlin.String.k(): () -> kotlin.String + $receiver: VALUE_PARAMETER String> BLOCK_BODY RETURN type=kotlin.Nothing from='k() on String: () -> String' BLOCK type=() -> kotlin.String origin=LAMBDA @@ -9,11 +10,13 @@ FILE /variableAsFunctionCall.kt GET_VAR ' String>' type=kotlin.String origin=null CALLABLE_REFERENCE '(): String' type=() -> kotlin.String origin=LAMBDA FUN public fun test1(f: () -> kotlin.Unit): kotlin.Unit + VALUE_PARAMETER value-parameter f: () -> kotlin.Unit BLOCK_BODY RETURN type=kotlin.Nothing from='test1(() -> Unit): Unit' CALL 'invoke(): Unit' type=kotlin.Unit origin=INVOKE $this: GET_VAR 'value-parameter f: () -> Unit' type=() -> kotlin.Unit origin=VARIABLE_AS_FUNCTION FUN public fun test2(f: kotlin.String.() -> kotlin.Unit): kotlin.Unit + VALUE_PARAMETER value-parameter f: kotlin.String.() -> kotlin.Unit BLOCK_BODY RETURN type=kotlin.Nothing from='test2(String.() -> Unit): Unit' CALL 'invoke() on String: Unit' type=kotlin.Unit origin=INVOKE @@ -26,6 +29,7 @@ FILE /variableAsFunctionCall.kt $this: CALL 'k() on String: () -> String' type=() -> kotlin.String origin=null $receiver: CONST String type=kotlin.String value='hello' FUN public fun test4(ns: kotlin.String?): kotlin.String? + VALUE_PARAMETER value-parameter ns: kotlin.String? BLOCK_BODY RETURN type=kotlin.Nothing from='test4(String?): String?' BLOCK type=kotlin.String? origin=SAFE_CALL diff --git a/compiler/testData/ir/irText/expressions/when.txt b/compiler/testData/ir/irText/expressions/when.txt index 6f143e2db8d..f0b3dacf78b 100644 --- a/compiler/testData/ir/irText/expressions/when.txt +++ b/compiler/testData/ir/irText/expressions/when.txt @@ -5,6 +5,7 @@ FILE /when.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='A' FUN public fun testWithSubject(x: kotlin.Any?): kotlin.String + VALUE_PARAMETER value-parameter x: kotlin.Any? BLOCK_BODY RETURN type=kotlin.Nothing from='testWithSubject(Any?): String' BLOCK type=kotlin.String origin=WHEN @@ -36,6 +37,7 @@ FILE /when.kt if: CONST Boolean type=kotlin.Boolean value='true' then: CONST String type=kotlin.String value='something' FUN public fun test(x: kotlin.Any?): kotlin.String + VALUE_PARAMETER value-parameter x: kotlin.Any? BLOCK_BODY RETURN type=kotlin.Nothing from='test(Any?): String' WHEN type=kotlin.String origin=WHEN @@ -64,6 +66,7 @@ FILE /when.kt if: CONST Boolean type=kotlin.Boolean value='true' then: CONST String type=kotlin.String value='something' FUN public fun testComma(x: kotlin.Int): kotlin.String + VALUE_PARAMETER value-parameter x: kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='testComma(Int): String' BLOCK type=kotlin.String origin=WHEN diff --git a/compiler/testData/ir/irText/expressions/whenCoercedToUnit.txt b/compiler/testData/ir/irText/expressions/whenCoercedToUnit.txt index bd87f8227d2..43d17090ef7 100644 --- a/compiler/testData/ir/irText/expressions/whenCoercedToUnit.txt +++ b/compiler/testData/ir/irText/expressions/whenCoercedToUnit.txt @@ -1,5 +1,6 @@ FILE /whenCoercedToUnit.kt FUN public fun foo(x: kotlin.Int): kotlin.Unit + VALUE_PARAMETER value-parameter x: kotlin.Int BLOCK_BODY BLOCK type=kotlin.Unit origin=WHEN VAR IR_TEMPORARY_VARIABLE val tmp0_subject: kotlin.Int diff --git a/compiler/testData/ir/irText/expressions/whenReturn.txt b/compiler/testData/ir/irText/expressions/whenReturn.txt index ec99536bc7c..1d37dee39cf 100644 --- a/compiler/testData/ir/irText/expressions/whenReturn.txt +++ b/compiler/testData/ir/irText/expressions/whenReturn.txt @@ -1,5 +1,6 @@ FILE /whenReturn.kt FUN public fun toString(grade: kotlin.String): kotlin.String + VALUE_PARAMETER value-parameter grade: kotlin.String BLOCK_BODY BLOCK type=kotlin.Unit origin=WHEN VAR IR_TEMPORARY_VARIABLE val tmp0_subject: kotlin.String diff --git a/compiler/testData/ir/irText/lambdas/destructuringInLambda.txt b/compiler/testData/ir/irText/lambdas/destructuringInLambda.txt index e869a7879fb..42f9e25c155 100644 --- a/compiler/testData/ir/irText/lambdas/destructuringInLambda.txt +++ b/compiler/testData/ir/irText/lambdas/destructuringInLambda.txt @@ -1,6 +1,8 @@ FILE /destructuringInLambda.kt CLASS CLASS A CONSTRUCTOR public constructor A(x: kotlin.Int, y: kotlin.Int) + VALUE_PARAMETER value-parameter x: kotlin.Int + VALUE_PARAMETER value-parameter y: kotlin.Int BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='A' @@ -9,6 +11,7 @@ FILE /destructuringInLambda.kt EXPRESSION_BODY GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'x: Int' type=kotlin.Int origin=null @@ -18,33 +21,40 @@ FILE /destructuringInLambda.kt EXPRESSION_BODY GET_VAR 'value-parameter y: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'y: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=A origin=null FUN GENERATED_DATA_CLASS_MEMBER public final operator fun component1(): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='component1(): Int' CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY $this: GET_VAR '' type=A origin=null FUN GENERATED_DATA_CLASS_MEMBER public final operator fun component2(): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='component2(): Int' CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY $this: GET_VAR '' type=A origin=null FUN GENERATED_DATA_CLASS_MEMBER public final fun copy(x: kotlin.Int = ..., y: kotlin.Int = ...): A - x: EXPRESSION_BODY - CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY - $this: GET_VAR '' type=A origin=null - y: EXPRESSION_BODY - CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY - $this: GET_VAR '' type=A origin=null + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter x: kotlin.Int = ... + EXPRESSION_BODY + CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY + $this: GET_VAR '' type=A origin=null + VALUE_PARAMETER value-parameter y: kotlin.Int = ... + EXPRESSION_BODY + CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY + $this: GET_VAR '' type=A origin=null BLOCK_BODY RETURN type=kotlin.Nothing from='copy(Int = ..., Int = ...): A' CALL 'constructor A(Int, Int)' type=A origin=null x: GET_VAR 'value-parameter x: Int = ...' type=kotlin.Int origin=null y: GET_VAR 'value-parameter y: Int = ...' type=kotlin.Int origin=null FUN GENERATED_DATA_CLASS_MEMBER public open override fun toString(): kotlin.String + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='toString(): String' STRING_CONCATENATION type=kotlin.String @@ -58,6 +68,7 @@ FILE /destructuringInLambda.kt $this: GET_VAR '' type=A origin=null CONST String type=kotlin.String value=')' FUN GENERATED_DATA_CLASS_MEMBER public open override fun hashCode(): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY VAR IR_TEMPORARY_VARIABLE var tmp0_result: kotlin.Int CONST Int type=kotlin.Int value='0' @@ -76,6 +87,8 @@ FILE /destructuringInLambda.kt RETURN type=kotlin.Nothing from='hashCode(): Int' GET_VAR 'tmp0_result: Int' type=kotlin.Int origin=null FUN GENERATED_DATA_CLASS_MEMBER public open override fun equals(other: kotlin.Any?): kotlin.Boolean + $this: VALUE_PARAMETER + VALUE_PARAMETER value-parameter other: kotlin.Any? BLOCK_BODY WHEN type=kotlin.Unit origin=null BRANCH @@ -120,6 +133,7 @@ FILE /destructuringInLambda.kt EXPRESSION_BODY BLOCK type=(A) -> kotlin.Int origin=LAMBDA FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun (: A): kotlin.Int + VALUE_PARAMETER value-parameter : A BLOCK_BODY VAR val y: kotlin.Int CALL 'component2(): Int' type=kotlin.Int origin=COMPONENT_N(index=2) @@ -134,6 +148,7 @@ FILE /destructuringInLambda.kt RETURN type=kotlin.Nothing from='(): (A) -> Int' GET_FIELD 'fn: (A) -> Int' type=(A) -> kotlin.Int origin=null FUN DEFAULT_PROPERTY_ACCESSOR public fun (: (A) -> kotlin.Int): kotlin.Unit + VALUE_PARAMETER value-parameter : (A) -> kotlin.Int BLOCK_BODY SET_FIELD 'fn: (A) -> Int' type=kotlin.Unit origin=null value: GET_VAR 'value-parameter : (A) -> Int' type=(A) -> kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/lambdas/extensionLambda.txt b/compiler/testData/ir/irText/lambdas/extensionLambda.txt index 5263d64305c..36878a07493 100644 --- a/compiler/testData/ir/irText/lambdas/extensionLambda.txt +++ b/compiler/testData/ir/irText/lambdas/extensionLambda.txt @@ -8,6 +8,7 @@ FILE /extensionLambda.kt $receiver: CONST String type=kotlin.String value='42' block: BLOCK type=kotlin.String.() -> kotlin.Int origin=LAMBDA FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun kotlin.String.(): kotlin.Int + $receiver: VALUE_PARAMETER () on String: Int> BLOCK_BODY RETURN type=kotlin.Nothing from='() on String: Int' CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY diff --git a/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.txt b/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.txt index dce5838fa0a..3afaa179d7f 100644 --- a/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.txt +++ b/compiler/testData/ir/irText/lambdas/multipleImplicitReceivers.txt @@ -12,15 +12,21 @@ FILE /multipleImplicitReceivers.kt CLASS INTERFACE IFoo PROPERTY public open val A.foo: B FUN public open fun A.(): B + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='() on A: B' GET_OBJECT 'B' type=B CLASS INTERFACE IInvoke FUN public open operator fun B.invoke(): kotlin.Int + $this: VALUE_PARAMETER + $receiver: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='invoke() on B: Int' CONST Int type=kotlin.Int value='42' FUN public fun test(fooImpl: IFoo, invokeImpl: IInvoke): kotlin.Unit + VALUE_PARAMETER value-parameter fooImpl: IFoo + VALUE_PARAMETER value-parameter invokeImpl: IInvoke BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit CALL 'with(A, A.() -> Int): Int' type=kotlin.Int origin=null @@ -29,6 +35,7 @@ FILE /multipleImplicitReceivers.kt receiver: GET_OBJECT 'A' type=A block: BLOCK type=A.() -> kotlin.Int origin=LAMBDA FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun A.(): kotlin.Int + $receiver: VALUE_PARAMETER () on A: Int> BLOCK_BODY RETURN type=kotlin.Nothing from='() on A: Int' CALL 'with(IFoo, IFoo.() -> Int): Int' type=kotlin.Int origin=null @@ -37,6 +44,7 @@ FILE /multipleImplicitReceivers.kt receiver: GET_VAR 'value-parameter fooImpl: IFoo' type=IFoo origin=null block: BLOCK type=IFoo.() -> kotlin.Int origin=LAMBDA FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun IFoo.(): kotlin.Int + $receiver: VALUE_PARAMETER () on IFoo: Int> BLOCK_BODY RETURN type=kotlin.Nothing from='() on IFoo: Int' CALL 'with(IInvoke, IInvoke.() -> Int): Int' type=kotlin.Int origin=null @@ -45,6 +53,7 @@ FILE /multipleImplicitReceivers.kt receiver: GET_VAR 'value-parameter invokeImpl: IInvoke' type=IInvoke origin=null block: BLOCK type=IInvoke.() -> kotlin.Int origin=LAMBDA FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun IInvoke.(): kotlin.Int + $receiver: VALUE_PARAMETER () on IInvoke: Int> BLOCK_BODY RETURN type=kotlin.Nothing from='() on IInvoke: Int' CALL 'invoke() on B: Int' type=kotlin.Int origin=INVOKE diff --git a/compiler/testData/ir/irText/lambdas/nonLocalReturn.txt b/compiler/testData/ir/irText/lambdas/nonLocalReturn.txt index c7c01bf4162..4dae5eac662 100644 --- a/compiler/testData/ir/irText/lambdas/nonLocalReturn.txt +++ b/compiler/testData/ir/irText/lambdas/nonLocalReturn.txt @@ -30,12 +30,14 @@ FILE /nonLocalReturn.kt GET_OBJECT 'Unit' type=kotlin.Unit CALLABLE_REFERENCE '(): Unit' type=() -> kotlin.Unit origin=LAMBDA FUN public fun testLrmFoo1(ints: kotlin.collections.List): kotlin.Unit + VALUE_PARAMETER value-parameter ints: kotlin.collections.List BLOCK_BODY CALL 'forEach((Int) -> Unit) on Iterable: Unit' type=kotlin.Unit origin=null : Int $receiver: GET_VAR 'value-parameter ints: List' type=kotlin.collections.List origin=null action: BLOCK type=(kotlin.Int) -> kotlin.Unit origin=LAMBDA FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun (it: kotlin.Int): kotlin.Unit + VALUE_PARAMETER value-parameter it: kotlin.Int BLOCK_BODY WHEN type=kotlin.Unit origin=null BRANCH @@ -49,12 +51,14 @@ FILE /nonLocalReturn.kt message: GET_VAR 'value-parameter it: Int' type=kotlin.Int origin=null CALLABLE_REFERENCE '(Int): Unit' type=(kotlin.Int) -> kotlin.Unit origin=LAMBDA FUN public fun testLrmFoo2(ints: kotlin.collections.List): kotlin.Unit + VALUE_PARAMETER value-parameter ints: kotlin.collections.List BLOCK_BODY CALL 'forEach((Int) -> Unit) on Iterable: Unit' type=kotlin.Unit origin=null : Int $receiver: GET_VAR 'value-parameter ints: List' type=kotlin.collections.List origin=null action: BLOCK type=(kotlin.Int) -> kotlin.Unit origin=LAMBDA FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun (it: kotlin.Int): kotlin.Unit + VALUE_PARAMETER value-parameter it: kotlin.Int BLOCK_BODY WHEN type=kotlin.Unit origin=null BRANCH diff --git a/compiler/testData/ir/irText/regressions/integerCoercionToT.txt b/compiler/testData/ir/irText/regressions/integerCoercionToT.txt index dc4215cfe25..ce8e8107a62 100644 --- a/compiler/testData/ir/irText/regressions/integerCoercionToT.txt +++ b/compiler/testData/ir/irText/regressions/integerCoercionToT.txt @@ -1,24 +1,32 @@ FILE /integerCoercionToT.kt CLASS INTERFACE CPointed FUN public inline fun CPointed.reinterpret(): T + TYPE_PARAMETER + $receiver: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='reinterpret() on CPointed: T' CALL 'TODO(): Nothing' type=kotlin.Nothing origin=null CLASS CLASS CInt32VarX + TYPE_PARAMETER CONSTRUCTOR public constructor CInt32VarX() + TYPE_PARAMETER BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='CInt32VarX' TYPEALIAS typealias CInt32Var = CInt32VarX type=CInt32VarX PROPERTY public var CInt32VarX.value: T_INT FUN public fun CInt32VarX.(): T_INT + $receiver: VALUE_PARAMETER > BLOCK_BODY RETURN type=kotlin.Nothing from='() on CInt32VarX: T_INT' CALL 'TODO(): Nothing' type=kotlin.Nothing origin=null FUN public fun CInt32VarX.(value: T_INT): kotlin.Unit + $receiver: VALUE_PARAMETER > + VALUE_PARAMETER value-parameter value: T_INT BLOCK_BODY CLASS CLASS IdType CONSTRUCTOR public constructor IdType(value: kotlin.Int) + VALUE_PARAMETER value-parameter value: kotlin.Int BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='IdType' @@ -27,11 +35,14 @@ FILE /integerCoercionToT.kt EXPRESSION_BODY GET_VAR 'value-parameter value: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER FUN DEFAULT_PROPERTY_ACCESSOR public final fun (): kotlin.Int + $this: VALUE_PARAMETER BLOCK_BODY RETURN type=kotlin.Nothing from='(): Int' GET_FIELD 'value: Int' type=kotlin.Int origin=null receiver: GET_VAR '' type=IdType origin=null FUN public fun foo(value: IdType, cv: CInt32Var /* = CInt32VarX */): kotlin.Unit + VALUE_PARAMETER value-parameter value: IdType + VALUE_PARAMETER value-parameter cv: CInt32Var /* = CInt32VarX */ BLOCK_BODY CALL '(Int) on CInt32VarX: Unit' type=kotlin.Unit origin=EQ $receiver: GET_VAR 'value-parameter cv: CInt32Var /* = CInt32VarX */' type=CInt32Var /* = CInt32VarX */ origin=null diff --git a/compiler/testData/ir/irText/singletons/companion.txt b/compiler/testData/ir/irText/singletons/companion.txt index 312e8b4f635..dad68b0f2a6 100644 --- a/compiler/testData/ir/irText/singletons/companion.txt +++ b/compiler/testData/ir/irText/singletons/companion.txt @@ -5,6 +5,7 @@ FILE /companion.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Z' FUN public final fun test2(): kotlin.Unit + $this: VALUE_PARAMETER BLOCK_BODY CALL 'test(): Unit' type=kotlin.Unit origin=null $this: GET_OBJECT 'companion object of Z' type=Z.Companion @@ -14,4 +15,5 @@ FILE /companion.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='companion object of Z' FUN public final fun test(): kotlin.Unit + $this: VALUE_PARAMETER BLOCK_BODY diff --git a/compiler/testData/ir/irText/singletons/enumEntry.txt b/compiler/testData/ir/irText/singletons/enumEntry.txt index 777d911f482..53e2911531c 100644 --- a/compiler/testData/ir/irText/singletons/enumEntry.txt +++ b/compiler/testData/ir/irText/singletons/enumEntry.txt @@ -12,6 +12,7 @@ FILE /enumEntry.kt ENUM_CONSTRUCTOR_CALL 'constructor Z()' INSTANCE_INITIALIZER_CALL classDescriptor='ENTRY' FUN public final fun test(): kotlin.Unit + $this: VALUE_PARAMETER BLOCK_BODY CLASS CLASS A CONSTRUCTOR public constructor A() @@ -19,6 +20,7 @@ FILE /enumEntry.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='A' FUN public final fun test2(): kotlin.Unit + $this: VALUE_PARAMETER BLOCK_BODY CALL 'test(): Unit' type=kotlin.Unit origin=null $this: GET_ENUM 'ENTRY' type=Z.ENTRY diff --git a/compiler/testData/ir/irText/singletons/object.txt b/compiler/testData/ir/irText/singletons/object.txt index 1169c137545..905e720d162 100644 --- a/compiler/testData/ir/irText/singletons/object.txt +++ b/compiler/testData/ir/irText/singletons/object.txt @@ -5,6 +5,7 @@ FILE /object.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='Z' FUN public final fun test(): kotlin.Unit + $this: VALUE_PARAMETER BLOCK_BODY CLASS CLASS A CONSTRUCTOR public constructor A() @@ -12,6 +13,7 @@ FILE /object.kt DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' INSTANCE_INITIALIZER_CALL classDescriptor='A' FUN public final fun test2(): kotlin.Unit + $this: VALUE_PARAMETER BLOCK_BODY CALL 'test(): Unit' type=kotlin.Unit origin=null $this: GET_OBJECT 'Z' type=Z diff --git a/compiler/tests/org/jetbrains/kotlin/ir/AbstractIrTextTestCase.kt b/compiler/tests/org/jetbrains/kotlin/ir/AbstractIrTextTestCase.kt index 86a8841dde0..fbda1f4c7f6 100644 --- a/compiler/tests/org/jetbrains/kotlin/ir/AbstractIrTextTestCase.kt +++ b/compiler/tests/org/jetbrains/kotlin/ir/AbstractIrTextTestCase.kt @@ -18,14 +18,20 @@ package org.jetbrains.kotlin.ir import com.intellij.openapi.util.text.StringUtil import junit.framework.TestCase +import org.jetbrains.kotlin.descriptors.DeclarationDescriptor +import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor +import org.jetbrains.kotlin.ir.declarations.IrClass import org.jetbrains.kotlin.ir.declarations.IrFile +import org.jetbrains.kotlin.ir.declarations.IrFunction +import org.jetbrains.kotlin.ir.declarations.IrTypeParametersContainer import org.jetbrains.kotlin.ir.util.DeepCopyIrTree import org.jetbrains.kotlin.ir.util.dump import org.jetbrains.kotlin.ir.util.dumpTreesFromLineNumber +import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid +import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid import org.jetbrains.kotlin.test.KotlinTestUtils import org.jetbrains.kotlin.utils.rethrow import java.io.File -import java.util.* import java.util.regex.Pattern abstract class AbstractIrTextTestCase : AbstractIrGeneratorTestCase() { @@ -52,10 +58,13 @@ abstract class AbstractIrTextTestCase : AbstractIrGeneratorTestCase() { for (irTreeFileLabel in expectations.irTreeFileLabels) { val actualTrees = irFile.dumpTreesFromLineNumber(irTreeFileLabel.lineNumber) KotlinTestUtils.assertEqualsToFile(irTreeFileLabel.expectedTextFile, actualTrees) + verify(irFile, irFileDump) // Check that deep copy produces an equivalent result - val copiedTrees = irFile.transform(DeepCopyIrTree(), null).dumpTreesFromLineNumber(irTreeFileLabel.lineNumber) - KotlinTestUtils.assertEqualsToFile(irTreeFileLabel.expectedTextFile, copiedTrees) + val irFileCopy = irFile.transform(DeepCopyIrTree(), null) + val copiedTrees = irFileCopy.dumpTreesFromLineNumber(irTreeFileLabel.lineNumber) + TestCase.assertEquals("IR dump mismatch after deep copy", actualTrees, copiedTrees) + verify(irFileCopy, irFileCopy.dump()) } try { @@ -67,6 +76,84 @@ abstract class AbstractIrTextTestCase : AbstractIrGeneratorTestCase() { } } + private fun verify(irFile: IrFile, dump: String) { + val irVerifier = IrVerifier() + irVerifier.verify(irFile) + TestCase.assertFalse(irVerifier.errorsAsMessage + "\n\n\n" + dump, irVerifier.hasErrors) + } + + private class IrVerifier : IrElementVisitorVoid { + private val errors = ArrayList() + + val hasErrors get() = errors.isNotEmpty() + + val errorsAsMessage get() = errors.joinToString(prefix = "IR verifier errors:\n", separator = "\n") + + private fun error(message: String) { + errors.add(message) + } + + fun verify(irFile: IrFile) { + irFile.acceptChildrenVoid(this) + } + + override fun visitElement(element: IrElement) { + element.acceptChildrenVoid(this) + } + + override fun visitFunction(declaration: IrFunction) { + val functionDescriptor = declaration.descriptor + + checkTypeParameters(functionDescriptor, declaration, functionDescriptor.typeParameters) + + declaration.dispatchReceiverParameter?.descriptor.let { dispatchReceiverDescriptor -> + if (dispatchReceiverDescriptor != functionDescriptor.dispatchReceiverParameter) { + error("$functionDescriptor: Dispatch receiver parameter mismatch: " + + "$dispatchReceiverDescriptor != ${functionDescriptor.dispatchReceiverParameter}") + } + } + + declaration.extensionReceiverParameter?.descriptor.let { extensionReceiverDescriptor -> + if (extensionReceiverDescriptor != functionDescriptor.extensionReceiverParameter) { + error("$functionDescriptor: Extension receiver parameter mismatch: " + + "$extensionReceiverDescriptor != ${functionDescriptor.extensionReceiverParameter}") + } + } + + val declaredValueParameters = declaration.valueParameters.map { it.descriptor } + val actualValueParameters = functionDescriptor.valueParameters + if (declaredValueParameters.size != actualValueParameters.size) { + error("$functionDescriptor: Value parameters mismatch: $declaredValueParameters != $actualValueParameters") + } + else { + declaredValueParameters.zip(actualValueParameters).forEach { (declaredValueParameter, actualValueParameter) -> + if (declaredValueParameter != actualValueParameter) { + error("$functionDescriptor: Value parameters mismatch: $declaredValueParameter != $actualValueParameter") + } + } + } + } + + override fun visitClass(declaration: IrClass) { + checkTypeParameters(declaration.descriptor, declaration, declaration.descriptor.declaredTypeParameters) + } + + private fun checkTypeParameters(descriptor: DeclarationDescriptor, declaration: IrTypeParametersContainer, expectedTypeParameters: List) { + val declaredTypeParameters = declaration.typeParameters.map { it.descriptor } + + if (declaredTypeParameters.size != expectedTypeParameters.size) { + error("$descriptor: Type parameters mismatch: $declaredTypeParameters != $expectedTypeParameters") + } + else { + declaredTypeParameters.zip(expectedTypeParameters).forEach { (declaredTypeParameter, expectedTypeParameter) -> + if (declaredTypeParameter != expectedTypeParameter) { + error("$descriptor: Type parameters mismatch: $declaredTypeParameter != $expectedTypeParameter") + } + } + } + } + } + internal class Expectations(val regexps: List, val irTreeFileLabels: List) internal class RegexpInText(val numberOfOccurrences: Int, val needle: String) { diff --git a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java index 8fbb3ad3712..2314990f9a9 100644 --- a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java @@ -287,6 +287,69 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase { doTest(fileName); } + @TestMetadata("compiler/testData/ir/irText/declarations/parameters") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Parameters extends AbstractIrTextTestCase { + public void testAllFilesPresentInParameters() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/ir/irText/declarations/parameters"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } + + @TestMetadata("class.kt") + public void testClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/declarations/parameters/class.kt"); + doTest(fileName); + } + + @TestMetadata("constructor.kt") + public void testConstructor() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/declarations/parameters/constructor.kt"); + doTest(fileName); + } + + @TestMetadata("dataClassMembers.kt") + public void testDataClassMembers() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/declarations/parameters/dataClassMembers.kt"); + doTest(fileName); + } + + @TestMetadata("defaultPropertyAccessors.kt") + public void testDefaultPropertyAccessors() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/declarations/parameters/defaultPropertyAccessors.kt"); + doTest(fileName); + } + + @TestMetadata("delegatedMembers.kt") + public void testDelegatedMembers() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/declarations/parameters/delegatedMembers.kt"); + doTest(fileName); + } + + @TestMetadata("fun.kt") + public void testFun() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/declarations/parameters/fun.kt"); + doTest(fileName); + } + + @TestMetadata("lambdas.kt") + public void testLambdas() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/declarations/parameters/lambdas.kt"); + doTest(fileName); + } + + @TestMetadata("localFun.kt") + public void testLocalFun() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/declarations/parameters/localFun.kt"); + doTest(fileName); + } + + @TestMetadata("propertyAccessors.kt") + public void testPropertyAccessors() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/declarations/parameters/propertyAccessors.kt"); + doTest(fileName); + } + } + @TestMetadata("compiler/testData/ir/irText/declarations/provideDelegate") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)