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 66d8f54f0a3..ec6056da8b5 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 @@ -62,6 +62,11 @@ internal class ClassMemberGenerator( else -> null } } + // Add synthetic members *before* fake override generations. + // Otherwise, redundant members, e.g., synthetic toString _and_ fake override toString, will be added. + if (irClass.isData && klass.getPrimaryConstructorIfAny() != null) { + processedCallableNames += DataClassMembersGenerator(components).generateDataClassMembers(irClass) + } with(fakeOverrideGenerator) { irClass.addFakeOverrides(klass, processedCallableNames) } klass.declarations.forEach { if (it !is FirTypeAlias && (it !is FirConstructor || !it.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 new file mode 100644 index 00000000000..1f3dee6450c --- /dev/null +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DataClassMembersGenerator.kt @@ -0,0 +1,213 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +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.fir.backend.Fir2IrComponents +import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET +import org.jetbrains.kotlin.ir.builders.IrGeneratorContextBase +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.IrProperty +import org.jetbrains.kotlin.ir.declarations.MetadataSource +import org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl +import org.jetbrains.kotlin.ir.declarations.impl.IrValueParameterImpl +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.util.DataClassMembersGenerator +import org.jetbrains.kotlin.ir.util.defaultType +import org.jetbrains.kotlin.name.Name + +class DataClassMembersGenerator(val components: Fir2IrComponents) { + + // TODO: generateInlineClassMembers + + fun generateDataClassMembers(irClass: IrClass): List = + MyDataClassMethodsGenerator(irClass, IrDeclarationOrigin.GENERATED_DATA_CLASS_MEMBER).generate() + + private inner class MyDataClassMethodsGenerator( + val irClass: IrClass, + val origin: IrDeclarationOrigin + ) { + val properties = irClass.declarations.filterIsInstance().map { it.descriptor } + + private val irDataClassMembersGenerator = object : DataClassMembersGenerator( + IrGeneratorContextBase(components.irBuiltIns), + components.symbolTable, + irClass, + origin + ) { + override fun declareSimpleFunction(startOffset: Int, endOffset: Int, functionDescriptor: FunctionDescriptor): IrFunction { + throw IllegalStateException("Not expect to see function declaration.") + } + + override fun generateSyntheticFunctionParameterDeclarations(irFunction: IrFunction) { + // TODO + } + + override fun commitSubstituted(irMemberAccessExpression: IrMemberAccessExpression, descriptor: CallableDescriptor) { + // TODO + } + } + + fun generateDispatchReceiverParameter(irFunction: IrFunction, valueParameterDescriptor: WrappedValueParameterDescriptor) = + components.symbolTable.declareValueParameter( + UNDEFINED_OFFSET, + UNDEFINED_OFFSET, + origin, + valueParameterDescriptor, + components.irBuiltIns.anyNType + ) { symbol -> + IrValueParameterImpl( + UNDEFINED_OFFSET, + UNDEFINED_OFFSET, + origin, + symbol, + Name.special(""), + -1, + irClass.defaultType, + null, + isCrossinline = false, + isNoinline = false + ) + }.apply { + parent = irFunction + valueParameterDescriptor.bind(this) + } + + fun generate(): List { + if (properties.isEmpty()) { + return emptyList() + } + + // TODO: consolidate componentN() and copy(...) too? + + // TODO: generate equals, hashCode, and toString only if needed + val equalsDescriptor = WrappedSimpleFunctionDescriptor() + val equalsDispatchReceiverDescriptor = WrappedValueParameterDescriptor() + val equalsValueParameterDescriptor = WrappedValueParameterDescriptor() + val equalsFunction = + components.symbolTable.declareSimpleFunction(UNDEFINED_OFFSET, UNDEFINED_OFFSET, origin, equalsDescriptor) { symbol -> + IrFunctionImpl( + UNDEFINED_OFFSET, + UNDEFINED_OFFSET, + origin, + symbol, + Name.identifier("equals"), + Visibilities.PUBLIC, + Modality.OPEN, + components.irBuiltIns.booleanType, + isInline = false, + isExternal = false, + isTailrec = false, + isSuspend = false, + isExpect = false, + isFakeOverride = false, + isOperator = false + ).apply { + metadata = MetadataSource.Function(descriptor) + } + }.apply { + parent = irClass + equalsDescriptor.bind(this) + dispatchReceiverParameter = generateDispatchReceiverParameter(this, equalsDispatchReceiverDescriptor) + val irFunction = this + valueParameters += + components.symbolTable.declareValueParameter( + UNDEFINED_OFFSET, + UNDEFINED_OFFSET, + origin, + equalsValueParameterDescriptor, + components.irBuiltIns.anyNType + ) { symbol -> + IrValueParameterImpl( + UNDEFINED_OFFSET, + UNDEFINED_OFFSET, + origin, + symbol, + Name.identifier("other"), + 0, + components.irBuiltIns.anyNType, + null, + isCrossinline = false, + isNoinline = false + ) + }.apply { + parent = irFunction + equalsValueParameterDescriptor.bind(this) + } + } + irDataClassMembersGenerator.generateEqualsMethod(equalsFunction, properties) + + val hashCodeDescriptor = WrappedSimpleFunctionDescriptor() + val hashCodeDispatchReceiverDescriptor = WrappedValueParameterDescriptor() + val hashCodeFunction = + components.symbolTable.declareSimpleFunction(UNDEFINED_OFFSET, UNDEFINED_OFFSET, origin, hashCodeDescriptor) { symbol -> + IrFunctionImpl( + UNDEFINED_OFFSET, + UNDEFINED_OFFSET, + origin, + symbol, + Name.identifier("hashCode"), + Visibilities.PUBLIC, + Modality.OPEN, + components.irBuiltIns.intType, + isInline = false, + isExternal = false, + isTailrec = false, + isSuspend = false, + isExpect = false, + isFakeOverride = false, + isOperator = false + ).apply { + metadata = MetadataSource.Function(descriptor) + } + }.apply { + parent = irClass + hashCodeDescriptor.bind(this) + dispatchReceiverParameter = generateDispatchReceiverParameter(this, hashCodeDispatchReceiverDescriptor) + } + irDataClassMembersGenerator.generateHashCodeMethod(hashCodeFunction, properties) + + val toStringDescriptor = WrappedSimpleFunctionDescriptor() + val toStringDispatchReceiverDescriptor = WrappedValueParameterDescriptor() + val toStringFunction = + components.symbolTable.declareSimpleFunction(UNDEFINED_OFFSET, UNDEFINED_OFFSET, origin, toStringDescriptor) { symbol -> + IrFunctionImpl( + UNDEFINED_OFFSET, + UNDEFINED_OFFSET, + origin, + symbol, + Name.identifier("toString"), + Visibilities.PUBLIC, + Modality.OPEN, + components.irBuiltIns.stringType, + isInline = false, + isExternal = false, + isTailrec = false, + isSuspend = false, + isExpect = false, + isFakeOverride = false, + isOperator = false + ).apply { + metadata = MetadataSource.Function(descriptor) + } + }.apply { + parent = irClass + toStringDescriptor.bind(this) + dispatchReceiverParameter = generateDispatchReceiverParameter(this, toStringDispatchReceiverDescriptor) + } + irDataClassMembersGenerator.generateToStringMethod(toStringFunction, properties) + + return listOf(equalsFunction.name, hashCodeFunction.name, toStringFunction.name) + } + } +} \ No newline at end of file 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 1bca51c1696..dc8dd80a004 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 @@ -65,12 +65,6 @@ fun KtSecondaryConstructor.isConstructorDelegatingToSuper(bindingContext: Bindin } } -inline fun ClassDescriptor.findFirstFunction(name: String, predicate: (CallableMemberDescriptor) -> Boolean) = - unsubstitutedMemberScope.findFirstFunction(name, predicate) - -inline fun MemberScope.findFirstFunction(name: String, predicate: (CallableMemberDescriptor) -> Boolean) = - getContributedFunctions(Name.identifier(name), NoLookupLocation.FROM_BACKEND).first(predicate) - fun MemberScope.findSingleFunction(name: Name): FunctionDescriptor = getContributedFunctions(name, NoLookupLocation.FROM_BACKEND).single() 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 25e07e8f887..dce8f35bce2 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 @@ -18,9 +18,7 @@ package org.jetbrains.kotlin.psi2ir.generators import com.intellij.psi.PsiElement import org.jetbrains.kotlin.backend.common.DataClassMethodGenerator -import org.jetbrains.kotlin.builtins.KotlinBuiltIns 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.* import org.jetbrains.kotlin.ir.declarations.* @@ -29,23 +27,14 @@ 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.IrSimpleFunctionSymbol +import org.jetbrains.kotlin.ir.util.DataClassMembersGenerator import org.jetbrains.kotlin.ir.util.declareSimpleFunctionWithOverrides -import org.jetbrains.kotlin.ir.util.properties -import org.jetbrains.kotlin.ir.util.referenceFunction -import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.psi.KtClassOrObject import org.jetbrains.kotlin.psi.KtParameter -import org.jetbrains.kotlin.psi2ir.containsNull import org.jetbrains.kotlin.psi2ir.endOffsetOrUndefined -import org.jetbrains.kotlin.psi2ir.findFirstFunction import org.jetbrains.kotlin.psi2ir.startOffsetOrUndefined import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils -import org.jetbrains.kotlin.resolve.scopes.MemberScope -import org.jetbrains.kotlin.types.KotlinType -import org.jetbrains.kotlin.types.checker.KotlinTypeChecker -import org.jetbrains.kotlin.types.typeUtil.representativeUpperBound class DataClassMembersGenerator( declarationGenerator: DeclarationGenerator @@ -99,15 +88,6 @@ class DataClassMembersGenerator( irDispatchReceiverParameter.symbol ) } - - fun irOther(): IrExpression { - val irFirstParameter = irFunction.valueParameters[0] - return IrGetValueImpl( - startOffset, endOffset, - irFirstParameter.type, - irFirstParameter.symbol - ) - } } private inner class MyDataClassMethodGenerator( @@ -115,6 +95,20 @@ class DataClassMembersGenerator( val irClass: IrClass, val origin: IrDeclarationOrigin ) : DataClassMethodGenerator(ktClassOrObject, declarationGenerator.context.bindingContext) { + + private val irDataClassMembersGenerator = object : DataClassMembersGenerator(context, context.symbolTable, irClass, origin) { + override fun declareSimpleFunction(startOffset: Int, endOffset: Int, functionDescriptor: FunctionDescriptor): IrFunction = + declareSimpleFunction(startOffset, endOffset, origin, functionDescriptor) + + override fun generateSyntheticFunctionParameterDeclarations(irFunction: IrFunction) { + FunctionGenerator(declarationGenerator).generateSyntheticFunctionParameterDeclarations(irFunction) + } + + override fun commitSubstituted(irMemberAccessExpression: IrMemberAccessExpression, descriptor: CallableDescriptor) { + irMemberAccessExpression.commitSubstituted(descriptor) + } + } + private inline fun buildMember( function: FunctionDescriptor, psiElement: PsiElement? = null, @@ -144,12 +138,9 @@ class DataClassMembersGenerator( private fun getBackingField(parameter: ValueParameterDescriptor): IrField { val property = getOrFail(BindingContext.VALUE_PARAMETER_AS_PROPERTY, parameter) - return getBackingField(property) + return irDataClassMembersGenerator.getBackingField(property) } - private fun getBackingField(property: PropertyDescriptor) = - irClass.properties.single { it.descriptor == property }.backingField!! - override fun generateCopyFunction(function: FunctionDescriptor, constructorParameters: List) { if (!irClass.isData) return @@ -176,147 +167,13 @@ class DataClassMembersGenerator( } } - override fun generateEqualsMethod(function: FunctionDescriptor, properties: List) { - buildMember(function, declaration) { - val irType = classDescriptor.defaultType.toIrType() + override fun generateEqualsMethod(function: FunctionDescriptor, properties: List) = + irDataClassMembersGenerator.generateEqualsMethod(function, properties) - if (!irClass.isInline) { - +irIfThenReturnTrue(irEqeqeq(irThis(), irOther())) - } - +irIfThenReturnFalse(irNotIs(irOther(), irType)) - val otherWithCast = irTemporary(irAs(irOther(), irType), "other_with_cast") - for (property in properties) { - val field = getBackingField(property) - val arg1 = irGetField(irThis(), field) - val arg2 = irGetField(irGet(irType, otherWithCast.symbol), field) - +irIfThenReturnFalse(irNotEquals(arg1, arg2)) - } - +irReturnTrue() - } - } + override fun generateHashCodeMethod(function: FunctionDescriptor, properties: List) = + irDataClassMembersGenerator.generateHashCodeMethod(function, properties) - private val intClass = context.builtIns.int - private val intType = context.builtIns.intType - - private val intTimes = - intClass.findFirstFunction("times") { KotlinTypeChecker.DEFAULT.equalTypes(it.valueParameters[0].type, intType) } - .let { context.symbolTable.referenceFunction(it) } - - private val intPlus = - intClass.findFirstFunction("plus") { KotlinTypeChecker.DEFAULT.equalTypes(it.valueParameters[0].type, intType) } - .let { context.symbolTable.referenceFunction(it) } - - - private fun MemberScope.findHashCodeFunctionOrNull() = - getContributedFunctions(Name.identifier("hashCode"), NoLookupLocation.FROM_BACKEND) - .find { it.valueParameters.isEmpty() } - - private fun getHashCodeFunction( - type: KotlinType, - symbolResolve: (FunctionDescriptor) -> IrSimpleFunctionSymbol - ): IrSimpleFunctionSymbol = - when (val typeConstructorDescriptor = type.constructor.declarationDescriptor) { - is ClassDescriptor -> - if (KotlinBuiltIns.isArrayOrPrimitiveArray(typeConstructorDescriptor)) - context.irBuiltIns.dataClassArrayMemberHashCodeSymbol - else - symbolResolve( - type.memberScope.findHashCodeFunctionOrNull() - ?: context.builtIns.any.unsubstitutedMemberScope.findHashCodeFunctionOrNull()!! - ) - - is TypeParameterDescriptor -> - getHashCodeFunction(typeConstructorDescriptor.representativeUpperBound, symbolResolve) - - else -> - throw AssertionError("Unexpected type: $type") - } - - override fun generateHashCodeMethod(function: FunctionDescriptor, properties: List) { - buildMember(function, declaration) { - val irIntType = context.irBuiltIns.intType - var result: IrExpression? = null - for (property in properties) { - val hashCodeOfProperty = getHashCodeOfProperty(property) - result = if (result == null) { - hashCodeOfProperty - } else { - val shiftedResult = irCallOp(intTimes, irIntType, result, irInt(31)) - irCallOp(intPlus, irIntType, shiftedResult, hashCodeOfProperty) - } - } - +irReturn(result ?: irInt(0)) - } - } - - private fun MemberFunctionBuilder.getHashCodeOfProperty(property: PropertyDescriptor): IrExpression { - val field = getBackingField(property) - val propertyType = property.type - return when { - propertyType.containsNull() -> - irIfNull( - context.irBuiltIns.intType, - irGetField(irThis(), field), - irInt(0), - getHashCodeOf( - propertyType, - irGetField(irThis(), field) - ) - ) - else -> - getHashCodeOf( - propertyType, - irGetField(irThis(), field) - ) - } - } - - private fun MemberFunctionBuilder.getHashCodeOf(kotlinType: KotlinType, irValue: IrExpression): IrExpression { - var substituted: FunctionDescriptor? = null - val hashCodeFunctionSymbol = getHashCodeFunction(kotlinType) { - substituted = it - declarationGenerator.context.symbolTable.referenceSimpleFunction(it.original) - } - - return irCall(hashCodeFunctionSymbol, context.irBuiltIns.intType).apply { - if (hashCodeFunctionSymbol.descriptor.dispatchReceiverParameter != null) { - dispatchReceiver = irValue - } else { - putValueArgument(0, irValue) - } - commitSubstituted(substituted ?: hashCodeFunctionSymbol.descriptor) - } - } - - override fun generateToStringMethod(function: FunctionDescriptor, properties: List) { - buildMember(function, declaration) { - 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() + "=")) - - val irPropertyValue = irGetField(irThis(), getBackingField(property)) - - val typeConstructorDescriptor = property.type.constructor.declarationDescriptor - val irPropertyStringValue = - if (typeConstructorDescriptor is ClassDescriptor && - KotlinBuiltIns.isArrayOrPrimitiveArray(typeConstructorDescriptor) - ) - irCall(context.irBuiltIns.dataClassArrayMemberToStringSymbol, context.irBuiltIns.stringType).apply { - putValueArgument(0, irPropertyValue) - } - else - irPropertyValue - - irConcat.addArgument(irPropertyStringValue) - first = false - } - irConcat.addArgument(irString(")")) - +irReturn(irConcat) - } - } + override fun generateToStringMethod(function: FunctionDescriptor, properties: List) = + irDataClassMembersGenerator.generateToStringMethod(function, properties) } } 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 e165a02ea84..f6bb01765b9 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 @@ -22,7 +22,7 @@ import org.jetbrains.kotlin.ir.declarations.addMember import org.jetbrains.kotlin.ir.expressions.IrSyntheticBodyKind import org.jetbrains.kotlin.ir.expressions.impl.IrSyntheticBodyImpl import org.jetbrains.kotlin.ir.util.declareSimpleFunctionWithOverrides -import org.jetbrains.kotlin.psi2ir.findFirstFunction +import org.jetbrains.kotlin.ir.util.findFirstFunction class EnumClassMembersGenerator(declarationGenerator: DeclarationGenerator) : DeclarationGeneratorExtension(declarationGenerator) { fun generateSpecialMembers(irClass: IrClass) { 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 new file mode 100644 index 00000000000..24914813907 --- /dev/null +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DataClassMembersGenerator.kt @@ -0,0 +1,318 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +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.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.expressions.IrExpression +import org.jetbrains.kotlin.ir.expressions.IrMemberAccessExpression +import org.jetbrains.kotlin.ir.expressions.impl.IrGetValueImpl +import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol +import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol +import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.resolve.scopes.MemberScope +import org.jetbrains.kotlin.types.KotlinType +import org.jetbrains.kotlin.types.checker.KotlinTypeChecker +import org.jetbrains.kotlin.types.isNullable +import org.jetbrains.kotlin.types.typeUtil.representativeUpperBound + +abstract class DataClassMembersGenerator( + val context: IrGeneratorContext, + val symbolTable: SymbolTable, + val irClass: IrClass, + val origin: IrDeclarationOrigin +) { + + inline fun T.buildWithScope(builder: (T) -> Unit): T = + also { irDeclaration -> + symbolTable.withScope(irDeclaration.descriptor) { + builder(irDeclaration) + } + } + + private inner class MemberFunctionBuilder( + startOffset: Int = UNDEFINED_OFFSET, + endOffset: Int = UNDEFINED_OFFSET, + val irFunction: IrFunction + ) : 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 irThis(): IrExpression { + val irDispatchReceiverParameter = irFunction.dispatchReceiverParameter!! + return IrGetValueImpl( + startOffset, endOffset, + irDispatchReceiverParameter.type, + irDispatchReceiverParameter.symbol + ) + } + + fun irOther(): IrExpression { + val irFirstParameter = irFunction.valueParameters[0] + return IrGetValueImpl( + startOffset, endOffset, + irFirstParameter.type, + irFirstParameter.symbol + ) + } + + fun generateEqualsMethodBody(properties: List) { + val irType = irClass.defaultType + + if (!irClass.isInline) { + +irIfThenReturnTrue(irEqeqeq(irThis(), irOther())) + } + +irIfThenReturnFalse(irNotIs(irOther(), irType)) + val otherWithCast = irTemporary(irAs(irOther(), irType), "other_with_cast") + for (property in properties) { + val field = getBackingField(property) + val arg1 = irGetField(irThis(), field) + val arg2 = irGetField(irGet(irType, otherWithCast.symbol), field) + +irIfThenReturnFalse(irNotEquals(arg1, arg2)) + } + +irReturnTrue() + } + + private val intClass = context.builtIns.int + private val intType = context.builtIns.intType + + private val intTimesSymbol: IrFunctionSymbol = + intClass.findFirstFunction("times") { KotlinTypeChecker.DEFAULT.equalTypes(it.valueParameters[0].type, intType) } + .let { symbolTable.referenceFunction(it) } + + private val intPlusSymbol: IrFunctionSymbol = + intClass.findFirstFunction("plus") { KotlinTypeChecker.DEFAULT.equalTypes(it.valueParameters[0].type, intType) } + .let { symbolTable.referenceFunction(it) } + + fun generateHashCodeMethodBody(properties: List) { + val irIntType = context.irBuiltIns.intType + var result: IrExpression? = null + for (property in properties) { + val hashCodeOfProperty = getHashCodeOfProperty(property) + result = if (result == null) { + hashCodeOfProperty + } else { + val shiftedResult = irCallOp(intTimesSymbol, irIntType, result, irInt(31)) + irCallOp(intPlusSymbol, irIntType, shiftedResult, hashCodeOfProperty) + } + } + +irReturn(result ?: irInt(0)) + } + + private fun getHashCodeOfProperty(property: PropertyDescriptor): IrExpression { + val field = getBackingField(property) + return when { + property.type.isNullable() -> + irIfNull( + context.irBuiltIns.intType, + irGetField(irThis(), field), + irInt(0), + getHashCodeOf(property, irGetField(irThis(), field)) + ) + else -> + getHashCodeOf(property, irGetField(irThis(), field)) + } + } + + private fun getHashCodeOf(property: PropertyDescriptor, irValue: IrExpression): IrExpression { + var substituted: FunctionDescriptor? = null + val hashCodeFunctionSymbol = getHashCodeFunction(property) { + substituted = it + symbolTable.referenceSimpleFunction(it.original) + } + + return irCall(hashCodeFunctionSymbol, context.irBuiltIns.intType).apply { + if (hashCodeFunctionSymbol.descriptor.dispatchReceiverParameter != null) { + dispatchReceiver = irValue + } else { + putValueArgument(0, irValue) + } + commitSubstituted(this, substituted ?: hashCodeFunctionSymbol.descriptor) + } + } + + fun generateToStringMethodBody(properties: List) { + val irConcat = irConcat() + irConcat.addArgument(irString(irClass.descriptor.name.asString() + "(")) + var first = true + for (property in properties) { + if (!first) irConcat.addArgument(irString(", ")) + + irConcat.addArgument(irString(property.name.asString() + "=")) + + val irPropertyValue = irGetField(irThis(), getBackingField(property)) + + val typeConstructorDescriptor = property.type.constructor.declarationDescriptor + val irPropertyStringValue = + if (typeConstructorDescriptor is ClassDescriptor && + KotlinBuiltIns.isArrayOrPrimitiveArray(typeConstructorDescriptor) + ) + irCall(context.irBuiltIns.dataClassArrayMemberToStringSymbol, context.irBuiltIns.stringType).apply { + putValueArgument(0, irPropertyValue) + } + else + irPropertyValue + + irConcat.addArgument(irPropertyStringValue) + first = false + } + irConcat.addArgument(irString(")")) + +irReturn(irConcat) + } + } + + fun getBackingField(property: PropertyDescriptor): IrField = + irClass.properties.single { it.descriptor == property }.backingField!! + + abstract fun declareSimpleFunction(startOffset: Int, endOffset: Int, functionDescriptor: FunctionDescriptor): IrFunction + + abstract fun generateSyntheticFunctionParameterDeclarations(irFunction: IrFunction) + + // Build a member from a descriptor (psi2ir) as well as its body. + private inline fun buildMember( + function: FunctionDescriptor, + startOffset: Int = UNDEFINED_OFFSET, + endOffset: Int = UNDEFINED_OFFSET, + body: MemberFunctionBuilder.(IrFunction) -> Unit + ) { + MemberFunctionBuilder(startOffset, endOffset, declareSimpleFunction(startOffset, endOffset, function)).addToClass { irFunction -> + irFunction.buildWithScope { + generateSyntheticFunctionParameterDeclarations(irFunction) + body(irFunction) + } + } + } + + // Use a prebuilt member (fir2ir) and build a member body for it. + private inline fun buildMember( + irFunction: IrFunction, + startOffset: Int = UNDEFINED_OFFSET, + endOffset: Int = UNDEFINED_OFFSET, + body: MemberFunctionBuilder.(IrFunction) -> Unit + ) { + MemberFunctionBuilder(startOffset, endOffset, irFunction).addToClass { function -> + function.buildWithScope { + generateSyntheticFunctionParameterDeclarations(function) + body(function) + } + } + } + + // Entry for psi2ir + fun generateEqualsMethod(function: FunctionDescriptor, properties: List) { + buildMember(function, irClass.startOffset, irClass.endOffset) { + generateEqualsMethodBody(properties) + } + } + + // Entry for fir2ir + fun generateEqualsMethod(irFunction: IrFunction, properties: List) { + buildMember(irFunction, irClass.startOffset, irClass.endOffset) { + generateEqualsMethodBody(properties) + } + } + + private fun MemberScope.findHashCodeFunctionOrNull() = + getContributedFunctions(Name.identifier("hashCode"), NoLookupLocation.FROM_BACKEND) + .find { it.valueParameters.isEmpty() } + + private fun getHashCodeFunction(type: KotlinType): FunctionDescriptor = + type.memberScope.findHashCodeFunctionOrNull() + ?: context.builtIns.any.unsubstitutedMemberScope.findHashCodeFunctionOrNull()!! + + private fun getHashCodeFunction( + type: KotlinType, + symbolResolve: (FunctionDescriptor) -> IrSimpleFunctionSymbol + ): IrSimpleFunctionSymbol = + when (val typeConstructorDescriptor = type.constructor.declarationDescriptor) { + is ClassDescriptor -> + if (KotlinBuiltIns.isArrayOrPrimitiveArray(typeConstructorDescriptor)) + context.irBuiltIns.dataClassArrayMemberHashCodeSymbol + else + symbolResolve(getHashCodeFunction(type)) + + is TypeParameterDescriptor -> + getHashCodeFunction(typeConstructorDescriptor.representativeUpperBound, symbolResolve) + + else -> + throw AssertionError("Unexpected type: $type") + } + + private fun getHashCodeFunction( + property: PropertyDescriptor, + symbolResolve: (FunctionDescriptor) -> IrSimpleFunctionSymbol + ): IrSimpleFunctionSymbol = + getHashCodeFunction(property.type, symbolResolve) + + abstract fun commitSubstituted(irMemberAccessExpression: IrMemberAccessExpression, descriptor: CallableDescriptor) + + // Entry for psi2ir + fun generateHashCodeMethod(function: FunctionDescriptor, properties: List) { + buildMember(function, irClass.startOffset, irClass.endOffset) { + generateHashCodeMethodBody(properties) + } + } + + // Entry for fir2ir + fun generateHashCodeMethod(irFunction: IrFunction, properties: List) { + buildMember(irFunction, irClass.startOffset, irClass.endOffset) { + generateHashCodeMethodBody(properties) + } + } + + // Entry for psi2ir + fun generateToStringMethod(function: FunctionDescriptor, properties: List) { + buildMember(function, irClass.startOffset, irClass.endOffset) { + generateToStringMethodBody(properties) + } + } + + // Entry for fir2ir + fun generateToStringMethod(irFunction: IrFunction, properties: List) { + buildMember(irFunction, irClass.startOffset, irClass.endOffset) { + generateToStringMethodBody(properties) + } + } +} + diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinUtils.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinUtils.kt new file mode 100644 index 00000000000..885c264291f --- /dev/null +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/KotlinUtils.kt @@ -0,0 +1,18 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.ir.util + +import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor +import org.jetbrains.kotlin.descriptors.ClassDescriptor +import org.jetbrains.kotlin.incremental.components.NoLookupLocation +import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.resolve.scopes.MemberScope + +inline fun ClassDescriptor.findFirstFunction(name: String, predicate: (CallableMemberDescriptor) -> Boolean) = + unsubstitutedMemberScope.findFirstFunction(name, predicate) + +inline fun MemberScope.findFirstFunction(name: String, predicate: (CallableMemberDescriptor) -> Boolean) = + getContributedFunctions(Name.identifier(name), NoLookupLocation.FROM_BACKEND).first(predicate) \ No newline at end of file diff --git a/compiler/testData/codegen/box/callableReference/property/simpleMutableMember.kt b/compiler/testData/codegen/box/callableReference/property/simpleMutableMember.kt index 6c7497525e7..f7d815af3fc 100644 --- a/compiler/testData/codegen/box/callableReference/property/simpleMutableMember.kt +++ b/compiler/testData/codegen/box/callableReference/property/simpleMutableMember.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR data class Box(var value: String) fun box(): String { diff --git a/compiler/testData/codegen/box/callableReference/property/simpleMutableTopLevel.kt b/compiler/testData/codegen/box/callableReference/property/simpleMutableTopLevel.kt index 21bc40c8cf1..46abcebe5f9 100644 --- a/compiler/testData/codegen/box/callableReference/property/simpleMutableTopLevel.kt +++ b/compiler/testData/codegen/box/callableReference/property/simpleMutableTopLevel.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR data class Box(val value: String) var pr = Box("first") diff --git a/compiler/testData/codegen/box/callableReference/property/simpleTopLevel.kt b/compiler/testData/codegen/box/callableReference/property/simpleTopLevel.kt index 524b82910c5..818327da26f 100644 --- a/compiler/testData/codegen/box/callableReference/property/simpleTopLevel.kt +++ b/compiler/testData/codegen/box/callableReference/property/simpleTopLevel.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR data class Box(val value: String) val foo = Box("lol") diff --git a/compiler/testData/codegen/box/callableReference/serializability/boundWithSerializableReceiver.kt b/compiler/testData/codegen/box/callableReference/serializability/boundWithSerializableReceiver.kt index 88cf4382f61..11d4905cbe1 100644 --- a/compiler/testData/codegen/box/callableReference/serializability/boundWithSerializableReceiver.kt +++ b/compiler/testData/codegen/box/callableReference/serializability/boundWithSerializableReceiver.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT diff --git a/compiler/testData/codegen/box/dataClasses/doubleParam.kt b/compiler/testData/codegen/box/dataClasses/doubleParam.kt index 844226988c3..aa07eaa3fbc 100644 --- a/compiler/testData/codegen/box/dataClasses/doubleParam.kt +++ b/compiler/testData/codegen/box/dataClasses/doubleParam.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND: JS_IR // TODO: muted automatically, investigate should it be ran for JS or not // IGNORE_BACKEND: JS diff --git a/compiler/testData/codegen/box/dataClasses/equals/alreadyDeclared.kt b/compiler/testData/codegen/box/dataClasses/equals/alreadyDeclared.kt index 65e9e5b9bcf..400845b819f 100644 --- a/compiler/testData/codegen/box/dataClasses/equals/alreadyDeclared.kt +++ b/compiler/testData/codegen/box/dataClasses/equals/alreadyDeclared.kt @@ -1,3 +1,4 @@ +// IGNORE_BACKEND_FIR: JVM_IR data class A(val x: Int) { override fun equals(other: Any?): Boolean = false } diff --git a/compiler/testData/codegen/box/dataClasses/equals/genericarray.kt b/compiler/testData/codegen/box/dataClasses/equals/genericarray.kt index 2ae0a1a1d1f..eaf4b04032e 100644 --- a/compiler/testData/codegen/box/dataClasses/equals/genericarray.kt +++ b/compiler/testData/codegen/box/dataClasses/equals/genericarray.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR data class A(val v: Array) fun box() : String { diff --git a/compiler/testData/codegen/box/dataClasses/equals/intarray.kt b/compiler/testData/codegen/box/dataClasses/equals/intarray.kt index 8050037527f..85eb1bec509 100644 --- a/compiler/testData/codegen/box/dataClasses/equals/intarray.kt +++ b/compiler/testData/codegen/box/dataClasses/equals/intarray.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR data class A(val v: IntArray) fun box() : String { diff --git a/compiler/testData/codegen/box/dataClasses/floatParam.kt b/compiler/testData/codegen/box/dataClasses/floatParam.kt index e1f627c385d..402b0497d6a 100644 --- a/compiler/testData/codegen/box/dataClasses/floatParam.kt +++ b/compiler/testData/codegen/box/dataClasses/floatParam.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND: JS_IR // TODO: muted automatically, investigate should it be ran for JS or not // IGNORE_BACKEND: JS diff --git a/compiler/testData/codegen/box/dataClasses/hashCode/alreadyDeclared.kt b/compiler/testData/codegen/box/dataClasses/hashCode/alreadyDeclared.kt index ee7b621c974..37aa97dd82d 100644 --- a/compiler/testData/codegen/box/dataClasses/hashCode/alreadyDeclared.kt +++ b/compiler/testData/codegen/box/dataClasses/hashCode/alreadyDeclared.kt @@ -1,3 +1,4 @@ +// IGNORE_BACKEND_FIR: JVM_IR data class A(val x: Int) { override fun hashCode(): Int = -3 } diff --git a/compiler/testData/codegen/box/dataClasses/hashCode/alreadyDeclaredWrongSignature.kt b/compiler/testData/codegen/box/dataClasses/hashCode/alreadyDeclaredWrongSignature.kt index 45e58c65b38..2bba5bb2a1d 100644 --- a/compiler/testData/codegen/box/dataClasses/hashCode/alreadyDeclaredWrongSignature.kt +++ b/compiler/testData/codegen/box/dataClasses/hashCode/alreadyDeclaredWrongSignature.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/dataClasses/hashCode/boolean.kt b/compiler/testData/codegen/box/dataClasses/hashCode/boolean.kt index 2b7b6134e60..e231e75a57b 100644 --- a/compiler/testData/codegen/box/dataClasses/hashCode/boolean.kt +++ b/compiler/testData/codegen/box/dataClasses/hashCode/boolean.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR data class A(val a: Boolean) fun box() : String { diff --git a/compiler/testData/codegen/box/dataClasses/hashCode/byte.kt b/compiler/testData/codegen/box/dataClasses/hashCode/byte.kt index 04978d2e9bc..ce33977b555 100644 --- a/compiler/testData/codegen/box/dataClasses/hashCode/byte.kt +++ b/compiler/testData/codegen/box/dataClasses/hashCode/byte.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR data class A(val a: Byte) fun box() : String { diff --git a/compiler/testData/codegen/box/dataClasses/hashCode/char.kt b/compiler/testData/codegen/box/dataClasses/hashCode/char.kt index 39a32c43f7b..e2ac5e67291 100644 --- a/compiler/testData/codegen/box/dataClasses/hashCode/char.kt +++ b/compiler/testData/codegen/box/dataClasses/hashCode/char.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR data class A(val a: Char) fun box() : String { diff --git a/compiler/testData/codegen/box/dataClasses/hashCode/double.kt b/compiler/testData/codegen/box/dataClasses/hashCode/double.kt index 5bd0fbfaaf9..f0899ad1b59 100644 --- a/compiler/testData/codegen/box/dataClasses/hashCode/double.kt +++ b/compiler/testData/codegen/box/dataClasses/hashCode/double.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR data class A(val a: Double) fun box() : String { diff --git a/compiler/testData/codegen/box/dataClasses/hashCode/float.kt b/compiler/testData/codegen/box/dataClasses/hashCode/float.kt index 9320fb9a4f8..41dc25c43c4 100644 --- a/compiler/testData/codegen/box/dataClasses/hashCode/float.kt +++ b/compiler/testData/codegen/box/dataClasses/hashCode/float.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR data class A(val a: Float) fun box() : String { diff --git a/compiler/testData/codegen/box/dataClasses/hashCode/genericNull.kt b/compiler/testData/codegen/box/dataClasses/hashCode/genericNull.kt index b9e3d0940c4..6987eab9670 100644 --- a/compiler/testData/codegen/box/dataClasses/hashCode/genericNull.kt +++ b/compiler/testData/codegen/box/dataClasses/hashCode/genericNull.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR data class A(val t: T) fun box(): String { diff --git a/compiler/testData/codegen/box/dataClasses/hashCode/int.kt b/compiler/testData/codegen/box/dataClasses/hashCode/int.kt index d822992f7eb..0596e4c72af 100644 --- a/compiler/testData/codegen/box/dataClasses/hashCode/int.kt +++ b/compiler/testData/codegen/box/dataClasses/hashCode/int.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR data class A(val a: Int) fun box() : String { diff --git a/compiler/testData/codegen/box/dataClasses/hashCode/long.kt b/compiler/testData/codegen/box/dataClasses/hashCode/long.kt index 184713097c6..067593cb672 100644 --- a/compiler/testData/codegen/box/dataClasses/hashCode/long.kt +++ b/compiler/testData/codegen/box/dataClasses/hashCode/long.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR data class A(val a: Long) fun box() : String { diff --git a/compiler/testData/codegen/box/dataClasses/hashCode/short.kt b/compiler/testData/codegen/box/dataClasses/hashCode/short.kt index b6627d278e2..5e220e27cfc 100644 --- a/compiler/testData/codegen/box/dataClasses/hashCode/short.kt +++ b/compiler/testData/codegen/box/dataClasses/hashCode/short.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR data class A(val a: Short) fun box() : String { diff --git a/compiler/testData/codegen/box/dataClasses/kt5002.kt b/compiler/testData/codegen/box/dataClasses/kt5002.kt index 0a9384bc4fe..e162f9045ee 100644 --- a/compiler/testData/codegen/box/dataClasses/kt5002.kt +++ b/compiler/testData/codegen/box/dataClasses/kt5002.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM import java.io.Serializable diff --git a/compiler/testData/codegen/box/dataClasses/nonTrivialFinalMemberInSuperClass.kt b/compiler/testData/codegen/box/dataClasses/nonTrivialFinalMemberInSuperClass.kt index 4e655f2d38e..f16b89a55c5 100644 --- a/compiler/testData/codegen/box/dataClasses/nonTrivialFinalMemberInSuperClass.kt +++ b/compiler/testData/codegen/box/dataClasses/nonTrivialFinalMemberInSuperClass.kt @@ -1,3 +1,4 @@ +// IGNORE_BACKEND_FIR: JVM_IR abstract class Base { final override fun toString() = "OK" final override fun hashCode() = 42 diff --git a/compiler/testData/codegen/box/dataClasses/nonTrivialMemberInSuperClass.kt b/compiler/testData/codegen/box/dataClasses/nonTrivialMemberInSuperClass.kt index 1d047a93901..32287fbd597 100644 --- a/compiler/testData/codegen/box/dataClasses/nonTrivialMemberInSuperClass.kt +++ b/compiler/testData/codegen/box/dataClasses/nonTrivialMemberInSuperClass.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // See KT-6206 Always generate hashCode() and equals() for data classes even if base classes have non-trivial analogs abstract class Base { diff --git a/compiler/testData/codegen/box/dataClasses/privateValParams.kt b/compiler/testData/codegen/box/dataClasses/privateValParams.kt index 78343079c5b..d667588ab98 100644 --- a/compiler/testData/codegen/box/dataClasses/privateValParams.kt +++ b/compiler/testData/codegen/box/dataClasses/privateValParams.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR data class D(private val x: Long, private val y: Char) { fun foo() = "${component1()}${component2()}" } diff --git a/compiler/testData/codegen/box/dataClasses/toString/alreadyDeclared.kt b/compiler/testData/codegen/box/dataClasses/toString/alreadyDeclared.kt index f95ea92633c..cf068564eb3 100644 --- a/compiler/testData/codegen/box/dataClasses/toString/alreadyDeclared.kt +++ b/compiler/testData/codegen/box/dataClasses/toString/alreadyDeclared.kt @@ -1,3 +1,4 @@ +// IGNORE_BACKEND_FIR: JVM_IR data class A(val x: Int) { override fun toString(): String = "!" } diff --git a/compiler/testData/codegen/box/dataClasses/toString/alreadyDeclaredWrongSignature.kt b/compiler/testData/codegen/box/dataClasses/toString/alreadyDeclaredWrongSignature.kt index a30e1ad0360..e3e6d2c58bd 100644 --- a/compiler/testData/codegen/box/dataClasses/toString/alreadyDeclaredWrongSignature.kt +++ b/compiler/testData/codegen/box/dataClasses/toString/alreadyDeclaredWrongSignature.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/dataClasses/toString/arrayParams.kt b/compiler/testData/codegen/box/dataClasses/toString/arrayParams.kt index bdfacb901df..4e20f12a75d 100644 --- a/compiler/testData/codegen/box/dataClasses/toString/arrayParams.kt +++ b/compiler/testData/codegen/box/dataClasses/toString/arrayParams.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND: JS_IR // TODO: muted automatically, investigate should it be ran for JS or not // IGNORE_BACKEND: JS diff --git a/compiler/testData/codegen/box/dataClasses/toString/changingVarParam.kt b/compiler/testData/codegen/box/dataClasses/toString/changingVarParam.kt index 2e9df4d932c..0268af29435 100644 --- a/compiler/testData/codegen/box/dataClasses/toString/changingVarParam.kt +++ b/compiler/testData/codegen/box/dataClasses/toString/changingVarParam.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR data class A(var string: String) fun box(): String { diff --git a/compiler/testData/codegen/box/dataClasses/toString/genericParam.kt b/compiler/testData/codegen/box/dataClasses/toString/genericParam.kt index 6c0e401683b..794bad5dbe1 100644 --- a/compiler/testData/codegen/box/dataClasses/toString/genericParam.kt +++ b/compiler/testData/codegen/box/dataClasses/toString/genericParam.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR data class A(val x: T) fun box(): String { diff --git a/compiler/testData/codegen/box/dataClasses/toString/mixedParams.kt b/compiler/testData/codegen/box/dataClasses/toString/mixedParams.kt index cd4400a38e7..a8e9b7dbd20 100644 --- a/compiler/testData/codegen/box/dataClasses/toString/mixedParams.kt +++ b/compiler/testData/codegen/box/dataClasses/toString/mixedParams.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR data class A(var x: Int, val z: Int?) fun box(): String { diff --git a/compiler/testData/codegen/box/dataClasses/toString/unitComponent.kt b/compiler/testData/codegen/box/dataClasses/toString/unitComponent.kt index 8060a4d0fed..72e5965b320 100644 --- a/compiler/testData/codegen/box/dataClasses/toString/unitComponent.kt +++ b/compiler/testData/codegen/box/dataClasses/toString/unitComponent.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR data class A(val x: Unit) fun box(): String { diff --git a/compiler/testData/codegen/box/dataClasses/typeParameterWithNonTrivialBound.kt b/compiler/testData/codegen/box/dataClasses/typeParameterWithNonTrivialBound.kt index 6cc93d54bb5..c977a758222 100644 --- a/compiler/testData/codegen/box/dataClasses/typeParameterWithNonTrivialBound.kt +++ b/compiler/testData/codegen/box/dataClasses/typeParameterWithNonTrivialBound.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/ieee754/dataClass.kt b/compiler/testData/codegen/box/ieee754/dataClass.kt index 62f4029e110..8f05b07f453 100644 --- a/compiler/testData/codegen/box/ieee754/dataClass.kt +++ b/compiler/testData/codegen/box/ieee754/dataClass.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR data class Test(val z1: Double, val z2: Double?) fun box(): String { diff --git a/compiler/testData/codegen/box/javaInterop/objectMethods/cloneCallsConstructor.kt b/compiler/testData/codegen/box/javaInterop/objectMethods/cloneCallsConstructor.kt index 9379381bbe1..48225c0c8af 100644 --- a/compiler/testData/codegen/box/javaInterop/objectMethods/cloneCallsConstructor.kt +++ b/compiler/testData/codegen/box/javaInterop/objectMethods/cloneCallsConstructor.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND: JS_IR // TODO: muted automatically, investigate should it be ran for JS or not // IGNORE_BACKEND: JS, NATIVE diff --git a/compiler/testData/codegen/box/javaInterop/objectMethods/cloneCallsSuper.kt b/compiler/testData/codegen/box/javaInterop/objectMethods/cloneCallsSuper.kt index f5bc9031eb0..a88e9cc776e 100644 --- a/compiler/testData/codegen/box/javaInterop/objectMethods/cloneCallsSuper.kt +++ b/compiler/testData/codegen/box/javaInterop/objectMethods/cloneCallsSuper.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND: JS_IR // TODO: muted automatically, investigate should it be ran for JS or not // IGNORE_BACKEND: JS, NATIVE diff --git a/compiler/testData/codegen/box/javaInterop/objectMethods/cloneableClassWithoutClone.kt b/compiler/testData/codegen/box/javaInterop/objectMethods/cloneableClassWithoutClone.kt index cc160a0b62d..261c6f41fde 100644 --- a/compiler/testData/codegen/box/javaInterop/objectMethods/cloneableClassWithoutClone.kt +++ b/compiler/testData/codegen/box/javaInterop/objectMethods/cloneableClassWithoutClone.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND: JS_IR // TODO: muted automatically, investigate should it be ran for JS or not // IGNORE_BACKEND: JS, NATIVE diff --git a/compiler/testData/codegen/box/operatorConventions/augmentedAssignmentWithArrayLHS.kt b/compiler/testData/codegen/box/operatorConventions/augmentedAssignmentWithArrayLHS.kt index 3801ea310e9..0c80cc8edb7 100644 --- a/compiler/testData/codegen/box/operatorConventions/augmentedAssignmentWithArrayLHS.kt +++ b/compiler/testData/codegen/box/operatorConventions/augmentedAssignmentWithArrayLHS.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR var log = "" fun foo(): Int { diff --git a/compiler/testData/codegen/box/regressions/kt32949.kt b/compiler/testData/codegen/box/regressions/kt32949.kt index d451702bf00..aa36bd2b87c 100644 --- a/compiler/testData/codegen/box/regressions/kt32949.kt +++ b/compiler/testData/codegen/box/regressions/kt32949.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR class Binder() { lateinit var bindee: Container<*> diff --git a/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.fir.txt b/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.fir.txt index 59f3bc7a29e..67a0cfb673d 100644 --- a/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.fir.txt +++ b/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.fir.txt @@ -206,19 +206,224 @@ FILE fqName: fileName:/dataClassWithArrayMembers.kt 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 BLOCK_BODY - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - VALUE_PARAMETER name:other index:0 type:kotlin.Any? - FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] - overridden: - public open fun hashCode (): kotlin.Int declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any + 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? + BLOCK_BODY + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun EQEQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQEQ + arg0: GET_VAR ': .Test1 declared in .Test1.equals' type=.Test1 origin=null + arg1: GET_VAR 'other: kotlin.Any? declared in .Test1.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test1' + CONST Boolean type=kotlin.Boolean value=true + WHEN type=kotlin.Unit origin=null + BRANCH + if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=.Test1 + GET_VAR 'other: kotlin.Any? declared in .Test1.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test1' + CONST Boolean type=kotlin.Boolean value=false + VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:.Test1 [val] + TYPE_OP type=.Test1 origin=CAST typeOperand=.Test1 + GET_VAR 'other: kotlin.Any? declared in .Test1.equals' type=kotlin.Any? origin=null + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: 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.equals' type=.Test1 origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:stringArray type:kotlin.Array visibility:private [final]' type=kotlin.Array origin=null + receiver: GET_VAR 'val tmp_0: .Test1 [val] declared in .Test1.equals' type=.Test1 origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test1' + CONST Boolean type=kotlin.Boolean value=false + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: 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.equals' type=.Test1 origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:charArray type:kotlin.CharArray visibility:private [final]' type=kotlin.CharArray origin=null + receiver: GET_VAR 'val tmp_0: .Test1 [val] declared in .Test1.equals' type=.Test1 origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test1' + CONST Boolean type=kotlin.Boolean value=false + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: 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.equals' type=.Test1 origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:booleanArray type:kotlin.BooleanArray visibility:private [final]' type=kotlin.BooleanArray origin=null + receiver: GET_VAR 'val tmp_0: .Test1 [val] declared in .Test1.equals' type=.Test1 origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test1' + CONST Boolean type=kotlin.Boolean value=false + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: 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.equals' type=.Test1 origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:byteArray type:kotlin.ByteArray visibility:private [final]' type=kotlin.ByteArray origin=null + receiver: GET_VAR 'val tmp_0: .Test1 [val] declared in .Test1.equals' type=.Test1 origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test1' + CONST Boolean type=kotlin.Boolean value=false + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: 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.equals' type=.Test1 origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:shortArray type:kotlin.ShortArray visibility:private [final]' type=kotlin.ShortArray origin=null + receiver: GET_VAR 'val tmp_0: .Test1 [val] declared in .Test1.equals' type=.Test1 origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test1' + CONST Boolean type=kotlin.Boolean value=false + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: 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.equals' type=.Test1 origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:intArray type:kotlin.IntArray visibility:private [final]' type=kotlin.IntArray origin=null + receiver: GET_VAR 'val tmp_0: .Test1 [val] declared in .Test1.equals' type=.Test1 origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test1' + CONST Boolean type=kotlin.Boolean value=false + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: 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.equals' type=.Test1 origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:longArray type:kotlin.LongArray visibility:private [final]' type=kotlin.LongArray origin=null + receiver: GET_VAR 'val tmp_0: .Test1 [val] declared in .Test1.equals' type=.Test1 origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test1' + CONST Boolean type=kotlin.Boolean value=false + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: 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.equals' type=.Test1 origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:floatArray type:kotlin.FloatArray visibility:private [final]' type=kotlin.FloatArray origin=null + receiver: GET_VAR 'val tmp_0: .Test1 [val] declared in .Test1.equals' type=.Test1 origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test1' + CONST Boolean type=kotlin.Boolean value=false + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: 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.equals' type=.Test1 origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:doubleArray type:kotlin.DoubleArray visibility:private [final]' type=kotlin.DoubleArray origin=null + receiver: GET_VAR 'val tmp_0: .Test1 [val] declared in .Test1.equals' type=.Test1 origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test1' + CONST Boolean type=kotlin.Boolean value=false + RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test1' + CONST Boolean type=kotlin.Boolean value=true + FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:.Test1) returnType:kotlin.Int + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test1 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in .Test1' + CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun dataClassArrayMemberHashCode (arg0: kotlin.Any): kotlin.Int declared in kotlin.internal.ir' type=kotlin.Int origin=null + arg0: 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.hashCode' type=.Test1 origin=null + other: CONST Int type=kotlin.Int value=31 + other: CALL 'public final fun dataClassArrayMemberHashCode (arg0: kotlin.Any): kotlin.Int declared in kotlin.internal.ir' type=kotlin.Int origin=null + arg0: 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.hashCode' type=.Test1 origin=null + other: CONST Int type=kotlin.Int value=31 + other: CALL 'public final fun dataClassArrayMemberHashCode (arg0: kotlin.Any): kotlin.Int declared in kotlin.internal.ir' type=kotlin.Int origin=null + arg0: 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.hashCode' type=.Test1 origin=null + other: CONST Int type=kotlin.Int value=31 + other: CALL 'public final fun dataClassArrayMemberHashCode (arg0: kotlin.Any): kotlin.Int declared in kotlin.internal.ir' type=kotlin.Int origin=null + arg0: 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.hashCode' type=.Test1 origin=null + other: CONST Int type=kotlin.Int value=31 + other: CALL 'public final fun dataClassArrayMemberHashCode (arg0: kotlin.Any): kotlin.Int declared in kotlin.internal.ir' type=kotlin.Int origin=null + arg0: 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.hashCode' type=.Test1 origin=null + other: CONST Int type=kotlin.Int value=31 + other: CALL 'public final fun dataClassArrayMemberHashCode (arg0: kotlin.Any): kotlin.Int declared in kotlin.internal.ir' type=kotlin.Int origin=null + arg0: 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.hashCode' type=.Test1 origin=null + other: CONST Int type=kotlin.Int value=31 + other: CALL 'public final fun dataClassArrayMemberHashCode (arg0: kotlin.Any): kotlin.Int declared in kotlin.internal.ir' type=kotlin.Int origin=null + arg0: 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.hashCode' type=.Test1 origin=null + other: CONST Int type=kotlin.Int value=31 + other: CALL 'public final fun dataClassArrayMemberHashCode (arg0: kotlin.Any): kotlin.Int declared in kotlin.internal.ir' type=kotlin.Int origin=null + arg0: 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.hashCode' type=.Test1 origin=null + other: CONST Int type=kotlin.Int value=31 + other: CALL 'public final fun dataClassArrayMemberHashCode (arg0: kotlin.Any): kotlin.Int declared in kotlin.internal.ir' type=kotlin.Int origin=null + arg0: 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.hashCode' type=.Test1 origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:.Test1) returnType:kotlin.String + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test1 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in .Test1' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="Test1(" + CONST String type=kotlin.String value="stringArray=" + CALL 'public final fun dataClassArrayMemberToString (arg0: kotlin.Any?): kotlin.String declared in kotlin.internal.ir' type=kotlin.String origin=null + arg0: 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.toString' type=.Test1 origin=null + CONST String type=kotlin.String value=", " + CONST String type=kotlin.String value="charArray=" + CALL 'public final fun dataClassArrayMemberToString (arg0: kotlin.Any?): kotlin.String declared in kotlin.internal.ir' type=kotlin.String origin=null + arg0: 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.toString' type=.Test1 origin=null + CONST String type=kotlin.String value=", " + CONST String type=kotlin.String value="booleanArray=" + CALL 'public final fun dataClassArrayMemberToString (arg0: kotlin.Any?): kotlin.String declared in kotlin.internal.ir' type=kotlin.String origin=null + arg0: 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.toString' type=.Test1 origin=null + CONST String type=kotlin.String value=", " + CONST String type=kotlin.String value="byteArray=" + CALL 'public final fun dataClassArrayMemberToString (arg0: kotlin.Any?): kotlin.String declared in kotlin.internal.ir' type=kotlin.String origin=null + arg0: 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.toString' type=.Test1 origin=null + CONST String type=kotlin.String value=", " + CONST String type=kotlin.String value="shortArray=" + CALL 'public final fun dataClassArrayMemberToString (arg0: kotlin.Any?): kotlin.String declared in kotlin.internal.ir' type=kotlin.String origin=null + arg0: 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.toString' type=.Test1 origin=null + CONST String type=kotlin.String value=", " + CONST String type=kotlin.String value="intArray=" + CALL 'public final fun dataClassArrayMemberToString (arg0: kotlin.Any?): kotlin.String declared in kotlin.internal.ir' type=kotlin.String origin=null + arg0: 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.toString' type=.Test1 origin=null + CONST String type=kotlin.String value=", " + CONST String type=kotlin.String value="longArray=" + CALL 'public final fun dataClassArrayMemberToString (arg0: kotlin.Any?): kotlin.String declared in kotlin.internal.ir' type=kotlin.String origin=null + arg0: 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.toString' type=.Test1 origin=null + CONST String type=kotlin.String value=", " + CONST String type=kotlin.String value="floatArray=" + CALL 'public final fun dataClassArrayMemberToString (arg0: kotlin.Any?): kotlin.String declared in kotlin.internal.ir' type=kotlin.String origin=null + arg0: 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.toString' type=.Test1 origin=null + CONST String type=kotlin.String value=", " + CONST String type=kotlin.String value="doubleArray=" + CALL 'public final fun dataClassArrayMemberToString (arg0: kotlin.Any?): kotlin.String declared in kotlin.internal.ir' type=kotlin.String origin=null + arg0: 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.toString' type=.Test1 origin=null + CONST String type=kotlin.String value=")" CLASS CLASS name:Test2 modality:FINAL visibility:public [data] superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Test2.Test2> TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] @@ -251,19 +456,56 @@ FILE fqName: fileName:/dataClassWithArrayMembers.kt 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 BLOCK_BODY - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - VALUE_PARAMETER name:other index:0 type:kotlin.Any? - FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] - overridden: - public open fun hashCode (): kotlin.Int declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any + 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? + BLOCK_BODY + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun EQEQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQEQ + arg0: GET_VAR ': .Test2.Test2> declared in .Test2.equals' type=.Test2.Test2> origin=null + arg1: GET_VAR 'other: kotlin.Any? declared in .Test2.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test2' + CONST Boolean type=kotlin.Boolean value=true + WHEN type=kotlin.Unit origin=null + BRANCH + if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=.Test2.Test2> + GET_VAR 'other: kotlin.Any? declared in .Test2.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test2' + CONST Boolean type=kotlin.Boolean value=false + VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:.Test2.Test2> [val] + TYPE_OP type=.Test2.Test2> origin=CAST typeOperand=.Test2.Test2> + GET_VAR 'other: kotlin.Any? declared in .Test2.equals' type=kotlin.Any? origin=null + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: 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.equals' type=.Test2.Test2> origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:genericArray type:kotlin.Array.Test2> visibility:private [final]' type=kotlin.Array.Test2> origin=null + receiver: GET_VAR 'val tmp_1: .Test2.Test2> [val] declared in .Test2.equals' type=.Test2.Test2> origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test2' + CONST Boolean type=kotlin.Boolean value=false + RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test2' + CONST Boolean type=kotlin.Boolean value=true + FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:.Test2.Test2>) returnType:kotlin.Int + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test2.Test2> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in .Test2' + CALL 'public final fun dataClassArrayMemberHashCode (arg0: kotlin.Any): kotlin.Int declared in kotlin.internal.ir' type=kotlin.Int origin=null + arg0: 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.hashCode' type=.Test2.Test2> origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:.Test2.Test2>) returnType:kotlin.String + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test2.Test2> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in .Test2' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="Test2(" + CONST String type=kotlin.String value="genericArray=" + CALL 'public final fun dataClassArrayMemberToString (arg0: kotlin.Any?): kotlin.String declared in kotlin.internal.ir' type=kotlin.String origin=null + arg0: 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.toString' type=.Test2.Test2> origin=null + CONST String type=kotlin.String value=")" CLASS CLASS name:Test3 modality:FINAL visibility:public [data] superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Test3 CONSTRUCTOR visibility:public <> (anyArrayN:kotlin.Array?) returnType:.Test3 [primary] @@ -295,16 +537,62 @@ FILE fqName: fileName:/dataClassWithArrayMembers.kt 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 BLOCK_BODY - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - VALUE_PARAMETER name:other index:0 type:kotlin.Any? - FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] - overridden: - public open fun hashCode (): kotlin.Int declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any + 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? + BLOCK_BODY + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun EQEQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQEQ + arg0: GET_VAR ': .Test3 declared in .Test3.equals' type=.Test3 origin=null + arg1: GET_VAR 'other: kotlin.Any? declared in .Test3.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test3' + CONST Boolean type=kotlin.Boolean value=true + WHEN type=kotlin.Unit origin=null + BRANCH + if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=.Test3 + GET_VAR 'other: kotlin.Any? declared in .Test3.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test3' + CONST Boolean type=kotlin.Boolean value=false + VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:.Test3 [val] + TYPE_OP type=.Test3 origin=CAST typeOperand=.Test3 + GET_VAR 'other: kotlin.Any? declared in .Test3.equals' type=kotlin.Any? origin=null + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: 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.equals' type=.Test3 origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:anyArrayN type:kotlin.Array? visibility:private [final]' type=kotlin.Array? origin=null + receiver: GET_VAR 'val tmp_2: .Test3 [val] declared in .Test3.equals' type=.Test3 origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test3' + CONST Boolean type=kotlin.Boolean value=false + RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test3' + CONST Boolean type=kotlin.Boolean value=true + FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:.Test3) returnType:kotlin.Int + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test3 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in .Test3' + WHEN type=kotlin.Int origin=null + BRANCH + if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ + arg0: GET_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.hashCode' type=.Test3 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 'public final fun dataClassArrayMemberHashCode (arg0: kotlin.Any): kotlin.Int declared in kotlin.internal.ir' type=kotlin.Int origin=null + arg0: 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.hashCode' type=.Test3 origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:.Test3) returnType:kotlin.String + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test3 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in .Test3' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="Test3(" + CONST String type=kotlin.String value="anyArrayN=" + CALL 'public final fun dataClassArrayMemberToString (arg0: kotlin.Any?): kotlin.String declared in kotlin.internal.ir' type=kotlin.String origin=null + arg0: 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.toString' type=.Test3 origin=null + CONST String type=kotlin.String value=")" diff --git a/compiler/testData/ir/irText/classes/dataClasses.fir.txt b/compiler/testData/ir/irText/classes/dataClasses.fir.txt index 04739b99da9..d79632a0294 100644 --- a/compiler/testData/ir/irText/classes/dataClasses.fir.txt +++ b/compiler/testData/ir/irText/classes/dataClasses.fir.txt @@ -74,19 +74,95 @@ FILE fqName: fileName:/dataClasses.kt 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 BLOCK_BODY - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - VALUE_PARAMETER name:other index:0 type:kotlin.Any? - FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] - overridden: - public open fun hashCode (): kotlin.Int declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any + 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? + BLOCK_BODY + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun EQEQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQEQ + arg0: GET_VAR ': .Test1 declared in .Test1.equals' type=.Test1 origin=null + arg1: GET_VAR 'other: kotlin.Any? declared in .Test1.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test1' + CONST Boolean type=kotlin.Boolean value=true + WHEN type=kotlin.Unit origin=null + BRANCH + if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=.Test1 + GET_VAR 'other: kotlin.Any? declared in .Test1.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test1' + CONST Boolean type=kotlin.Boolean value=false + VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:.Test1 [val] + TYPE_OP type=.Test1 origin=CAST typeOperand=.Test1 + GET_VAR 'other: kotlin.Any? declared in .Test1.equals' type=kotlin.Any? origin=null + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: 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.equals' type=.Test1 origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + receiver: GET_VAR 'val tmp_0: .Test1 [val] declared in .Test1.equals' type=.Test1 origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test1' + CONST Boolean type=kotlin.Boolean value=false + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: 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.equals' type=.Test1 origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR 'val tmp_0: .Test1 [val] declared in .Test1.equals' type=.Test1 origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test1' + CONST Boolean type=kotlin.Boolean value=false + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: 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.equals' type=.Test1 origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:z type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null + receiver: GET_VAR 'val tmp_0: .Test1 [val] declared in .Test1.equals' type=.Test1 origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test1' + CONST Boolean type=kotlin.Boolean value=false + RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test1' + CONST Boolean type=kotlin.Boolean value=true + FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:.Test1) returnType:kotlin.Int + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test1 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in .Test1' + CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.Int' type=kotlin.Int origin=null + $this: 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.hashCode' type=.Test1 origin=null + other: CONST Int type=kotlin.Int value=31 + other: CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.String' type=kotlin.Int origin=null + $this: 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.hashCode' type=.Test1 origin=null + other: CONST Int type=kotlin.Int value=31 + other: CALL 'public open fun hashCode (): kotlin.Int declared in kotlin.Any' type=kotlin.Int origin=null + $this: 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.hashCode' type=.Test1 origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:.Test1) returnType:kotlin.String + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test1 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in .Test1' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="Test1(" + CONST String type=kotlin.String value="x=" + 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.toString' type=.Test1 origin=null + CONST String type=kotlin.String value=", " + CONST String type=kotlin.String value="y=" + 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.toString' type=.Test1 origin=null + CONST String type=kotlin.String value=", " + CONST String type=kotlin.String value="z=" + 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.toString' type=.Test1 origin=null + CONST String type=kotlin.String value=")" CLASS CLASS name:Test2 modality:FINAL visibility:public [data] superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Test2 CONSTRUCTOR visibility:public <> (x:kotlin.Any?) returnType:.Test2 [primary] @@ -118,19 +194,64 @@ FILE fqName: fileName:/dataClasses.kt 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 BLOCK_BODY - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - VALUE_PARAMETER name:other index:0 type:kotlin.Any? - FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] - overridden: - public open fun hashCode (): kotlin.Int declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any + 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? + BLOCK_BODY + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun EQEQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQEQ + arg0: GET_VAR ': .Test2 declared in .Test2.equals' type=.Test2 origin=null + arg1: GET_VAR 'other: kotlin.Any? declared in .Test2.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test2' + CONST Boolean type=kotlin.Boolean value=true + WHEN type=kotlin.Unit origin=null + BRANCH + if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=.Test2 + GET_VAR 'other: kotlin.Any? declared in .Test2.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test2' + CONST Boolean type=kotlin.Boolean value=false + VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:.Test2 [val] + TYPE_OP type=.Test2 origin=CAST typeOperand=.Test2 + GET_VAR 'other: kotlin.Any? declared in .Test2.equals' type=kotlin.Any? origin=null + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: 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.equals' type=.Test2 origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Any? visibility:private [final]' type=kotlin.Any? origin=null + receiver: GET_VAR 'val tmp_1: .Test2 [val] declared in .Test2.equals' type=.Test2 origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test2' + CONST Boolean type=kotlin.Boolean value=false + RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test2' + CONST Boolean type=kotlin.Boolean value=true + FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:.Test2) returnType:kotlin.Int + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test2 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in .Test2' + WHEN type=kotlin.Int origin=null + BRANCH + if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ + arg0: GET_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.hashCode' type=.Test2 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 'public open fun hashCode (): kotlin.Int declared in kotlin.Any' type=kotlin.Int origin=null + $this: 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.hashCode' type=.Test2 origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:.Test2) returnType:kotlin.String + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test2 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in .Test2' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="Test2(" + CONST String type=kotlin.String value="x=" + 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.toString' type=.Test2 origin=null + CONST String type=kotlin.String value=")" CLASS CLASS name:Test3 modality:FINAL visibility:public [data] superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Test3 CONSTRUCTOR visibility:public <> (d:kotlin.Double, dn:kotlin.Double?, f:kotlin.Float, df:kotlin.Float?) returnType:.Test3 [primary] @@ -228,16 +349,130 @@ FILE fqName: fileName:/dataClasses.kt 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 BLOCK_BODY - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - VALUE_PARAMETER name:other index:0 type:kotlin.Any? - FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] - overridden: - public open fun hashCode (): kotlin.Int declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any + 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? + BLOCK_BODY + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun EQEQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQEQ + arg0: GET_VAR ': .Test3 declared in .Test3.equals' type=.Test3 origin=null + arg1: GET_VAR 'other: kotlin.Any? declared in .Test3.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test3' + CONST Boolean type=kotlin.Boolean value=true + WHEN type=kotlin.Unit origin=null + BRANCH + if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=.Test3 + GET_VAR 'other: kotlin.Any? declared in .Test3.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test3' + CONST Boolean type=kotlin.Boolean value=false + VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:.Test3 [val] + TYPE_OP type=.Test3 origin=CAST typeOperand=.Test3 + GET_VAR 'other: kotlin.Any? declared in .Test3.equals' type=kotlin.Any? origin=null + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: 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.equals' type=.Test3 origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:d type:kotlin.Double visibility:private [final]' type=kotlin.Double origin=null + receiver: GET_VAR 'val tmp_2: .Test3 [val] declared in .Test3.equals' type=.Test3 origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test3' + CONST Boolean type=kotlin.Boolean value=false + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: 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.equals' type=.Test3 origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:dn type:kotlin.Double? visibility:private [final]' type=kotlin.Double? origin=null + receiver: GET_VAR 'val tmp_2: .Test3 [val] declared in .Test3.equals' type=.Test3 origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test3' + CONST Boolean type=kotlin.Boolean value=false + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: 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.equals' type=.Test3 origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:f type:kotlin.Float visibility:private [final]' type=kotlin.Float origin=null + receiver: GET_VAR 'val tmp_2: .Test3 [val] declared in .Test3.equals' type=.Test3 origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test3' + CONST Boolean type=kotlin.Boolean value=false + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: 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.equals' type=.Test3 origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:df type:kotlin.Float? visibility:private [final]' type=kotlin.Float? origin=null + receiver: GET_VAR 'val tmp_2: .Test3 [val] declared in .Test3.equals' type=.Test3 origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test3' + CONST Boolean type=kotlin.Boolean value=false + RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test3' + CONST Boolean type=kotlin.Boolean value=true + FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:.Test3) returnType:kotlin.Int + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test3 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in .Test3' + CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.Double' type=kotlin.Int origin=null + $this: 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.hashCode' type=.Test3 origin=null + other: CONST Int type=kotlin.Int value=31 + other: WHEN type=kotlin.Int origin=null + BRANCH + if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ + arg0: GET_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.hashCode' type=.Test3 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 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.Double' type=kotlin.Int origin=null + $this: 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.hashCode' type=.Test3 origin=null + other: CONST Int type=kotlin.Int value=31 + other: CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.Float' type=kotlin.Int origin=null + $this: 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.hashCode' type=.Test3 origin=null + other: CONST Int type=kotlin.Int value=31 + other: WHEN type=kotlin.Int origin=null + BRANCH + if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ + arg0: GET_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.hashCode' type=.Test3 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 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.Float' type=kotlin.Int origin=null + $this: 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.hashCode' type=.Test3 origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:.Test3) returnType:kotlin.String + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test3 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in .Test3' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="Test3(" + CONST String type=kotlin.String value="d=" + 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.toString' type=.Test3 origin=null + CONST String type=kotlin.String value=", " + CONST String type=kotlin.String value="dn=" + 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.toString' type=.Test3 origin=null + CONST String type=kotlin.String value=", " + CONST String type=kotlin.String value="f=" + 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.toString' type=.Test3 origin=null + CONST String type=kotlin.String value=", " + CONST String type=kotlin.String value="df=" + 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.toString' type=.Test3 origin=null + CONST String type=kotlin.String value=")" diff --git a/compiler/testData/ir/irText/classes/dataClassesGeneric.fir.txt b/compiler/testData/ir/irText/classes/dataClassesGeneric.fir.txt index 419e1debcc5..9a574361354 100644 --- a/compiler/testData/ir/irText/classes/dataClassesGeneric.fir.txt +++ b/compiler/testData/ir/irText/classes/dataClassesGeneric.fir.txt @@ -31,19 +31,64 @@ FILE fqName: fileName:/dataClassesGeneric.kt 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 BLOCK_BODY - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - VALUE_PARAMETER name:other index:0 type:kotlin.Any? - FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] - overridden: - public open fun hashCode (): kotlin.Int declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any + 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? + BLOCK_BODY + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun EQEQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQEQ + arg0: GET_VAR ': .Test1.Test1> declared in .Test1.equals' type=.Test1.Test1> origin=null + arg1: GET_VAR 'other: kotlin.Any? declared in .Test1.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test1' + CONST Boolean type=kotlin.Boolean value=true + WHEN type=kotlin.Unit origin=null + BRANCH + if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=.Test1.Test1> + GET_VAR 'other: kotlin.Any? declared in .Test1.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test1' + CONST Boolean type=kotlin.Boolean value=false + VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:.Test1.Test1> [val] + TYPE_OP type=.Test1.Test1> origin=CAST typeOperand=.Test1.Test1> + GET_VAR 'other: kotlin.Any? declared in .Test1.equals' type=kotlin.Any? origin=null + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: 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.equals' type=.Test1.Test1> origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:T of .Test1 visibility:private [final]' type=T of .Test1 origin=null + receiver: GET_VAR 'val tmp_0: .Test1.Test1> [val] declared in .Test1.equals' type=.Test1.Test1> origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test1' + CONST Boolean type=kotlin.Boolean value=false + RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test1' + CONST Boolean type=kotlin.Boolean value=true + FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:.Test1.Test1>) returnType:kotlin.Int + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test1.Test1> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in .Test1' + WHEN type=kotlin.Int origin=null + BRANCH + if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ + arg0: GET_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.hashCode' type=.Test1.Test1> 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 'public open fun hashCode (): kotlin.Int declared in kotlin.Any' type=kotlin.Int origin=null + $this: 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.hashCode' type=.Test1.Test1> origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:.Test1.Test1>) returnType:kotlin.String + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test1.Test1> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in .Test1' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="Test1(" + CONST String type=kotlin.String value="x=" + 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.toString' type=.Test1.Test1> origin=null + CONST String type=kotlin.String value=")" CLASS CLASS name:Test2 modality:FINAL visibility:public [data] superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Test2.Test2> TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Number] @@ -76,19 +121,55 @@ FILE fqName: fileName:/dataClassesGeneric.kt 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 BLOCK_BODY - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - VALUE_PARAMETER name:other index:0 type:kotlin.Any? - FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] - overridden: - public open fun hashCode (): kotlin.Int declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any + 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? + BLOCK_BODY + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun EQEQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQEQ + arg0: GET_VAR ': .Test2.Test2> declared in .Test2.equals' type=.Test2.Test2> origin=null + arg1: GET_VAR 'other: kotlin.Any? declared in .Test2.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test2' + CONST Boolean type=kotlin.Boolean value=true + WHEN type=kotlin.Unit origin=null + BRANCH + if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=.Test2.Test2> + GET_VAR 'other: kotlin.Any? declared in .Test2.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test2' + CONST Boolean type=kotlin.Boolean value=false + VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:.Test2.Test2> [val] + TYPE_OP type=.Test2.Test2> origin=CAST typeOperand=.Test2.Test2> + GET_VAR 'other: kotlin.Any? declared in .Test2.equals' type=kotlin.Any? origin=null + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: 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.equals' type=.Test2.Test2> origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:T of .Test2 visibility:private [final]' type=T of .Test2 origin=null + receiver: GET_VAR 'val tmp_1: .Test2.Test2> [val] declared in .Test2.equals' type=.Test2.Test2> origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test2' + CONST Boolean type=kotlin.Boolean value=false + RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test2' + CONST Boolean type=kotlin.Boolean value=true + FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:.Test2.Test2>) returnType:kotlin.Int + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test2.Test2> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in .Test2' + CALL 'public open fun hashCode (): kotlin.Int declared in kotlin.Any' type=kotlin.Int origin=null + $this: 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.hashCode' type=.Test2.Test2> origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:.Test2.Test2>) returnType:kotlin.String + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test2.Test2> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in .Test2' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="Test2(" + CONST String type=kotlin.String value="x=" + 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.toString' type=.Test2.Test2> origin=null + CONST String type=kotlin.String value=")" CLASS CLASS name:Test3 modality:FINAL visibility:public [data] superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Test3.Test3> TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] @@ -121,19 +202,55 @@ FILE fqName: fileName:/dataClassesGeneric.kt 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 BLOCK_BODY - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - VALUE_PARAMETER name:other index:0 type:kotlin.Any? - FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] - overridden: - public open fun hashCode (): kotlin.Int declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any + 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? + BLOCK_BODY + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun EQEQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQEQ + arg0: GET_VAR ': .Test3.Test3> declared in .Test3.equals' type=.Test3.Test3> origin=null + arg1: GET_VAR 'other: kotlin.Any? declared in .Test3.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test3' + CONST Boolean type=kotlin.Boolean value=true + WHEN type=kotlin.Unit origin=null + BRANCH + if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=.Test3.Test3> + GET_VAR 'other: kotlin.Any? declared in .Test3.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test3' + CONST Boolean type=kotlin.Boolean value=false + VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:.Test3.Test3> [val] + TYPE_OP type=.Test3.Test3> origin=CAST typeOperand=.Test3.Test3> + GET_VAR 'other: kotlin.Any? declared in .Test3.equals' type=kotlin.Any? origin=null + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: 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.equals' type=.Test3.Test3> origin=null + arg1: 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 'val tmp_2: .Test3.Test3> [val] declared in .Test3.equals' type=.Test3.Test3> origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test3' + CONST Boolean type=kotlin.Boolean value=false + RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test3' + CONST Boolean type=kotlin.Boolean value=true + FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:.Test3.Test3>) returnType:kotlin.Int + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test3.Test3> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in .Test3' + CALL 'public open fun hashCode (): kotlin.Int declared in kotlin.Any' type=kotlin.Int origin=null + $this: 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.hashCode' type=.Test3.Test3> origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:.Test3.Test3>) returnType:kotlin.String + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test3.Test3> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in .Test3' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="Test3(" + CONST String type=kotlin.String value="x=" + 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.toString' type=.Test3.Test3> origin=null + CONST String type=kotlin.String value=")" CLASS CLASS name:Test4 modality:FINAL visibility:public [data] superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Test4 CONSTRUCTOR visibility:public <> (x:kotlin.collections.List) returnType:.Test4 [primary] @@ -165,16 +282,52 @@ FILE fqName: fileName:/dataClassesGeneric.kt 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 BLOCK_BODY - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - VALUE_PARAMETER name:other index:0 type:kotlin.Any? - FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] - overridden: - public open fun hashCode (): kotlin.Int declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any + 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? + BLOCK_BODY + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun EQEQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQEQ + arg0: GET_VAR ': .Test4 declared in .Test4.equals' type=.Test4 origin=null + arg1: GET_VAR 'other: kotlin.Any? declared in .Test4.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test4' + CONST Boolean type=kotlin.Boolean value=true + WHEN type=kotlin.Unit origin=null + BRANCH + if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=.Test4 + GET_VAR 'other: kotlin.Any? declared in .Test4.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test4' + CONST Boolean type=kotlin.Boolean value=false + VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:.Test4 [val] + TYPE_OP type=.Test4 origin=CAST typeOperand=.Test4 + GET_VAR 'other: kotlin.Any? declared in .Test4.equals' type=kotlin.Any? origin=null + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: 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.equals' type=.Test4 origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.collections.List visibility:private [final]' type=kotlin.collections.List origin=null + receiver: GET_VAR 'val tmp_3: .Test4 [val] declared in .Test4.equals' type=.Test4 origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test4' + CONST Boolean type=kotlin.Boolean value=false + RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test4' + CONST Boolean type=kotlin.Boolean value=true + FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:.Test4) returnType:kotlin.Int + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test4 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in .Test4' + CALL 'public open fun hashCode (): kotlin.Int declared in kotlin.Any' type=kotlin.Int origin=null + $this: 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.hashCode' type=.Test4 origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:.Test4) returnType:kotlin.String + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test4 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in .Test4' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="Test4(" + CONST String type=kotlin.String value="x=" + 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.toString' type=.Test4 origin=null + CONST String type=kotlin.String value=")" diff --git a/compiler/testData/ir/irText/classes/kt31649.fir.txt b/compiler/testData/ir/irText/classes/kt31649.fir.txt index 48e39993f3e..2261e4a9cc5 100644 --- a/compiler/testData/ir/irText/classes/kt31649.fir.txt +++ b/compiler/testData/ir/irText/classes/kt31649.fir.txt @@ -30,19 +30,64 @@ FILE fqName: fileName:/kt31649.kt 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 BLOCK_BODY - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - VALUE_PARAMETER name:other index:0 type:kotlin.Any? - FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] - overridden: - public open fun hashCode (): kotlin.Int declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any + 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? + BLOCK_BODY + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun EQEQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQEQ + arg0: GET_VAR ': .TestData declared in .TestData.equals' type=.TestData origin=null + arg1: GET_VAR 'other: kotlin.Any? declared in .TestData.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .TestData' + CONST Boolean type=kotlin.Boolean value=true + WHEN type=kotlin.Unit origin=null + BRANCH + if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=.TestData + GET_VAR 'other: kotlin.Any? declared in .TestData.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .TestData' + CONST Boolean type=kotlin.Boolean value=false + VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:.TestData [val] + TYPE_OP type=.TestData origin=CAST typeOperand=.TestData + GET_VAR 'other: kotlin.Any? declared in .TestData.equals' type=kotlin.Any? origin=null + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: 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.equals' type=.TestData origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:nn type:kotlin.Nothing? visibility:private [final]' type=kotlin.Nothing? origin=null + receiver: GET_VAR 'val tmp_0: .TestData [val] declared in .TestData.equals' type=.TestData origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .TestData' + CONST Boolean type=kotlin.Boolean value=false + RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .TestData' + CONST Boolean type=kotlin.Boolean value=true + FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:.TestData) returnType:kotlin.Int + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.TestData + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in .TestData' + WHEN type=kotlin.Int origin=null + BRANCH + if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ + arg0: GET_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.hashCode' type=.TestData 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 'public open fun hashCode (): kotlin.Int declared in kotlin.Any' type=kotlin.Int origin=null + $this: 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.hashCode' type=.TestData origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:.TestData) returnType:kotlin.String + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.TestData + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in .TestData' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="TestData(" + CONST String type=kotlin.String value="nn=" + 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.toString' type=.TestData origin=null + CONST String type=kotlin.String value=")" CLASS CLASS name:TestInline modality:FINAL visibility:public [inline] superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestInline CONSTRUCTOR visibility:public <> (nn:kotlin.Nothing?) returnType:.TestInline [primary] diff --git a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.fir.txt b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.fir.txt index 1a13ee3c4ba..b6472d25665 100644 --- a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.fir.txt +++ b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.fir.txt @@ -37,19 +37,55 @@ FILE fqName: fileName:/lambdaInDataClassDefaultParameter.kt 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 BLOCK_BODY - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - VALUE_PARAMETER name:other index:0 type:kotlin.Any? - FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] - overridden: - public open fun hashCode (): kotlin.Int declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any + 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? + BLOCK_BODY + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun EQEQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQEQ + arg0: GET_VAR ': .A declared in .A.equals' type=.A origin=null + arg1: GET_VAR 'other: kotlin.Any? declared in .A.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .A' + CONST Boolean type=kotlin.Boolean value=true + WHEN type=kotlin.Unit origin=null + BRANCH + if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=.A + GET_VAR 'other: kotlin.Any? declared in .A.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .A' + CONST Boolean type=kotlin.Boolean value=false + VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:.A [val] + TYPE_OP type=.A origin=CAST typeOperand=.A + GET_VAR 'other: kotlin.Any? declared in .A.equals' type=kotlin.Any? origin=null + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: 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.equals' type=.A origin=null + arg1: 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 'val tmp_0: .A [val] declared in .A.equals' type=.A origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .A' + CONST Boolean type=kotlin.Boolean value=false + RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .A' + CONST Boolean type=kotlin.Boolean value=true + FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:.A) returnType:kotlin.Int + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.A + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in .A' + CALL 'public open fun hashCode (): kotlin.Int declared in kotlin.Any' type=kotlin.Int origin=null + $this: 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.hashCode' type=.A origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:.A) returnType:kotlin.String + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.A + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in .A' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="A(" + CONST String type=kotlin.String value="runA=" + 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.toString' type=.A origin=null + CONST String type=kotlin.String value=")" CLASS CLASS name:B modality:FINAL visibility:public [data] superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.B CONSTRUCTOR visibility:public <> (x:kotlin.Any) returnType:.B [primary] @@ -103,16 +139,52 @@ FILE fqName: fileName:/lambdaInDataClassDefaultParameter.kt 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 BLOCK_BODY - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - VALUE_PARAMETER name:other index:0 type:kotlin.Any? - FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] - overridden: - public open fun hashCode (): kotlin.Int declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any + 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? + BLOCK_BODY + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun EQEQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQEQ + arg0: GET_VAR ': .B declared in .B.equals' type=.B origin=null + arg1: GET_VAR 'other: kotlin.Any? declared in .B.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .B' + CONST Boolean type=kotlin.Boolean value=true + WHEN type=kotlin.Unit origin=null + BRANCH + if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=.B + GET_VAR 'other: kotlin.Any? declared in .B.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .B' + CONST Boolean type=kotlin.Boolean value=false + VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:.B [val] + TYPE_OP type=.B origin=CAST typeOperand=.B + GET_VAR 'other: kotlin.Any? declared in .B.equals' type=kotlin.Any? origin=null + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: 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.equals' type=.B origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null + receiver: GET_VAR 'val tmp_1: .B [val] declared in .B.equals' type=.B origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .B' + CONST Boolean type=kotlin.Boolean value=false + RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .B' + CONST Boolean type=kotlin.Boolean value=true + FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:.B) returnType:kotlin.Int + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.B + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in .B' + CALL 'public open fun hashCode (): kotlin.Int declared in kotlin.Any' type=kotlin.Int origin=null + $this: 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.hashCode' type=.B origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:.B) returnType:kotlin.String + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.B + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in .B' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="B(" + CONST String type=kotlin.String value="x=" + 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.toString' type=.B origin=null + CONST String type=kotlin.String value=")" diff --git a/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.fir.txt b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.fir.txt index b9b1390729b..8845db395cb 100644 --- a/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.fir.txt +++ b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.fir.txt @@ -55,16 +55,81 @@ FILE fqName: fileName:/dataClassMembers.kt 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 BLOCK_BODY - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - VALUE_PARAMETER name:other index:0 type:kotlin.Any? - FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] - overridden: - public open fun hashCode (): kotlin.Int declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any + 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? + BLOCK_BODY + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun EQEQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQEQ + arg0: GET_VAR ': .Test.Test> declared in .Test.equals' type=.Test.Test> origin=null + arg1: GET_VAR 'other: kotlin.Any? declared in .Test.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test' + 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.Test> + GET_VAR 'other: kotlin.Any? declared in .Test.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test' + CONST Boolean type=kotlin.Boolean value=false + VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:.Test.Test> [val] + TYPE_OP type=.Test.Test> origin=CAST typeOperand=.Test.Test> + GET_VAR 'other: kotlin.Any? declared in .Test.equals' type=kotlin.Any? origin=null + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: 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.equals' type=.Test.Test> origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:T of .Test visibility:private [final]' type=T of .Test origin=null + receiver: GET_VAR 'val tmp_0: .Test.Test> [val] declared in .Test.equals' type=.Test.Test> origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test' + CONST Boolean type=kotlin.Boolean value=false + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: 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.equals' type=.Test.Test> origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR 'val tmp_0: .Test.Test> [val] declared in .Test.equals' type=.Test.Test> origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test' + CONST Boolean type=kotlin.Boolean value=false + RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Test' + CONST Boolean type=kotlin.Boolean value=true + FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:.Test.Test>) returnType:kotlin.Int + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test.Test> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in .Test' + CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: WHEN type=kotlin.Int origin=null + BRANCH + if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ + arg0: GET_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.hashCode' type=.Test.Test> 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 'public open fun hashCode (): kotlin.Int declared in kotlin.Any' type=kotlin.Int origin=null + $this: 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.hashCode' type=.Test.Test> origin=null + other: CONST Int type=kotlin.Int value=31 + other: CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.String' type=kotlin.Int origin=null + $this: 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.hashCode' type=.Test.Test> origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:.Test.Test>) returnType:kotlin.String + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Test.Test> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in .Test' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="Test(" + CONST String type=kotlin.String value="x=" + 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.toString' type=.Test.Test> origin=null + CONST String type=kotlin.String value=", " + CONST String type=kotlin.String value="y=" + 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.toString' type=.Test.Test> origin=null + CONST String type=kotlin.String value=")" diff --git a/compiler/testData/ir/irText/lambdas/destructuringInLambda.fir.txt b/compiler/testData/ir/irText/lambdas/destructuringInLambda.fir.txt index 4af81a44728..69be1c6eb8c 100644 --- a/compiler/testData/ir/irText/lambdas/destructuringInLambda.fir.txt +++ b/compiler/testData/ir/irText/lambdas/destructuringInLambda.fir.txt @@ -52,19 +52,75 @@ FILE fqName: fileName:/destructuringInLambda.kt 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 BLOCK_BODY - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - VALUE_PARAMETER name:other index:0 type:kotlin.Any? - FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] - overridden: - public open fun hashCode (): kotlin.Int declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any + 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? + BLOCK_BODY + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun EQEQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQEQ + arg0: GET_VAR ': .A declared in .A.equals' type=.A origin=null + arg1: GET_VAR 'other: kotlin.Any? declared in .A.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .A' + CONST Boolean type=kotlin.Boolean value=true + WHEN type=kotlin.Unit origin=null + BRANCH + if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=.A + GET_VAR 'other: kotlin.Any? declared in .A.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .A' + CONST Boolean type=kotlin.Boolean value=false + VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:.A [val] + TYPE_OP type=.A origin=CAST typeOperand=.A + GET_VAR 'other: kotlin.Any? declared in .A.equals' type=kotlin.Any? origin=null + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: 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.equals' type=.A origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + receiver: GET_VAR 'val tmp_0: .A [val] declared in .A.equals' type=.A origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .A' + CONST Boolean type=kotlin.Boolean value=false + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: 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.equals' type=.A origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + receiver: GET_VAR 'val tmp_0: .A [val] declared in .A.equals' type=.A origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .A' + CONST Boolean type=kotlin.Boolean value=false + RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .A' + CONST Boolean type=kotlin.Boolean value=true + FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:.A) returnType:kotlin.Int + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.A + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in .A' + CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.Int' type=kotlin.Int origin=null + $this: 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.hashCode' type=.A origin=null + other: CONST Int type=kotlin.Int value=31 + other: CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.Int' type=kotlin.Int origin=null + $this: 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.hashCode' type=.A origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:.A) returnType:kotlin.String + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.A + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in .A' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="A(" + CONST String type=kotlin.String value="x=" + 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.toString' type=.A origin=null + CONST String type=kotlin.String value=", " + CONST String type=kotlin.String value="y=" + 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.toString' type=.A origin=null + CONST String type=kotlin.String value=")" PROPERTY name:fn visibility:public modality:FINAL [var] FIELD PROPERTY_BACKING_FIELD name:fn type:kotlin.Function1<.A, kotlin.Int> visibility:private [static] EXPRESSION_BODY diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.txt index 8154165d741..2694186c08b 100644 --- a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.txt +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.txt @@ -167,16 +167,72 @@ FILE fqName: fileName:/enhancedNullabilityInForLoop.kt 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 BLOCK_BODY - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - VALUE_PARAMETER name:other index:0 type:kotlin.Any? - FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] - overridden: - public open fun hashCode (): kotlin.Int declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any + 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? + BLOCK_BODY + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun EQEQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQEQ + arg0: GET_VAR ': .P declared in .P.equals' type=.P origin=null + arg1: GET_VAR 'other: kotlin.Any? declared in .P.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .P' + CONST Boolean type=kotlin.Boolean value=true + WHEN type=kotlin.Unit origin=null + BRANCH + if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=.P + GET_VAR 'other: kotlin.Any? declared in .P.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .P' + CONST Boolean type=kotlin.Boolean value=false + VAR IR_TEMPORARY_VARIABLE name:tmp_5 type:.P [val] + TYPE_OP type=.P origin=CAST typeOperand=.P + GET_VAR 'other: kotlin.Any? declared in .P.equals' type=kotlin.Any? origin=null + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: 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.equals' type=.P origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + receiver: GET_VAR 'val tmp_5: .P [val] declared in .P.equals' type=.P origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .P' + CONST Boolean type=kotlin.Boolean value=false + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + arg0: 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.equals' type=.P origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + receiver: GET_VAR 'val tmp_5: .P [val] declared in .P.equals' type=.P origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .P' + CONST Boolean type=kotlin.Boolean value=false + RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .P' + CONST Boolean type=kotlin.Boolean value=true + FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:.P) returnType:kotlin.Int + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.P + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in .P' + CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.Int' type=kotlin.Int origin=null + $this: 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.hashCode' type=.P origin=null + other: CONST Int type=kotlin.Int value=31 + other: CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.Int' type=kotlin.Int origin=null + $this: 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.hashCode' type=.P origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:.P) returnType:kotlin.String + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.P + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in .P' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="P(" + CONST String type=kotlin.String value="x=" + 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.toString' type=.P origin=null + CONST String type=kotlin.String value=", " + CONST String type=kotlin.String value="y=" + 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.toString' type=.P origin=null + CONST String type=kotlin.String value=")" diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/MemoryOptimizationsTest.kt b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/MemoryOptimizationsTest.kt index 2736b63c27d..6bc6bc314e8 100644 --- a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/MemoryOptimizationsTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/MemoryOptimizationsTest.kt @@ -18,10 +18,10 @@ package org.jetbrains.kotlin.jvm.compiler import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.descriptors.findClassAcrossModuleDependencies +import org.jetbrains.kotlin.ir.util.findFirstFunction import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.psi2ir.findFirstFunction import org.jetbrains.kotlin.psi2ir.findSingleFunction import org.jetbrains.kotlin.resolve.lazy.JvmResolveUtil import org.jetbrains.kotlin.test.ConfigurationKind