From 9f1ecadd65d08e49c7edf8f26ff2c4cefafda0b2 Mon Sep 17 00:00:00 2001 From: Jinseong Jeon Date: Wed, 15 Apr 2020 13:45:54 -0700 Subject: [PATCH] IR: more consolidation of synthetic member generation for data class. --- .../generators/ClassMemberGenerator.kt | 23 +++- .../generators/DataClassMembersGenerator.kt | 76 +++++++++-- .../kotlin/fir/builder/BaseFirBuilder.kt | 36 +---- .../rawBuilder/expressions/annotated.txt | 4 +- .../rawBuilder/expressions/destructuring.txt | 16 +-- .../testData/rawBuilder/expressions/for.txt | 12 +- .../rawBuilder/expressions/lambda.txt | 12 +- .../generators/DataClassMembersGenerator.kt | 99 +++----------- .../ir/util/DataClassMembersGenerator.kt | 112 +++++++++++----- .../copy/constructorWithDefaultParam.kt | 1 - .../copy/valInConstructorParams.kt | 1 - .../copy/varInConstructorParams.kt | 1 - .../dataClasses/copy/withGenericParameter.kt | 1 - .../copy/withSecondaryConstructor.kt | 1 - .../classes/dataClassWithArrayMembers.fir.txt | 123 ++++++++---------- .../ir/irText/classes/dataClasses.fir.txt | 88 ++++++------- .../irText/classes/dataClassesGeneric.fir.txt | 50 ++++--- .../ir/irText/classes/kt31649.fir.txt | 11 +- .../lambdaInDataClassDefaultParameter.fir.txt | 22 ++-- .../parameters/dataClassMembers.fir.txt | 24 ++-- .../lambdas/destructuringInLambda.fir.txt | 22 ++-- .../enhancedNullabilityInForLoop.fir.txt | 22 ++-- 22 files changed, 354 insertions(+), 403 deletions(-) diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/ClassMemberGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/ClassMemberGenerator.kt index ec6056da8b5..4a8c5b3daab 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/ClassMemberGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/ClassMemberGenerator.kt @@ -120,11 +120,24 @@ internal class ClassMemberGenerator( irFunction.body = body } } else if (irFunction !is IrConstructor) { - if (irFunction.origin == IrDeclarationOrigin.ENUM_CLASS_SPECIAL_MEMBER) { - val kind = Fir2IrDeclarationStorage.ENUM_SYNTHETIC_NAMES.getValue(irFunction.name) - irFunction.body = IrSyntheticBodyImpl(startOffset, endOffset, kind) - } else { - irFunction.body = firFunction?.body?.let { visitor.convertToIrBlockBody(it) } + when { + irFunction.origin == IrDeclarationOrigin.ENUM_CLASS_SPECIAL_MEMBER -> { + val kind = Fir2IrDeclarationStorage.ENUM_SYNTHETIC_NAMES.getValue(irFunction.name) + irFunction.body = IrSyntheticBodyImpl(startOffset, endOffset, kind) + } + irFunction.parent is IrClass && irFunction.parentAsClass.isData -> { + when { + DataClassMembersGenerator.isComponentN(irFunction) -> + DataClassMembersGenerator(components).generateDataClassComponentBody(irFunction) + DataClassMembersGenerator.isCopy(irFunction) -> + DataClassMembersGenerator(components).generateDataClassCopyBody(irFunction) + else -> + irFunction.body = firFunction?.body?.let { visitor.convertToIrBlockBody(it) } + } + } + else -> { + irFunction.body = firFunction?.body?.let { visitor.convertToIrBlockBody(it) } + } } } if (irFunction !is IrConstructor || !irFunction.isPrimary) { diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DataClassMembersGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DataClassMembersGenerator.kt index 3f81bc019c7..1efc451de79 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DataClassMembersGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DataClassMembersGenerator.kt @@ -5,10 +5,7 @@ package org.jetbrains.kotlin.fir.backend.generators -import org.jetbrains.kotlin.descriptors.CallableDescriptor -import org.jetbrains.kotlin.descriptors.FunctionDescriptor -import org.jetbrains.kotlin.descriptors.Modality -import org.jetbrains.kotlin.descriptors.Visibilities +import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.fir.backend.Fir2IrComponents import org.jetbrains.kotlin.fir.backend.declareThisReceiverParameter import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET @@ -20,8 +17,8 @@ import org.jetbrains.kotlin.ir.descriptors.WrappedSimpleFunctionDescriptor import org.jetbrains.kotlin.ir.descriptors.WrappedValueParameterDescriptor import org.jetbrains.kotlin.ir.expressions.IrMemberAccessExpression import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.ir.util.DataClassMembersGenerator -import org.jetbrains.kotlin.ir.util.defaultType import org.jetbrains.kotlin.name.Name class DataClassMembersGenerator(val components: Fir2IrComponents) { @@ -31,6 +28,15 @@ class DataClassMembersGenerator(val components: Fir2IrComponents) { fun generateDataClassMembers(irClass: IrClass): List = MyDataClassMethodsGenerator(irClass, IrDeclarationOrigin.GENERATED_DATA_CLASS_MEMBER).generate() + fun generateDataClassComponentBody(irFunction: IrFunction) = + MyDataClassMethodsGenerator(irFunction.parentAsClass, IrDeclarationOrigin.GENERATED_DATA_CLASS_MEMBER) + .generateComponentBody(irFunction) + + fun generateDataClassCopyBody(irFunction: IrFunction) = + MyDataClassMethodsGenerator(irFunction.parentAsClass, IrDeclarationOrigin.GENERATED_DATA_CLASS_MEMBER) + .generateCopyBody(irFunction) + + private inner class MyDataClassMethodsGenerator( val irClass: IrClass, val origin: IrDeclarationOrigin @@ -51,6 +57,18 @@ class DataClassMembersGenerator(val components: Fir2IrComponents) { // TODO } + override fun getBackingField(parameter: ValueParameterDescriptor?, irValueParameter: IrValueParameter?): IrField? = + irValueParameter?.let { + irClass.properties.single { irProperty -> + irProperty.name == irValueParameter.name && irProperty.backingField?.type == irValueParameter.type + }.backingField + } + + override fun transform(typeParameterDescriptor: TypeParameterDescriptor): IrType { + // TODO + return components.irBuiltIns.anyType + } + override fun commitSubstituted(irMemberAccessExpression: IrMemberAccessExpression, descriptor: CallableDescriptor) { // TODO } @@ -72,34 +90,46 @@ class DataClassMembersGenerator(val components: Fir2IrComponents) { return emptyList() } - // TODO: consolidate componentN() and copy(...) too? - // TODO: generate equals, hashCode, and toString only if needed val equalsFunction = createSyntheticIrFunction( Name.identifier("equals"), - components.irBuiltIns.booleanType, + components.irBuiltIns.booleanType ).apply { valueParameters = listOf( createSyntheticIrParameter(this, Name.identifier("other"), components.irBuiltIns.anyNType) ) } irDataClassMembersGenerator.generateEqualsMethod(equalsFunction, properties) + irClass.declarations.add(equalsFunction) val hashCodeFunction = createSyntheticIrFunction( Name.identifier("hashCode"), - components.irBuiltIns.intType, + components.irBuiltIns.intType ) irDataClassMembersGenerator.generateHashCodeMethod(hashCodeFunction, properties) + irClass.declarations.add(hashCodeFunction) val toStringFunction = createSyntheticIrFunction( Name.identifier("toString"), - components.irBuiltIns.stringType, + components.irBuiltIns.stringType ) irDataClassMembersGenerator.generateToStringMethod(toStringFunction, properties) + irClass.declarations.add(toStringFunction) return listOf(equalsFunction.name, hashCodeFunction.name, toStringFunction.name) } + fun generateComponentBody(irFunction: IrFunction) { + val index = getComponentIndex(irFunction)!! + val valueParameter = irClass.primaryConstructor!!.valueParameters[index - 1] + val backingField = irDataClassMembersGenerator.getBackingField(null, valueParameter)!! + irDataClassMembersGenerator + .generateComponentFunction(irFunction, backingField, valueParameter.startOffset, valueParameter.endOffset) + } + + fun generateCopyBody(irFunction: IrFunction) = + irDataClassMembersGenerator.generateCopyFunction(irFunction, irClass.primaryConstructor!!.symbol) + private fun createSyntheticIrFunction(name: Name, returnType: IrType): IrFunction { val functionDescriptor = WrappedSimpleFunctionDescriptor() val thisReceiverDescriptor = WrappedValueParameterDescriptor() @@ -130,7 +160,7 @@ class DataClassMembersGenerator(val components: Fir2IrComponents) { } } - private fun createSyntheticIrParameter(irFunction: IrFunction, name: Name, type: IrType): IrValueParameter { + private fun createSyntheticIrParameter(irFunction: IrFunction, name: Name, type: IrType, index: Int = 0): IrValueParameter { val descriptor = WrappedValueParameterDescriptor() return components.symbolTable.declareValueParameter( UNDEFINED_OFFSET, @@ -145,7 +175,7 @@ class DataClassMembersGenerator(val components: Fir2IrComponents) { origin, symbol, name, - 0, + index, type, null, isCrossinline = false, @@ -157,4 +187,26 @@ class DataClassMembersGenerator(val components: Fir2IrComponents) { } } } + + companion object { + private val copyName = Name.identifier("copy") + + fun isCopy(irFunction: IrFunction): Boolean = + irFunction.name == copyName + + fun isComponentN(irFunction: IrFunction): Boolean { + if (irFunction.name.isSpecial) { + return false + } + val name = irFunction.name.identifier + if (!name.startsWith("component")) { + return false + } + val n = getComponentIndex(irFunction) + return n != null && n > 0 + } + + fun getComponentIndex(irFunction: IrFunction): Int? = + irFunction.name.identifier.substring("component".length).toIntOrNull() + } } \ No newline at end of file diff --git a/compiler/fir/raw-fir/fir-common/src/org/jetbrains/kotlin/fir/builder/BaseFirBuilder.kt b/compiler/fir/raw-fir/fir-common/src/org/jetbrains/kotlin/fir/builder/BaseFirBuilder.kt index 1bef3aa2ca7..4db9d39c303 100644 --- a/compiler/fir/raw-fir/fir-common/src/org/jetbrains/kotlin/fir/builder/BaseFirBuilder.kt +++ b/compiler/fir/raw-fir/fir-common/src/org/jetbrains/kotlin/fir/builder/BaseFirBuilder.kt @@ -17,13 +17,11 @@ import org.jetbrains.kotlin.fir.diagnostics.DiagnosticKind import org.jetbrains.kotlin.fir.diagnostics.ConeSimpleDiagnostic import org.jetbrains.kotlin.fir.expressions.* import org.jetbrains.kotlin.fir.expressions.builder.* -import org.jetbrains.kotlin.fir.expressions.impl.buildSingleExpressionBlock import org.jetbrains.kotlin.fir.references.FirReference import org.jetbrains.kotlin.fir.references.builder.* import org.jetbrains.kotlin.fir.symbols.CallableId import org.jetbrains.kotlin.fir.symbols.impl.* import org.jetbrains.kotlin.fir.types.* -import org.jetbrains.kotlin.fir.types.builder.buildImplicitTypeRef import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl import org.jetbrains.kotlin.fir.types.impl.ConeTypeParameterTypeImpl @@ -662,6 +660,7 @@ abstract class BaseFirBuilder(val baseSession: FirSession, val context: Conte private fun generateComponentAccess(parameterSource: FirSourceElement?, firProperty: FirProperty) = buildQualifiedAccessExpression { source = parameterSource + typeRef = firProperty.returnTypeRef dispatchReceiver = buildThisReceiverExpression { calleeReference = buildImplicitThisReference { boundSymbol = classBuilder.symbol @@ -682,7 +681,6 @@ abstract class BaseFirBuilder(val baseSession: FirSession, val context: Conte val name = Name.identifier("component$componentIndex") componentIndex++ val parameterSource = sourceNode?.toFirSourceElement() - val target = FirFunctionTarget(labelName = null, isLambda = false) val componentFunction = buildSimpleFunction { source = parameterSource session = this@DataClassMembersGenerator.session @@ -692,14 +690,7 @@ abstract class BaseFirBuilder(val baseSession: FirSession, val context: Conte status = FirDeclarationStatusImpl(Visibilities.PUBLIC, Modality.FINAL) symbol = FirNamedFunctionSymbol(CallableId(packageFqName, classFqName, name)) - val returnExpression = buildReturnExpression { - source = parameterSource - result = generateComponentAccess(parameterSource, firProperty) - this.target = target - } - body = buildSingleExpressionBlock(returnExpression) - }.also { - target.bind(it) + // Refer to FIR backend ClassMemberGenerator for body generation. } classBuilder.addDeclaration(componentFunction) } @@ -708,7 +699,6 @@ abstract class BaseFirBuilder(val baseSession: FirSession, val context: Conte private val copyName = Name.identifier("copy") private fun generateCopyFunction() { - val target = FirFunctionTarget(labelName = null, isLambda = false) classBuilder.addDeclaration( buildSimpleFunction { source = this@DataClassMembersGenerator.source.toFirSourceElement() @@ -732,27 +722,7 @@ abstract class BaseFirBuilder(val baseSession: FirSession, val context: Conte isVararg = false } } - - // TODO: Handle generic types. - val initCallExpression = buildFunctionCall { - argumentList = buildArgumentList { - for ((ktParameter, firProperty) in zippedParameters) { - val parameterSource = ktParameter?.toFirSourceElement() - arguments += generateComponentAccess(parameterSource, firProperty) - } - } - calleeReference = buildResolvedNamedReference { - name = primaryConstructor.symbol.callableId.callableName - resolvedSymbol = primaryConstructor.symbol - } - } - val returnExpression = buildReturnExpression { - result = initCallExpression - this.target = target - } - body = buildSingleExpressionBlock(returnExpression) - }.also { - target.bind(it) + // Refer to FIR backend ClassMemberGenerator for body generation. } ) } diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/annotated.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/annotated.txt index 51544521f37..2230c16c088 100644 --- a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/annotated.txt +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/annotated.txt @@ -25,9 +25,7 @@ FILE: annotated.kt super() } - public final fun copy(): R|Two| { - ^copy R|/Two.Two|() - } + public final fun copy(): R|Two| } public? final? fun bar(two: Two): R|kotlin/Unit| { diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/destructuring.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/destructuring.txt index 1acb8aacc97..e57b8b034fa 100644 --- a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/destructuring.txt +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/destructuring.txt @@ -13,21 +13,13 @@ FILE: destructuring.kt public? final? val third: String = R|/third| public? get(): String - public final fun component1(): Int { - ^component1 this@R|/Some|.R|/Some.first| - } + public final fun component1(): Int - public final fun component2(): Double { - ^component2 this@R|/Some|.R|/Some.second| - } + public final fun component2(): Double - public final fun component3(): String { - ^component3 this@R|/Some|.R|/Some.third| - } + public final fun component3(): String - public final fun copy(first: Int = this@R|/Some|.R|/Some.first|, second: Double = this@R|/Some|.R|/Some.second|, third: String = this@R|/Some|.R|/Some.third|): R|Some| { - ^copy R|/Some.Some|(this@R|/Some|.R|/Some.first|, this@R|/Some|.R|/Some.second|, this@R|/Some|.R|/Some.third|) - } + public final fun copy(first: Int = this@R|/Some|.R|/Some.first|, second: Double = this@R|/Some|.R|/Some.second|, third: String = this@R|/Some|.R|/Some.third|): R|Some| } public? final? fun foo(some: Some): R|kotlin/Unit| { diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/for.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/for.txt index f91dd22735a..6ed4d975f0b 100644 --- a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/for.txt +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/for.txt @@ -48,17 +48,11 @@ FILE: for.kt public? final? val y: Int = R|/y| public? get(): Int - public final fun component1(): Int { - ^component1 this@R|/Some|.R|/Some.x| - } + public final fun component1(): Int - public final fun component2(): Int { - ^component2 this@R|/Some|.R|/Some.y| - } + public final fun component2(): Int - public final fun copy(x: Int = this@R|/Some|.R|/Some.x|, y: Int = this@R|/Some|.R|/Some.y|): R|Some| { - ^copy R|/Some.Some|(this@R|/Some|.R|/Some.x|, this@R|/Some|.R|/Some.y|) - } + public final fun copy(x: Int = this@R|/Some|.R|/Some.x|, y: Int = this@R|/Some|.R|/Some.y|): R|Some| } public? final? fun baz(set: Set): R|kotlin/Unit| { diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/lambda.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/lambda.txt index 96297741183..49f563b8b30 100644 --- a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/lambda.txt +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/lambda.txt @@ -10,17 +10,11 @@ FILE: lambda.kt public? final? val y: Int = R|/y| public? get(): Int - public final fun component1(): Int { - ^component1 this@R|/Tuple|.R|/Tuple.x| - } + public final fun component1(): Int - public final fun component2(): Int { - ^component2 this@R|/Tuple|.R|/Tuple.y| - } + public final fun component2(): Int - public final fun copy(x: Int = this@R|/Tuple|.R|/Tuple.x|, y: Int = this@R|/Tuple|.R|/Tuple.y|): R|Tuple| { - ^copy R|/Tuple.Tuple|(this@R|/Tuple|.R|/Tuple.x|, this@R|/Tuple|.R|/Tuple.y|) - } + public final fun copy(x: Int = this@R|/Tuple|.R|/Tuple.x|, y: Int = this@R|/Tuple|.R|/Tuple.y|): R|Tuple| } public? final? inline fun use(f: ( (Tuple) -> Int )): { 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 dce8f35bce2..b9b3a436ddc 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 @@ -16,23 +16,17 @@ package org.jetbrains.kotlin.psi2ir.generators -import com.intellij.psi.PsiElement 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.* -import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrMemberAccessExpression -import org.jetbrains.kotlin.ir.expressions.impl.IrGetValueImpl -import org.jetbrains.kotlin.ir.expressions.mapTypeParameters -import org.jetbrains.kotlin.ir.expressions.mapValueParameters +import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.ir.util.DataClassMembersGenerator import org.jetbrains.kotlin.ir.util.declareSimpleFunctionWithOverrides import org.jetbrains.kotlin.psi.KtClassOrObject import org.jetbrains.kotlin.psi.KtParameter -import org.jetbrains.kotlin.psi2ir.endOffsetOrUndefined -import org.jetbrains.kotlin.psi2ir.startOffsetOrUndefined +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.DescriptorToSourceUtils @@ -58,38 +52,6 @@ class DataClassMembersGenerator( returnType = function.returnType!!.toIrType() } - private inner class MemberFunctionBuilder( - val irClass: IrClass, - val function: FunctionDescriptor, - val origin: IrDeclarationOrigin, - startOffset: Int = UNDEFINED_OFFSET, - endOffset: Int = UNDEFINED_OFFSET, - val irFunction: IrFunction = declareSimpleFunction(startOffset, endOffset, origin, function) - ) : IrBlockBodyBuilder(context, Scope(irFunction.symbol), startOffset, endOffset) { - inline fun addToClass(builder: MemberFunctionBuilder.(IrFunction) -> Unit): IrFunction { - irFunction.buildWithScope { - builder(irFunction) - irFunction.body = doBuild() - } - - irClass.declarations.add(irFunction) - return irFunction - } - - fun putDefault(parameter: ValueParameterDescriptor, value: IrExpression) { - irFunction.putDefault(parameter, irExprBody(value)) - } - - fun irThis(): IrExpression { - val irDispatchReceiverParameter = irFunction.dispatchReceiverParameter!! - return IrGetValueImpl( - startOffset, endOffset, - irDispatchReceiverParameter.type, - irDispatchReceiverParameter.symbol - ) - } - } - private inner class MyDataClassMethodGenerator( ktClassOrObject: KtClassOrObject, val irClass: IrClass, @@ -104,41 +66,30 @@ class DataClassMembersGenerator( FunctionGenerator(declarationGenerator).generateSyntheticFunctionParameterDeclarations(irFunction) } + override fun getBackingField(parameter: ValueParameterDescriptor?, irValueParameter: IrValueParameter?): IrField? = + parameter?.let { + val property = getOrFail(BindingContext.VALUE_PARAMETER_AS_PROPERTY, parameter) + return getBackingField(property) + } + + override fun transform(typeParameterDescriptor: TypeParameterDescriptor): IrType = + typeParameterDescriptor.defaultType.toIrType() + override fun commitSubstituted(irMemberAccessExpression: IrMemberAccessExpression, descriptor: CallableDescriptor) { irMemberAccessExpression.commitSubstituted(descriptor) } } - private inline fun buildMember( - function: FunctionDescriptor, - psiElement: PsiElement? = null, - body: MemberFunctionBuilder.(IrFunction) -> Unit - ) { - MemberFunctionBuilder( - irClass, function, origin, - psiElement.startOffsetOrUndefined, psiElement.endOffsetOrUndefined - ).addToClass { irFunction -> - irFunction.buildWithScope { - FunctionGenerator(declarationGenerator).generateSyntheticFunctionParameterDeclarations(irFunction) - body(irFunction) - } - } - } - override fun generateComponentFunction(function: FunctionDescriptor, parameter: ValueParameterDescriptor) { if (!irClass.isData) return val ktParameter = DescriptorToSourceUtils.descriptorToDeclaration(parameter) ?: throw AssertionError("No definition for data class constructor parameter $parameter") - buildMember(function, ktParameter) { - +irReturn(irGetField(irThis(), getBackingField(parameter))) - } - } - - private fun getBackingField(parameter: ValueParameterDescriptor): IrField { - val property = getOrFail(BindingContext.VALUE_PARAMETER_AS_PROPERTY, parameter) - return irDataClassMembersGenerator.getBackingField(property) + val backingField = irDataClassMembersGenerator.getBackingField(parameter, null) ?: return + irDataClassMembersGenerator.generateComponentFunction( + function, backingField, ktParameter.startOffset, ktParameter.endOffset + ) } override fun generateCopyFunction(function: FunctionDescriptor, constructorParameters: List) { @@ -148,23 +99,7 @@ class DataClassMembersGenerator( ?: throw AssertionError("Data class should have a primary constructor: $classDescriptor") val constructorSymbol = context.symbolTable.referenceConstructor(dataClassConstructor) - buildMember(function, declaration) { irFunction -> - function.valueParameters.forEach { parameter -> - putDefault(parameter, irGetField(irThis(), getBackingField(parameter))) - } - +irReturn( - irCall( - constructorSymbol, - dataClassConstructor.returnType.toIrType() - ).apply { - mapTypeParameters { it.defaultType.toIrType() } - mapValueParameters { - val irValueParameter = irFunction.valueParameters[it.index] - irGet(irValueParameter.type, irValueParameter.symbol) - } - } - ) - } + irDataClassMembersGenerator.generateCopyFunction(function, constructorSymbol) } override fun generateEqualsMethod(function: FunctionDescriptor, properties: List) = diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DataClassMembersGenerator.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DataClassMembersGenerator.kt index 24914813907..03a8fdd423a 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DataClassMembersGenerator.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DataClassMembersGenerator.kt @@ -6,43 +6,20 @@ package org.jetbrains.kotlin.ir.util import org.jetbrains.kotlin.builtins.KotlinBuiltIns -import org.jetbrains.kotlin.descriptors.CallableDescriptor -import org.jetbrains.kotlin.descriptors.ClassDescriptor -import org.jetbrains.kotlin.descriptors.FunctionDescriptor -import org.jetbrains.kotlin.descriptors.PropertyDescriptor -import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor +import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.incremental.components.NoLookupLocation import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET -import org.jetbrains.kotlin.ir.builders.IrBlockBodyBuilder -import org.jetbrains.kotlin.ir.builders.IrGeneratorContext -import org.jetbrains.kotlin.ir.builders.Scope -import org.jetbrains.kotlin.ir.builders.irAs -import org.jetbrains.kotlin.ir.builders.irCall -import org.jetbrains.kotlin.ir.builders.irCallOp -import org.jetbrains.kotlin.ir.builders.irConcat -import org.jetbrains.kotlin.ir.builders.irEqeqeq -import org.jetbrains.kotlin.ir.builders.irGet -import org.jetbrains.kotlin.ir.builders.irGetField -import org.jetbrains.kotlin.ir.builders.irIfNull -import org.jetbrains.kotlin.ir.builders.irIfThenReturnFalse -import org.jetbrains.kotlin.ir.builders.irIfThenReturnTrue -import org.jetbrains.kotlin.ir.builders.irInt -import org.jetbrains.kotlin.ir.builders.irNotEquals -import org.jetbrains.kotlin.ir.builders.irNotIs -import org.jetbrains.kotlin.ir.builders.irReturn -import org.jetbrains.kotlin.ir.builders.irReturnTrue -import org.jetbrains.kotlin.ir.builders.irString -import org.jetbrains.kotlin.ir.builders.irTemporary -import org.jetbrains.kotlin.ir.declarations.IrClass -import org.jetbrains.kotlin.ir.declarations.IrDeclaration -import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin -import org.jetbrains.kotlin.ir.declarations.IrField -import org.jetbrains.kotlin.ir.declarations.IrFunction +import org.jetbrains.kotlin.ir.builders.* +import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrMemberAccessExpression import org.jetbrains.kotlin.ir.expressions.impl.IrGetValueImpl +import org.jetbrains.kotlin.ir.expressions.mapTypeParameters +import org.jetbrains.kotlin.ir.expressions.mapValueParameters +import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol +import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.resolve.scopes.MemberScope import org.jetbrains.kotlin.types.KotlinType @@ -70,13 +47,16 @@ abstract class DataClassMembersGenerator( val irFunction: IrFunction ) : IrBlockBodyBuilder(context, Scope(irFunction.symbol), startOffset, endOffset) { inline fun addToClass(builder: MemberFunctionBuilder.(IrFunction) -> Unit): IrFunction { + build(builder) + irClass.declarations.add(irFunction) + return irFunction + } + + inline fun build(builder: MemberFunctionBuilder.(IrFunction) -> Unit) { irFunction.buildWithScope { builder(irFunction) irFunction.body = doBuild() } - - irClass.declarations.add(irFunction) - return irFunction } fun irThis(): IrExpression { @@ -97,6 +77,29 @@ abstract class DataClassMembersGenerator( ) } + fun putDefault(parameter: ValueParameterDescriptor, value: IrExpression) { + irFunction.putDefault(parameter, irExprBody(value)) + } + + fun generateComponentFunction(irField: IrField) { + +irReturn(irGetField(irThis(), irField)) + } + + fun generateCopyFunction(constructorSymbol: IrConstructorSymbol) { + +irReturn( + irCall( + constructorSymbol, + irClass.defaultType + ).apply { + mapTypeParameters(::transform) + mapValueParameters { + val irValueParameter = irFunction.valueParameters[it.index] + irGet(irValueParameter.type, irValueParameter.symbol) + } + } + ) + } + fun generateEqualsMethodBody(properties: List) { val irType = irClass.defaultType @@ -231,7 +234,7 @@ abstract class DataClassMembersGenerator( endOffset: Int = UNDEFINED_OFFSET, body: MemberFunctionBuilder.(IrFunction) -> Unit ) { - MemberFunctionBuilder(startOffset, endOffset, irFunction).addToClass { function -> + MemberFunctionBuilder(startOffset, endOffset, irFunction).build { function -> function.buildWithScope { generateSyntheticFunctionParameterDeclarations(function) body(function) @@ -239,7 +242,45 @@ abstract class DataClassMembersGenerator( } } - // Entry for psi2ir + // Entry for psi2ir + fun generateComponentFunction(function: FunctionDescriptor, irField: IrField, startOffset: Int, endOffset: Int) { + buildMember(function, startOffset, endOffset) { + generateComponentFunction(irField) + } + } + + // Entry for fir2ir + fun generateComponentFunction(irFunction: IrFunction, irField: IrField, startOffset: Int, endOffset: Int) { + buildMember(irFunction, startOffset, endOffset) { + generateComponentFunction(irField) + } + } + + abstract fun getBackingField(parameter: ValueParameterDescriptor?, irValueParameter: IrValueParameter?): IrField? + + abstract fun transform(typeParameterDescriptor: TypeParameterDescriptor): IrType + + // Entry for psi2ir + fun generateCopyFunction(function: FunctionDescriptor, constructorSymbol: IrConstructorSymbol) { + buildMember(function, irClass.startOffset, irClass.endOffset) { + function.valueParameters.forEach { parameter -> + putDefault(parameter, irGetField(irThis(), getBackingField(parameter, null)!!)) + } + generateCopyFunction(constructorSymbol) + } + } + + // Entry for fir2ir + fun generateCopyFunction(irFunction: IrFunction, constructorSymbol: IrConstructorSymbol) { + buildMember(irFunction, irClass.startOffset, irClass.endOffset) { + irFunction.valueParameters.forEach { irValueParameter -> + irValueParameter.defaultValue = irExprBody(irGetField(irThis(), getBackingField(null, irValueParameter)!!)) + } + generateCopyFunction(constructorSymbol) + } + } + + // Entry for psi2ir fun generateEqualsMethod(function: FunctionDescriptor, properties: List) { buildMember(function, irClass.startOffset, irClass.endOffset) { generateEqualsMethodBody(properties) @@ -315,4 +356,3 @@ abstract class DataClassMembersGenerator( } } } - diff --git a/compiler/testData/codegen/box/dataClasses/copy/constructorWithDefaultParam.kt b/compiler/testData/codegen/box/dataClasses/copy/constructorWithDefaultParam.kt index 443e2659f6a..5211d6889ae 100644 --- a/compiler/testData/codegen/box/dataClasses/copy/constructorWithDefaultParam.kt +++ b/compiler/testData/codegen/box/dataClasses/copy/constructorWithDefaultParam.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR data class A(val a: Int = 1, val b: String = "$a") {} fun box() : String { diff --git a/compiler/testData/codegen/box/dataClasses/copy/valInConstructorParams.kt b/compiler/testData/codegen/box/dataClasses/copy/valInConstructorParams.kt index 9bfc1aa3b72..a340685014e 100644 --- a/compiler/testData/codegen/box/dataClasses/copy/valInConstructorParams.kt +++ b/compiler/testData/codegen/box/dataClasses/copy/valInConstructorParams.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR data class A(val a: Int, val b: String) {} fun box() : String { diff --git a/compiler/testData/codegen/box/dataClasses/copy/varInConstructorParams.kt b/compiler/testData/codegen/box/dataClasses/copy/varInConstructorParams.kt index 2ca69a31d14..6cd1a25ae2c 100644 --- a/compiler/testData/codegen/box/dataClasses/copy/varInConstructorParams.kt +++ b/compiler/testData/codegen/box/dataClasses/copy/varInConstructorParams.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR data class A(var a: Int, var b: String) {} fun box() : String { diff --git a/compiler/testData/codegen/box/dataClasses/copy/withGenericParameter.kt b/compiler/testData/codegen/box/dataClasses/copy/withGenericParameter.kt index 97c04510923..83a4d82db02 100644 --- a/compiler/testData/codegen/box/dataClasses/copy/withGenericParameter.kt +++ b/compiler/testData/codegen/box/dataClasses/copy/withGenericParameter.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR data class A(val a: Foo) {} class Foo(val a: T) { } diff --git a/compiler/testData/codegen/box/dataClasses/copy/withSecondaryConstructor.kt b/compiler/testData/codegen/box/dataClasses/copy/withSecondaryConstructor.kt index b2342f06f30..f997cea7708 100644 --- a/compiler/testData/codegen/box/dataClasses/copy/withSecondaryConstructor.kt +++ b/compiler/testData/codegen/box/dataClasses/copy/withSecondaryConstructor.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR data class A(val o: String, val k: String) { constructor() : this("O", "k") } diff --git a/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.fir.txt b/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.fir.txt index 39db39a4cf3..6ba6af4c8ff 100644 --- a/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.fir.txt +++ b/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.fir.txt @@ -117,115 +117,106 @@ FILE fqName: fileName:/dataClassWithArrayMembers.kt $this: VALUE_PARAMETER name: type:.Test1 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Array declared in .Test1' - CALL 'public final fun (): kotlin.Array declared in .Test1' type=kotlin.Array origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.component1' type=.Test1 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:stringArray type:kotlin.Array visibility:private [final]' type=kotlin.Array origin=null + receiver: GET_VAR ': .Test1 declared in .Test1.component1' type=.Test1 origin=null FUN name:component2 visibility:public modality:FINAL <> ($this:.Test1) returnType:kotlin.CharArray $this: VALUE_PARAMETER name: type:.Test1 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component2 (): kotlin.CharArray declared in .Test1' - CALL 'public final fun (): kotlin.CharArray declared in .Test1' type=kotlin.CharArray origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.component2' type=.Test1 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:charArray type:kotlin.CharArray visibility:private [final]' type=kotlin.CharArray origin=null + receiver: GET_VAR ': .Test1 declared in .Test1.component2' type=.Test1 origin=null FUN name:component3 visibility:public modality:FINAL <> ($this:.Test1) returnType:kotlin.BooleanArray $this: VALUE_PARAMETER name: type:.Test1 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component3 (): kotlin.BooleanArray declared in .Test1' - CALL 'public final fun (): kotlin.BooleanArray declared in .Test1' type=kotlin.BooleanArray origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.component3' type=.Test1 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:booleanArray type:kotlin.BooleanArray visibility:private [final]' type=kotlin.BooleanArray origin=null + receiver: GET_VAR ': .Test1 declared in .Test1.component3' type=.Test1 origin=null FUN name:component4 visibility:public modality:FINAL <> ($this:.Test1) returnType:kotlin.ByteArray $this: VALUE_PARAMETER name: type:.Test1 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component4 (): kotlin.ByteArray declared in .Test1' - CALL 'public final fun (): kotlin.ByteArray declared in .Test1' type=kotlin.ByteArray origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.component4' type=.Test1 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:byteArray type:kotlin.ByteArray visibility:private [final]' type=kotlin.ByteArray origin=null + receiver: GET_VAR ': .Test1 declared in .Test1.component4' type=.Test1 origin=null FUN name:component5 visibility:public modality:FINAL <> ($this:.Test1) returnType:kotlin.ShortArray $this: VALUE_PARAMETER name: type:.Test1 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component5 (): kotlin.ShortArray declared in .Test1' - CALL 'public final fun (): kotlin.ShortArray declared in .Test1' type=kotlin.ShortArray origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.component5' type=.Test1 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:shortArray type:kotlin.ShortArray visibility:private [final]' type=kotlin.ShortArray origin=null + receiver: GET_VAR ': .Test1 declared in .Test1.component5' type=.Test1 origin=null FUN name:component6 visibility:public modality:FINAL <> ($this:.Test1) returnType:kotlin.IntArray $this: VALUE_PARAMETER name: type:.Test1 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component6 (): kotlin.IntArray declared in .Test1' - CALL 'public final fun (): kotlin.IntArray declared in .Test1' type=kotlin.IntArray origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.component6' type=.Test1 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:intArray type:kotlin.IntArray visibility:private [final]' type=kotlin.IntArray origin=null + receiver: GET_VAR ': .Test1 declared in .Test1.component6' type=.Test1 origin=null FUN name:component7 visibility:public modality:FINAL <> ($this:.Test1) returnType:kotlin.LongArray $this: VALUE_PARAMETER name: type:.Test1 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component7 (): kotlin.LongArray declared in .Test1' - CALL 'public final fun (): kotlin.LongArray declared in .Test1' type=kotlin.LongArray origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.component7' type=.Test1 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:longArray type:kotlin.LongArray visibility:private [final]' type=kotlin.LongArray origin=null + receiver: GET_VAR ': .Test1 declared in .Test1.component7' type=.Test1 origin=null FUN name:component8 visibility:public modality:FINAL <> ($this:.Test1) returnType:kotlin.FloatArray $this: VALUE_PARAMETER name: type:.Test1 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component8 (): kotlin.FloatArray declared in .Test1' - CALL 'public final fun (): kotlin.FloatArray declared in .Test1' type=kotlin.FloatArray origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.component8' type=.Test1 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:floatArray type:kotlin.FloatArray visibility:private [final]' type=kotlin.FloatArray origin=null + receiver: GET_VAR ': .Test1 declared in .Test1.component8' type=.Test1 origin=null FUN name:component9 visibility:public modality:FINAL <> ($this:.Test1) returnType:kotlin.DoubleArray $this: VALUE_PARAMETER name: type:.Test1 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component9 (): kotlin.DoubleArray declared in .Test1' - CALL 'public final fun (): kotlin.DoubleArray declared in .Test1' type=kotlin.DoubleArray origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.component9' type=.Test1 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:doubleArray type:kotlin.DoubleArray visibility:private [final]' type=kotlin.DoubleArray origin=null + receiver: GET_VAR ': .Test1 declared in .Test1.component9' type=.Test1 origin=null FUN name:copy visibility:public modality:FINAL <> ($this:.Test1, stringArray:kotlin.Array, charArray:kotlin.CharArray, booleanArray:kotlin.BooleanArray, byteArray:kotlin.ByteArray, shortArray:kotlin.ShortArray, intArray:kotlin.IntArray, longArray:kotlin.LongArray, floatArray:kotlin.FloatArray, doubleArray:kotlin.DoubleArray) returnType:.Test1 $this: VALUE_PARAMETER name: type:.Test1 VALUE_PARAMETER name:stringArray index:0 type:kotlin.Array EXPRESSION_BODY - CALL 'public final fun (): kotlin.Array declared in .Test1' type=kotlin.Array origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:stringArray type:kotlin.Array visibility:private [final]' type=kotlin.Array origin=null + receiver: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null VALUE_PARAMETER name:charArray index:1 type:kotlin.CharArray EXPRESSION_BODY - CALL 'public final fun (): kotlin.CharArray declared in .Test1' type=kotlin.CharArray origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:charArray type:kotlin.CharArray visibility:private [final]' type=kotlin.CharArray origin=null + receiver: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null VALUE_PARAMETER name:booleanArray index:2 type:kotlin.BooleanArray EXPRESSION_BODY - CALL 'public final fun (): kotlin.BooleanArray declared in .Test1' type=kotlin.BooleanArray origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:booleanArray type:kotlin.BooleanArray visibility:private [final]' type=kotlin.BooleanArray origin=null + receiver: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null VALUE_PARAMETER name:byteArray index:3 type:kotlin.ByteArray EXPRESSION_BODY - CALL 'public final fun (): kotlin.ByteArray declared in .Test1' type=kotlin.ByteArray origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:byteArray type:kotlin.ByteArray visibility:private [final]' type=kotlin.ByteArray origin=null + receiver: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null VALUE_PARAMETER name:shortArray index:4 type:kotlin.ShortArray EXPRESSION_BODY - CALL 'public final fun (): kotlin.ShortArray declared in .Test1' type=kotlin.ShortArray origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:shortArray type:kotlin.ShortArray visibility:private [final]' type=kotlin.ShortArray origin=null + receiver: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null VALUE_PARAMETER name:intArray index:5 type:kotlin.IntArray EXPRESSION_BODY - CALL 'public final fun (): kotlin.IntArray declared in .Test1' type=kotlin.IntArray origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:intArray type:kotlin.IntArray visibility:private [final]' type=kotlin.IntArray origin=null + receiver: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null VALUE_PARAMETER name:longArray index:6 type:kotlin.LongArray EXPRESSION_BODY - CALL 'public final fun (): kotlin.LongArray declared in .Test1' type=kotlin.LongArray origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:longArray type:kotlin.LongArray visibility:private [final]' type=kotlin.LongArray origin=null + receiver: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null VALUE_PARAMETER name:floatArray index:7 type:kotlin.FloatArray EXPRESSION_BODY - CALL 'public final fun (): kotlin.FloatArray declared in .Test1' type=kotlin.FloatArray origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:floatArray type:kotlin.FloatArray visibility:private [final]' type=kotlin.FloatArray origin=null + receiver: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null VALUE_PARAMETER name:doubleArray index:8 type:kotlin.DoubleArray EXPRESSION_BODY - CALL 'public final fun (): kotlin.DoubleArray declared in .Test1' type=kotlin.DoubleArray origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:doubleArray type:kotlin.DoubleArray visibility:private [final]' type=kotlin.DoubleArray origin=null + receiver: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun copy (stringArray: kotlin.Array, charArray: kotlin.CharArray, booleanArray: kotlin.BooleanArray, byteArray: kotlin.ByteArray, shortArray: kotlin.ShortArray, intArray: kotlin.IntArray, longArray: kotlin.LongArray, floatArray: kotlin.FloatArray, doubleArray: kotlin.DoubleArray): .Test1 declared in .Test1' CONSTRUCTOR_CALL 'public constructor (stringArray: kotlin.Array, charArray: kotlin.CharArray, booleanArray: kotlin.BooleanArray, byteArray: kotlin.ByteArray, shortArray: kotlin.ShortArray, intArray: kotlin.IntArray, longArray: kotlin.LongArray, floatArray: kotlin.FloatArray, doubleArray: kotlin.DoubleArray) [primary] declared in .Test1' type=.Test1 origin=null - stringArray: CALL 'public final fun (): kotlin.Array declared in .Test1' type=IrErrorType origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null - charArray: CALL 'public final fun (): kotlin.CharArray declared in .Test1' type=IrErrorType origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null - booleanArray: CALL 'public final fun (): kotlin.BooleanArray declared in .Test1' type=IrErrorType origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null - byteArray: CALL 'public final fun (): kotlin.ByteArray declared in .Test1' type=IrErrorType origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null - shortArray: CALL 'public final fun (): kotlin.ShortArray declared in .Test1' type=IrErrorType origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null - intArray: CALL 'public final fun (): kotlin.IntArray declared in .Test1' type=IrErrorType origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null - longArray: CALL 'public final fun (): kotlin.LongArray declared in .Test1' type=IrErrorType origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null - floatArray: CALL 'public final fun (): kotlin.FloatArray declared in .Test1' type=IrErrorType origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null - doubleArray: CALL 'public final fun (): kotlin.DoubleArray declared in .Test1' type=IrErrorType origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null + stringArray: GET_VAR 'stringArray: kotlin.Array declared in .Test1.copy' type=kotlin.Array origin=null + charArray: GET_VAR 'charArray: kotlin.CharArray declared in .Test1.copy' type=kotlin.CharArray origin=null + booleanArray: GET_VAR 'booleanArray: kotlin.BooleanArray declared in .Test1.copy' type=kotlin.BooleanArray origin=null + byteArray: GET_VAR 'byteArray: kotlin.ByteArray declared in .Test1.copy' type=kotlin.ByteArray origin=null + shortArray: GET_VAR 'shortArray: kotlin.ShortArray declared in .Test1.copy' type=kotlin.ShortArray origin=null + intArray: GET_VAR 'intArray: kotlin.IntArray declared in .Test1.copy' type=kotlin.IntArray origin=null + longArray: GET_VAR 'longArray: kotlin.LongArray declared in .Test1.copy' type=kotlin.LongArray origin=null + floatArray: GET_VAR 'floatArray: kotlin.FloatArray declared in .Test1.copy' type=kotlin.FloatArray origin=null + doubleArray: GET_VAR 'doubleArray: kotlin.DoubleArray declared in .Test1.copy' type=kotlin.DoubleArray origin=null FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:.Test1, other:kotlin.Any?) returnType:kotlin.Boolean $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test1 VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name:other index:0 type:kotlin.Any? @@ -467,20 +458,19 @@ FILE fqName: fileName:/dataClassWithArrayMembers.kt $this: VALUE_PARAMETER name: type:.Test2.Test2> BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Array.Test2> declared in .Test2' - CALL 'public final fun (): kotlin.Array.Test2> declared in .Test2' type=kotlin.Array.Test2> origin=GET_PROPERTY - $this: GET_VAR ': .Test2.Test2> declared in .Test2.component1' type=.Test2.Test2> origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:genericArray type:kotlin.Array.Test2> visibility:private [final]' type=kotlin.Array.Test2> origin=null + receiver: GET_VAR ': .Test2.Test2> declared in .Test2.component1' type=.Test2.Test2> origin=null FUN name:copy visibility:public modality:FINAL <> ($this:.Test2.Test2>, genericArray:kotlin.Array.Test2>) returnType:.Test2.Test2> $this: VALUE_PARAMETER name: type:.Test2.Test2> VALUE_PARAMETER name:genericArray index:0 type:kotlin.Array.Test2> EXPRESSION_BODY - CALL 'public final fun (): kotlin.Array.Test2> declared in .Test2' type=kotlin.Array.Test2> origin=GET_PROPERTY - $this: GET_VAR ': .Test2.Test2> declared in .Test2.copy' type=.Test2.Test2> origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:genericArray type:kotlin.Array.Test2> visibility:private [final]' type=kotlin.Array.Test2> origin=null + receiver: GET_VAR ': .Test2.Test2> declared in .Test2.copy' type=.Test2.Test2> origin=null BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun copy (genericArray: kotlin.Array.Test2>): .Test2.Test2> declared in .Test2' CONSTRUCTOR_CALL 'public constructor (genericArray: kotlin.Array.Test2>) [primary] declared in .Test2' type=.Test2.Test2> origin=null - : - genericArray: CALL 'public final fun (): kotlin.Array.Test2> declared in .Test2' type=IrErrorType origin=GET_PROPERTY - $this: GET_VAR ': .Test2.Test2> declared in .Test2.copy' type=.Test2.Test2> origin=null + : kotlin.Any + genericArray: GET_VAR 'genericArray: kotlin.Array.Test2> declared in .Test2.copy' type=kotlin.Array.Test2> origin=null FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:.Test2.Test2>, other:kotlin.Any?) returnType:kotlin.Boolean $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test2.Test2> VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name:other index:0 type:kotlin.Any? @@ -553,19 +543,18 @@ FILE fqName: fileName:/dataClassWithArrayMembers.kt $this: VALUE_PARAMETER name: type:.Test3 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Array? declared in .Test3' - CALL 'public final fun (): kotlin.Array? declared in .Test3' type=kotlin.Array? origin=GET_PROPERTY - $this: GET_VAR ': .Test3 declared in .Test3.component1' type=.Test3 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:anyArrayN type:kotlin.Array? visibility:private [final]' type=kotlin.Array? origin=null + receiver: GET_VAR ': .Test3 declared in .Test3.component1' type=.Test3 origin=null FUN name:copy visibility:public modality:FINAL <> ($this:.Test3, anyArrayN:kotlin.Array?) returnType:.Test3 $this: VALUE_PARAMETER name: type:.Test3 VALUE_PARAMETER name:anyArrayN index:0 type:kotlin.Array? EXPRESSION_BODY - CALL 'public final fun (): kotlin.Array? declared in .Test3' type=kotlin.Array? origin=GET_PROPERTY - $this: GET_VAR ': .Test3 declared in .Test3.copy' type=.Test3 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:anyArrayN type:kotlin.Array? visibility:private [final]' type=kotlin.Array? origin=null + receiver: GET_VAR ': .Test3 declared in .Test3.copy' type=.Test3 origin=null BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun copy (anyArrayN: kotlin.Array?): .Test3 declared in .Test3' CONSTRUCTOR_CALL 'public constructor (anyArrayN: kotlin.Array?) [primary] declared in .Test3' type=.Test3 origin=null - anyArrayN: CALL 'public final fun (): kotlin.Array? declared in .Test3' type=IrErrorType origin=GET_PROPERTY - $this: GET_VAR ': .Test3 declared in .Test3.copy' type=.Test3 origin=null + anyArrayN: GET_VAR 'anyArrayN: kotlin.Array? declared in .Test3.copy' type=kotlin.Array? origin=null FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:.Test3, other:kotlin.Any?) returnType:kotlin.Boolean $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test3 VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name:other index:0 type:kotlin.Any? diff --git a/compiler/testData/ir/irText/classes/dataClasses.fir.txt b/compiler/testData/ir/irText/classes/dataClasses.fir.txt index cf2926903dc..c9c76d9eea7 100644 --- a/compiler/testData/ir/irText/classes/dataClasses.fir.txt +++ b/compiler/testData/ir/irText/classes/dataClasses.fir.txt @@ -45,43 +45,40 @@ FILE fqName: fileName:/dataClasses.kt $this: VALUE_PARAMETER name: type:.Test1 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Int declared in .Test1' - CALL 'public final fun (): kotlin.Int declared in .Test1' type=kotlin.Int origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.component1' type=.Test1 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + receiver: GET_VAR ': .Test1 declared in .Test1.component1' type=.Test1 origin=null FUN name:component2 visibility:public modality:FINAL <> ($this:.Test1) returnType:kotlin.String $this: VALUE_PARAMETER name: type:.Test1 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component2 (): kotlin.String declared in .Test1' - CALL 'public final fun (): kotlin.String declared in .Test1' type=kotlin.String origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.component2' type=.Test1 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .Test1 declared in .Test1.component2' type=.Test1 origin=null FUN name:component3 visibility:public modality:FINAL <> ($this:.Test1) returnType:kotlin.Any $this: VALUE_PARAMETER name: type:.Test1 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component3 (): kotlin.Any declared in .Test1' - CALL 'public final fun (): kotlin.Any declared in .Test1' type=kotlin.Any origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.component3' type=.Test1 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:z type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null + receiver: GET_VAR ': .Test1 declared in .Test1.component3' type=.Test1 origin=null FUN name:copy visibility:public modality:FINAL <> ($this:.Test1, x:kotlin.Int, y:kotlin.String, z:kotlin.Any) returnType:.Test1 $this: VALUE_PARAMETER name: type:.Test1 VALUE_PARAMETER name:x index:0 type:kotlin.Int EXPRESSION_BODY - CALL 'public final fun (): kotlin.Int declared in .Test1' type=kotlin.Int origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + receiver: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null VALUE_PARAMETER name:y index:1 type:kotlin.String EXPRESSION_BODY - CALL 'public final fun (): kotlin.String declared in .Test1' type=kotlin.String origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null VALUE_PARAMETER name:z index:2 type:kotlin.Any EXPRESSION_BODY - CALL 'public final fun (): kotlin.Any declared in .Test1' type=kotlin.Any origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:z type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null + receiver: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun copy (x: kotlin.Int, y: kotlin.String, z: kotlin.Any): .Test1 declared in .Test1' CONSTRUCTOR_CALL 'public constructor (x: kotlin.Int, y: kotlin.String, z: kotlin.Any) [primary] declared in .Test1' type=.Test1 origin=null - x: CALL 'public final fun (): kotlin.Int declared in .Test1' type=IrErrorType origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null - y: CALL 'public final fun (): kotlin.String declared in .Test1' type=IrErrorType origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null - z: CALL 'public final fun (): kotlin.Any declared in .Test1' type=IrErrorType origin=GET_PROPERTY - $this: GET_VAR ': .Test1 declared in .Test1.copy' type=.Test1 origin=null + x: GET_VAR 'x: kotlin.Int declared in .Test1.copy' type=kotlin.Int origin=null + y: GET_VAR 'y: kotlin.String declared in .Test1.copy' type=kotlin.String origin=null + z: GET_VAR 'z: kotlin.Any declared in .Test1.copy' type=kotlin.Any origin=null FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:.Test1, other:kotlin.Any?) returnType:kotlin.Boolean $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test1 VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name:other index:0 type:kotlin.Any? @@ -193,19 +190,18 @@ FILE fqName: fileName:/dataClasses.kt $this: VALUE_PARAMETER name: type:.Test2 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Any? declared in .Test2' - CALL 'public final fun (): kotlin.Any? declared in .Test2' type=kotlin.Any? origin=GET_PROPERTY - $this: GET_VAR ': .Test2 declared in .Test2.component1' type=.Test2 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Any? visibility:private [final]' type=kotlin.Any? origin=null + receiver: GET_VAR ': .Test2 declared in .Test2.component1' type=.Test2 origin=null FUN name:copy visibility:public modality:FINAL <> ($this:.Test2, x:kotlin.Any?) returnType:.Test2 $this: VALUE_PARAMETER name: type:.Test2 VALUE_PARAMETER name:x index:0 type:kotlin.Any? EXPRESSION_BODY - CALL 'public final fun (): kotlin.Any? declared in .Test2' type=kotlin.Any? origin=GET_PROPERTY - $this: GET_VAR ': .Test2 declared in .Test2.copy' type=.Test2 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Any? visibility:private [final]' type=kotlin.Any? origin=null + receiver: GET_VAR ': .Test2 declared in .Test2.copy' type=.Test2 origin=null BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun copy (x: kotlin.Any?): .Test2 declared in .Test2' CONSTRUCTOR_CALL 'public constructor (x: kotlin.Any?) [primary] declared in .Test2' type=.Test2 origin=null - x: CALL 'public final fun (): kotlin.Any? declared in .Test2' type=IrErrorType origin=GET_PROPERTY - $this: GET_VAR ': .Test2 declared in .Test2.copy' type=.Test2 origin=null + x: GET_VAR 'x: kotlin.Any? declared in .Test2.copy' type=kotlin.Any? origin=null FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:.Test2, other:kotlin.Any?) returnType:kotlin.Boolean $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test2 VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name:other index:0 type:kotlin.Any? @@ -322,55 +318,51 @@ FILE fqName: fileName:/dataClasses.kt $this: VALUE_PARAMETER name: type:.Test3 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Double declared in .Test3' - CALL 'public final fun (): kotlin.Double declared in .Test3' type=kotlin.Double origin=GET_PROPERTY - $this: GET_VAR ': .Test3 declared in .Test3.component1' type=.Test3 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:d type:kotlin.Double visibility:private [final]' type=kotlin.Double origin=null + receiver: GET_VAR ': .Test3 declared in .Test3.component1' type=.Test3 origin=null FUN name:component2 visibility:public modality:FINAL <> ($this:.Test3) returnType:kotlin.Double? $this: VALUE_PARAMETER name: type:.Test3 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component2 (): kotlin.Double? declared in .Test3' - CALL 'public final fun (): kotlin.Double? declared in .Test3' type=kotlin.Double? origin=GET_PROPERTY - $this: GET_VAR ': .Test3 declared in .Test3.component2' type=.Test3 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:dn type:kotlin.Double? visibility:private [final]' type=kotlin.Double? origin=null + receiver: GET_VAR ': .Test3 declared in .Test3.component2' type=.Test3 origin=null FUN name:component3 visibility:public modality:FINAL <> ($this:.Test3) returnType:kotlin.Float $this: VALUE_PARAMETER name: type:.Test3 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component3 (): kotlin.Float declared in .Test3' - CALL 'public final fun (): kotlin.Float declared in .Test3' type=kotlin.Float origin=GET_PROPERTY - $this: GET_VAR ': .Test3 declared in .Test3.component3' type=.Test3 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:f type:kotlin.Float visibility:private [final]' type=kotlin.Float origin=null + receiver: GET_VAR ': .Test3 declared in .Test3.component3' type=.Test3 origin=null FUN name:component4 visibility:public modality:FINAL <> ($this:.Test3) returnType:kotlin.Float? $this: VALUE_PARAMETER name: type:.Test3 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component4 (): kotlin.Float? declared in .Test3' - CALL 'public final fun (): kotlin.Float? declared in .Test3' type=kotlin.Float? origin=GET_PROPERTY - $this: GET_VAR ': .Test3 declared in .Test3.component4' type=.Test3 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:df type:kotlin.Float? visibility:private [final]' type=kotlin.Float? origin=null + receiver: GET_VAR ': .Test3 declared in .Test3.component4' type=.Test3 origin=null FUN name:copy visibility:public modality:FINAL <> ($this:.Test3, d:kotlin.Double, dn:kotlin.Double?, f:kotlin.Float, df:kotlin.Float?) returnType:.Test3 $this: VALUE_PARAMETER name: type:.Test3 VALUE_PARAMETER name:d index:0 type:kotlin.Double EXPRESSION_BODY - CALL 'public final fun (): kotlin.Double declared in .Test3' type=kotlin.Double origin=GET_PROPERTY - $this: GET_VAR ': .Test3 declared in .Test3.copy' type=.Test3 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:d type:kotlin.Double visibility:private [final]' type=kotlin.Double origin=null + receiver: GET_VAR ': .Test3 declared in .Test3.copy' type=.Test3 origin=null VALUE_PARAMETER name:dn index:1 type:kotlin.Double? EXPRESSION_BODY - CALL 'public final fun (): kotlin.Double? declared in .Test3' type=kotlin.Double? origin=GET_PROPERTY - $this: GET_VAR ': .Test3 declared in .Test3.copy' type=.Test3 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:dn type:kotlin.Double? visibility:private [final]' type=kotlin.Double? origin=null + receiver: GET_VAR ': .Test3 declared in .Test3.copy' type=.Test3 origin=null VALUE_PARAMETER name:f index:2 type:kotlin.Float EXPRESSION_BODY - CALL 'public final fun (): kotlin.Float declared in .Test3' type=kotlin.Float origin=GET_PROPERTY - $this: GET_VAR ': .Test3 declared in .Test3.copy' type=.Test3 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:f type:kotlin.Float visibility:private [final]' type=kotlin.Float origin=null + receiver: GET_VAR ': .Test3 declared in .Test3.copy' type=.Test3 origin=null VALUE_PARAMETER name:df index:3 type:kotlin.Float? EXPRESSION_BODY - CALL 'public final fun (): kotlin.Float? declared in .Test3' type=kotlin.Float? origin=GET_PROPERTY - $this: GET_VAR ': .Test3 declared in .Test3.copy' type=.Test3 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:df type:kotlin.Float? visibility:private [final]' type=kotlin.Float? origin=null + receiver: GET_VAR ': .Test3 declared in .Test3.copy' type=.Test3 origin=null BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun copy (d: kotlin.Double, dn: kotlin.Double?, f: kotlin.Float, df: kotlin.Float?): .Test3 declared in .Test3' CONSTRUCTOR_CALL 'public constructor (d: kotlin.Double, dn: kotlin.Double?, f: kotlin.Float, df: kotlin.Float?) [primary] declared in .Test3' type=.Test3 origin=null - d: CALL 'public final fun (): kotlin.Double declared in .Test3' type=IrErrorType origin=GET_PROPERTY - $this: GET_VAR ': .Test3 declared in .Test3.copy' type=.Test3 origin=null - dn: CALL 'public final fun (): kotlin.Double? declared in .Test3' type=IrErrorType origin=GET_PROPERTY - $this: GET_VAR ': .Test3 declared in .Test3.copy' type=.Test3 origin=null - f: CALL 'public final fun (): kotlin.Float declared in .Test3' type=IrErrorType origin=GET_PROPERTY - $this: GET_VAR ': .Test3 declared in .Test3.copy' type=.Test3 origin=null - df: CALL 'public final fun (): kotlin.Float? declared in .Test3' type=IrErrorType origin=GET_PROPERTY - $this: GET_VAR ': .Test3 declared in .Test3.copy' type=.Test3 origin=null + d: GET_VAR 'd: kotlin.Double declared in .Test3.copy' type=kotlin.Double origin=null + dn: GET_VAR 'dn: kotlin.Double? declared in .Test3.copy' type=kotlin.Double? origin=null + f: GET_VAR 'f: kotlin.Float declared in .Test3.copy' type=kotlin.Float origin=null + df: GET_VAR 'df: kotlin.Float? declared in .Test3.copy' type=kotlin.Float? origin=null FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:.Test3, other:kotlin.Any?) returnType:kotlin.Boolean $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test3 VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name:other index:0 type:kotlin.Any? diff --git a/compiler/testData/ir/irText/classes/dataClassesGeneric.fir.txt b/compiler/testData/ir/irText/classes/dataClassesGeneric.fir.txt index d21627088f6..23e1b08f868 100644 --- a/compiler/testData/ir/irText/classes/dataClassesGeneric.fir.txt +++ b/compiler/testData/ir/irText/classes/dataClassesGeneric.fir.txt @@ -22,20 +22,19 @@ FILE fqName: fileName:/dataClassesGeneric.kt $this: VALUE_PARAMETER name: type:.Test1.Test1> BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component1 (): T of .Test1 declared in .Test1' - CALL 'public final fun (): T of .Test1 declared in .Test1' type=T of .Test1 origin=GET_PROPERTY - $this: GET_VAR ': .Test1.Test1> declared in .Test1.component1' type=.Test1.Test1> origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:T of .Test1 visibility:private [final]' type=T of .Test1 origin=null + receiver: GET_VAR ': .Test1.Test1> declared in .Test1.component1' type=.Test1.Test1> origin=null FUN name:copy visibility:public modality:FINAL <> ($this:.Test1.Test1>, x:T of .Test1) returnType:.Test1.Test1> $this: VALUE_PARAMETER name: type:.Test1.Test1> VALUE_PARAMETER name:x index:0 type:T of .Test1 EXPRESSION_BODY - CALL 'public final fun (): T of .Test1 declared in .Test1' type=T of .Test1 origin=GET_PROPERTY - $this: GET_VAR ': .Test1.Test1> declared in .Test1.copy' type=.Test1.Test1> origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:T of .Test1 visibility:private [final]' type=T of .Test1 origin=null + receiver: GET_VAR ': .Test1.Test1> declared in .Test1.copy' type=.Test1.Test1> origin=null BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun copy (x: T of .Test1): .Test1.Test1> declared in .Test1' CONSTRUCTOR_CALL 'public constructor (x: T of .Test1) [primary] declared in .Test1' type=.Test1.Test1> origin=null - : - x: CALL 'public final fun (): T of .Test1 declared in .Test1' type=IrErrorType origin=GET_PROPERTY - $this: GET_VAR ': .Test1.Test1> declared in .Test1.copy' type=.Test1.Test1> origin=null + : kotlin.Any + x: GET_VAR 'x: T of .Test1 declared in .Test1.copy' type=T of .Test1 origin=null FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:.Test1.Test1>, other:kotlin.Any?) returnType:kotlin.Boolean $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test1.Test1> VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name:other index:0 type:kotlin.Any? @@ -117,20 +116,19 @@ FILE fqName: fileName:/dataClassesGeneric.kt $this: VALUE_PARAMETER name: type:.Test2.Test2> BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component1 (): T of .Test2 declared in .Test2' - CALL 'public final fun (): T of .Test2 declared in .Test2' type=T of .Test2 origin=GET_PROPERTY - $this: GET_VAR ': .Test2.Test2> declared in .Test2.component1' type=.Test2.Test2> origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:T of .Test2 visibility:private [final]' type=T of .Test2 origin=null + receiver: GET_VAR ': .Test2.Test2> declared in .Test2.component1' type=.Test2.Test2> origin=null FUN name:copy visibility:public modality:FINAL <> ($this:.Test2.Test2>, x:T of .Test2) returnType:.Test2.Test2> $this: VALUE_PARAMETER name: type:.Test2.Test2> VALUE_PARAMETER name:x index:0 type:T of .Test2 EXPRESSION_BODY - CALL 'public final fun (): T of .Test2 declared in .Test2' type=T of .Test2 origin=GET_PROPERTY - $this: GET_VAR ': .Test2.Test2> declared in .Test2.copy' type=.Test2.Test2> origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:T of .Test2 visibility:private [final]' type=T of .Test2 origin=null + receiver: GET_VAR ': .Test2.Test2> declared in .Test2.copy' type=.Test2.Test2> origin=null BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun copy (x: T of .Test2): .Test2.Test2> declared in .Test2' CONSTRUCTOR_CALL 'public constructor (x: T of .Test2) [primary] declared in .Test2' type=.Test2.Test2> origin=null - : - x: CALL 'public final fun (): T of .Test2 declared in .Test2' type=IrErrorType origin=GET_PROPERTY - $this: GET_VAR ': .Test2.Test2> declared in .Test2.copy' type=.Test2.Test2> origin=null + : kotlin.Any + x: GET_VAR 'x: T of .Test2 declared in .Test2.copy' type=T of .Test2 origin=null FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:.Test2.Test2>, other:kotlin.Any?) returnType:kotlin.Boolean $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test2.Test2> VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name:other index:0 type:kotlin.Any? @@ -203,20 +201,19 @@ FILE fqName: fileName:/dataClassesGeneric.kt $this: VALUE_PARAMETER name: type:.Test3.Test3> BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.collections.List.Test3> declared in .Test3' - CALL 'public final fun (): kotlin.collections.List.Test3> declared in .Test3' type=kotlin.collections.List.Test3> origin=GET_PROPERTY - $this: GET_VAR ': .Test3.Test3> declared in .Test3.component1' type=.Test3.Test3> origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.collections.List.Test3> visibility:private [final]' type=kotlin.collections.List.Test3> origin=null + receiver: GET_VAR ': .Test3.Test3> declared in .Test3.component1' type=.Test3.Test3> origin=null FUN name:copy visibility:public modality:FINAL <> ($this:.Test3.Test3>, x:kotlin.collections.List.Test3>) returnType:.Test3.Test3> $this: VALUE_PARAMETER name: type:.Test3.Test3> VALUE_PARAMETER name:x index:0 type:kotlin.collections.List.Test3> EXPRESSION_BODY - CALL 'public final fun (): kotlin.collections.List.Test3> declared in .Test3' type=kotlin.collections.List.Test3> origin=GET_PROPERTY - $this: GET_VAR ': .Test3.Test3> declared in .Test3.copy' type=.Test3.Test3> origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.collections.List.Test3> visibility:private [final]' type=kotlin.collections.List.Test3> origin=null + receiver: GET_VAR ': .Test3.Test3> declared in .Test3.copy' type=.Test3.Test3> origin=null BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun copy (x: kotlin.collections.List.Test3>): .Test3.Test3> declared in .Test3' CONSTRUCTOR_CALL 'public constructor (x: kotlin.collections.List.Test3>) [primary] declared in .Test3' type=.Test3.Test3> origin=null - : - x: CALL 'public final fun (): kotlin.collections.List.Test3> declared in .Test3' type=IrErrorType origin=GET_PROPERTY - $this: GET_VAR ': .Test3.Test3> declared in .Test3.copy' type=.Test3.Test3> origin=null + : kotlin.Any + x: GET_VAR 'x: kotlin.collections.List.Test3> declared in .Test3.copy' type=kotlin.collections.List.Test3> origin=null FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:.Test3.Test3>, other:kotlin.Any?) returnType:kotlin.Boolean $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test3.Test3> VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name:other index:0 type:kotlin.Any? @@ -288,19 +285,18 @@ FILE fqName: fileName:/dataClassesGeneric.kt $this: VALUE_PARAMETER name: type:.Test4 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.collections.List declared in .Test4' - CALL 'public final fun (): kotlin.collections.List declared in .Test4' type=kotlin.collections.List origin=GET_PROPERTY - $this: GET_VAR ': .Test4 declared in .Test4.component1' type=.Test4 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.collections.List visibility:private [final]' type=kotlin.collections.List origin=null + receiver: GET_VAR ': .Test4 declared in .Test4.component1' type=.Test4 origin=null FUN name:copy visibility:public modality:FINAL <> ($this:.Test4, x:kotlin.collections.List) returnType:.Test4 $this: VALUE_PARAMETER name: type:.Test4 VALUE_PARAMETER name:x index:0 type:kotlin.collections.List EXPRESSION_BODY - CALL 'public final fun (): kotlin.collections.List declared in .Test4' type=kotlin.collections.List origin=GET_PROPERTY - $this: GET_VAR ': .Test4 declared in .Test4.copy' type=.Test4 origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.collections.List visibility:private [final]' type=kotlin.collections.List origin=null + receiver: GET_VAR ': .Test4 declared in .Test4.copy' type=.Test4 origin=null BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun copy (x: kotlin.collections.List): .Test4 declared in .Test4' CONSTRUCTOR_CALL 'public constructor (x: kotlin.collections.List) [primary] declared in .Test4' type=.Test4 origin=null - x: CALL 'public final fun (): kotlin.collections.List declared in .Test4' type=IrErrorType origin=GET_PROPERTY - $this: GET_VAR ': .Test4 declared in .Test4.copy' type=.Test4 origin=null + x: GET_VAR 'x: kotlin.collections.List declared in .Test4.copy' type=kotlin.collections.List origin=null FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:.Test4, other:kotlin.Any?) returnType:kotlin.Boolean $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test4 VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name:other index:0 type:kotlin.Any? diff --git a/compiler/testData/ir/irText/classes/kt31649.fir.txt b/compiler/testData/ir/irText/classes/kt31649.fir.txt index 8a32e1cd57a..1a7068df6c7 100644 --- a/compiler/testData/ir/irText/classes/kt31649.fir.txt +++ b/compiler/testData/ir/irText/classes/kt31649.fir.txt @@ -21,19 +21,18 @@ FILE fqName: fileName:/kt31649.kt $this: VALUE_PARAMETER name: type:.TestData BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Nothing? declared in .TestData' - CALL 'public final fun (): kotlin.Nothing? declared in .TestData' type=kotlin.Nothing? origin=GET_PROPERTY - $this: GET_VAR ': .TestData declared in .TestData.component1' type=.TestData origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:nn type:kotlin.Nothing? visibility:private [final]' type=kotlin.Nothing? origin=null + receiver: GET_VAR ': .TestData declared in .TestData.component1' type=.TestData origin=null FUN name:copy visibility:public modality:FINAL <> ($this:.TestData, nn:kotlin.Nothing?) returnType:.TestData $this: VALUE_PARAMETER name: type:.TestData VALUE_PARAMETER name:nn index:0 type:kotlin.Nothing? EXPRESSION_BODY - CALL 'public final fun (): kotlin.Nothing? declared in .TestData' type=kotlin.Nothing? origin=GET_PROPERTY - $this: GET_VAR ': .TestData declared in .TestData.copy' type=.TestData origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:nn type:kotlin.Nothing? visibility:private [final]' type=kotlin.Nothing? origin=null + receiver: GET_VAR ': .TestData declared in .TestData.copy' type=.TestData origin=null BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun copy (nn: kotlin.Nothing?): .TestData declared in .TestData' CONSTRUCTOR_CALL 'public constructor (nn: kotlin.Nothing?) [primary] declared in .TestData' type=.TestData origin=null - nn: CALL 'public final fun (): kotlin.Nothing? declared in .TestData' type=IrErrorType origin=GET_PROPERTY - $this: GET_VAR ': .TestData declared in .TestData.copy' type=.TestData origin=null + nn: GET_VAR 'nn: kotlin.Nothing? declared in .TestData.copy' type=kotlin.Nothing? origin=null FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:.TestData, other:kotlin.Any?) returnType:kotlin.Boolean $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.TestData VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name:other index:0 type:kotlin.Any? diff --git a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.fir.txt b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.fir.txt index 44cf79ae263..fe04021f2a8 100644 --- a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.fir.txt +++ b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.fir.txt @@ -28,19 +28,18 @@ FILE fqName: fileName:/lambdaInDataClassDefaultParameter.kt $this: VALUE_PARAMETER name: type:.A BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Function2<.A, kotlin.String, kotlin.Unit> declared in .A' - CALL 'public final fun (): kotlin.Function2<.A, kotlin.String, kotlin.Unit> declared in .A' type=kotlin.Function2<.A, kotlin.String, kotlin.Unit> origin=GET_PROPERTY - $this: GET_VAR ': .A declared in .A.component1' type=.A origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:runA type:kotlin.Function2<.A, kotlin.String, kotlin.Unit> visibility:private [final]' type=kotlin.Function2<.A, kotlin.String, kotlin.Unit> origin=null + receiver: GET_VAR ': .A declared in .A.component1' type=.A origin=null FUN name:copy visibility:public modality:FINAL <> ($this:.A, runA:kotlin.Function2<.A, kotlin.String, kotlin.Unit>) returnType:.A $this: VALUE_PARAMETER name: type:.A VALUE_PARAMETER name:runA index:0 type:kotlin.Function2<.A, kotlin.String, kotlin.Unit> EXPRESSION_BODY - CALL 'public final fun (): kotlin.Function2<.A, kotlin.String, kotlin.Unit> declared in .A' type=kotlin.Function2<.A, kotlin.String, kotlin.Unit> origin=GET_PROPERTY - $this: GET_VAR ': .A declared in .A.copy' type=.A origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:runA type:kotlin.Function2<.A, kotlin.String, kotlin.Unit> visibility:private [final]' type=kotlin.Function2<.A, kotlin.String, kotlin.Unit> origin=null + receiver: GET_VAR ': .A declared in .A.copy' type=.A origin=null BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun copy (runA: kotlin.Function2<.A, kotlin.String, kotlin.Unit>): .A declared in .A' CONSTRUCTOR_CALL 'public constructor (runA: kotlin.Function2<.A, kotlin.String, kotlin.Unit>) [primary] declared in .A' type=.A origin=null - runA: CALL 'public final fun (): kotlin.Function2<.A, kotlin.String, kotlin.Unit> declared in .A' type=IrErrorType origin=GET_PROPERTY - $this: GET_VAR ': .A declared in .A.copy' type=.A origin=null + runA: GET_VAR 'runA: kotlin.Function2<.A, kotlin.String, kotlin.Unit> declared in .A.copy' type=kotlin.Function2<.A, kotlin.String, kotlin.Unit> origin=null FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:.A, other:kotlin.Any?) returnType:kotlin.Boolean $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.A VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name:other index:0 type:kotlin.Any? @@ -134,19 +133,18 @@ FILE fqName: fileName:/lambdaInDataClassDefaultParameter.kt $this: VALUE_PARAMETER name: type:.B BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Any declared in .B' - CALL 'public final fun (): kotlin.Any declared in .B' type=kotlin.Any origin=GET_PROPERTY - $this: GET_VAR ': .B declared in .B.component1' type=.B origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null + receiver: GET_VAR ': .B declared in .B.component1' type=.B origin=null FUN name:copy visibility:public modality:FINAL <> ($this:.B, x:kotlin.Any) returnType:.B $this: VALUE_PARAMETER name: type:.B VALUE_PARAMETER name:x index:0 type:kotlin.Any EXPRESSION_BODY - CALL 'public final fun (): kotlin.Any declared in .B' type=kotlin.Any origin=GET_PROPERTY - $this: GET_VAR ': .B declared in .B.copy' type=.B origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null + receiver: GET_VAR ': .B declared in .B.copy' type=.B origin=null BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun copy (x: kotlin.Any): .B declared in .B' CONSTRUCTOR_CALL 'public constructor (x: kotlin.Any) [primary] declared in .B' type=.B origin=null - x: CALL 'public final fun (): kotlin.Any declared in .B' type=IrErrorType origin=GET_PROPERTY - $this: GET_VAR ': .B declared in .B.copy' type=.B origin=null + x: GET_VAR 'x: kotlin.Any declared in .B.copy' type=kotlin.Any origin=null FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:.B, other:kotlin.Any?) returnType:kotlin.Boolean $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.B VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name:other index:0 type:kotlin.Any? diff --git a/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.fir.txt b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.fir.txt index 59a2c8223d4..3ddcb3359b4 100644 --- a/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.fir.txt +++ b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.fir.txt @@ -36,32 +36,30 @@ FILE fqName: fileName:/dataClassMembers.kt $this: VALUE_PARAMETER name: type:.Test.Test> BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component1 (): T of .Test declared in .Test' - CALL 'public final fun (): T of .Test declared in .Test' type=T of .Test origin=GET_PROPERTY - $this: GET_VAR ': .Test.Test> declared in .Test.component1' type=.Test.Test> origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:T of .Test visibility:private [final]' type=T of .Test origin=null + receiver: GET_VAR ': .Test.Test> declared in .Test.component1' type=.Test.Test> origin=null FUN name:component2 visibility:public modality:FINAL <> ($this:.Test.Test>) returnType:kotlin.String $this: VALUE_PARAMETER name: type:.Test.Test> BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component2 (): kotlin.String declared in .Test' - CALL 'public final fun (): kotlin.String declared in .Test' type=kotlin.String origin=GET_PROPERTY - $this: GET_VAR ': .Test.Test> declared in .Test.component2' type=.Test.Test> origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .Test.Test> declared in .Test.component2' type=.Test.Test> origin=null FUN name:copy visibility:public modality:FINAL <> ($this:.Test.Test>, x:T of .Test, y:kotlin.String) returnType:.Test.Test> $this: VALUE_PARAMETER name: type:.Test.Test> VALUE_PARAMETER name:x index:0 type:T of .Test EXPRESSION_BODY - CALL 'public final fun (): T of .Test declared in .Test' type=T of .Test origin=GET_PROPERTY - $this: GET_VAR ': .Test.Test> declared in .Test.copy' type=.Test.Test> origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:T of .Test visibility:private [final]' type=T of .Test origin=null + receiver: GET_VAR ': .Test.Test> declared in .Test.copy' type=.Test.Test> origin=null VALUE_PARAMETER name:y index:1 type:kotlin.String EXPRESSION_BODY - CALL 'public final fun (): kotlin.String declared in .Test' type=kotlin.String origin=GET_PROPERTY - $this: GET_VAR ': .Test.Test> declared in .Test.copy' type=.Test.Test> origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .Test.Test> declared in .Test.copy' type=.Test.Test> origin=null BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun copy (x: T of .Test, y: kotlin.String): .Test.Test> declared in .Test' CONSTRUCTOR_CALL 'public constructor (x: T of .Test, y: kotlin.String) [primary] declared in .Test' type=.Test.Test> origin=null - : - x: CALL 'public final fun (): T of .Test declared in .Test' type=IrErrorType origin=GET_PROPERTY - $this: GET_VAR ': .Test.Test> declared in .Test.copy' type=.Test.Test> origin=null - y: CALL 'public final fun (): kotlin.String declared in .Test' type=IrErrorType origin=GET_PROPERTY - $this: GET_VAR ': .Test.Test> declared in .Test.copy' type=.Test.Test> origin=null + : kotlin.Any + x: GET_VAR 'x: T of .Test declared in .Test.copy' type=T of .Test origin=null + y: GET_VAR 'y: kotlin.String declared in .Test.copy' type=kotlin.String origin=null FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:.Test.Test>, other:kotlin.Any?) returnType:kotlin.Boolean $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test.Test> VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name:other index:0 type:kotlin.Any? diff --git a/compiler/testData/ir/irText/lambdas/destructuringInLambda.fir.txt b/compiler/testData/ir/irText/lambdas/destructuringInLambda.fir.txt index a87683f8445..45cc97fea42 100644 --- a/compiler/testData/ir/irText/lambdas/destructuringInLambda.fir.txt +++ b/compiler/testData/ir/irText/lambdas/destructuringInLambda.fir.txt @@ -33,31 +33,29 @@ FILE fqName: fileName:/destructuringInLambda.kt $this: VALUE_PARAMETER name: type:.A BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Int declared in .A' - CALL 'public final fun (): kotlin.Int declared in .A' type=kotlin.Int origin=GET_PROPERTY - $this: GET_VAR ': .A declared in .A.component1' type=.A origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + receiver: GET_VAR ': .A declared in .A.component1' type=.A origin=null FUN name:component2 visibility:public modality:FINAL <> ($this:.A) returnType:kotlin.Int $this: VALUE_PARAMETER name: type:.A BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component2 (): kotlin.Int declared in .A' - CALL 'public final fun (): kotlin.Int declared in .A' type=kotlin.Int origin=GET_PROPERTY - $this: GET_VAR ': .A declared in .A.component2' type=.A origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + receiver: GET_VAR ': .A declared in .A.component2' type=.A origin=null FUN name:copy visibility:public modality:FINAL <> ($this:.A, x:kotlin.Int, y:kotlin.Int) returnType:.A $this: VALUE_PARAMETER name: type:.A VALUE_PARAMETER name:x index:0 type:kotlin.Int EXPRESSION_BODY - CALL 'public final fun (): kotlin.Int declared in .A' type=kotlin.Int origin=GET_PROPERTY - $this: GET_VAR ': .A declared in .A.copy' type=.A origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + receiver: GET_VAR ': .A declared in .A.copy' type=.A origin=null VALUE_PARAMETER name:y index:1 type:kotlin.Int EXPRESSION_BODY - CALL 'public final fun (): kotlin.Int declared in .A' type=kotlin.Int origin=GET_PROPERTY - $this: GET_VAR ': .A declared in .A.copy' type=.A origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + receiver: GET_VAR ': .A declared in .A.copy' type=.A origin=null BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun copy (x: kotlin.Int, y: kotlin.Int): .A declared in .A' CONSTRUCTOR_CALL 'public constructor (x: kotlin.Int, y: kotlin.Int) [primary] declared in .A' type=.A origin=null - x: CALL 'public final fun (): kotlin.Int declared in .A' type=IrErrorType origin=GET_PROPERTY - $this: GET_VAR ': .A declared in .A.copy' type=.A origin=null - y: CALL 'public final fun (): kotlin.Int declared in .A' type=IrErrorType origin=GET_PROPERTY - $this: GET_VAR ': .A declared in .A.copy' type=.A origin=null + x: GET_VAR 'x: kotlin.Int declared in .A.copy' type=kotlin.Int origin=null + y: GET_VAR 'y: kotlin.Int declared in .A.copy' type=kotlin.Int origin=null FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:.A, other:kotlin.Any?) returnType:kotlin.Boolean $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.A VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name:other index:0 type:kotlin.Any? diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.txt index acc5360dd92..755ef6f8e58 100644 --- a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.txt +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.txt @@ -148,31 +148,29 @@ FILE fqName: fileName:/enhancedNullabilityInForLoop.kt $this: VALUE_PARAMETER name: type:.P BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Int declared in .P' - CALL 'public final fun (): kotlin.Int declared in .P' type=kotlin.Int origin=GET_PROPERTY - $this: GET_VAR ': .P declared in .P.component1' type=.P origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + receiver: GET_VAR ': .P declared in .P.component1' type=.P origin=null FUN name:component2 visibility:public modality:FINAL <> ($this:.P) returnType:kotlin.Int $this: VALUE_PARAMETER name: type:.P BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component2 (): kotlin.Int declared in .P' - CALL 'public final fun (): kotlin.Int declared in .P' type=kotlin.Int origin=GET_PROPERTY - $this: GET_VAR ': .P declared in .P.component2' type=.P origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + receiver: GET_VAR ': .P declared in .P.component2' type=.P origin=null FUN name:copy visibility:public modality:FINAL <> ($this:.P, x:kotlin.Int, y:kotlin.Int) returnType:.P $this: VALUE_PARAMETER name: type:.P VALUE_PARAMETER name:x index:0 type:kotlin.Int EXPRESSION_BODY - CALL 'public final fun (): kotlin.Int declared in .P' type=kotlin.Int origin=GET_PROPERTY - $this: GET_VAR ': .P declared in .P.copy' type=.P origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + receiver: GET_VAR ': .P declared in .P.copy' type=.P origin=null VALUE_PARAMETER name:y index:1 type:kotlin.Int EXPRESSION_BODY - CALL 'public final fun (): kotlin.Int declared in .P' type=kotlin.Int origin=GET_PROPERTY - $this: GET_VAR ': .P declared in .P.copy' type=.P origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + receiver: GET_VAR ': .P declared in .P.copy' type=.P origin=null BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun copy (x: kotlin.Int, y: kotlin.Int): .P declared in .P' CONSTRUCTOR_CALL 'public constructor (x: kotlin.Int, y: kotlin.Int) [primary] declared in .P' type=.P origin=null - x: CALL 'public final fun (): kotlin.Int declared in .P' type=IrErrorType origin=GET_PROPERTY - $this: GET_VAR ': .P declared in .P.copy' type=.P origin=null - y: CALL 'public final fun (): kotlin.Int declared in .P' type=IrErrorType origin=GET_PROPERTY - $this: GET_VAR ': .P declared in .P.copy' type=.P origin=null + x: GET_VAR 'x: kotlin.Int declared in .P.copy' type=kotlin.Int origin=null + y: GET_VAR 'y: kotlin.Int declared in .P.copy' type=kotlin.Int origin=null FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:.P, other:kotlin.Any?) returnType:kotlin.Boolean $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.P VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name:other index:0 type:kotlin.Any?