From a37f16d7a25b55bc89e18e95110f9caba2460b4f Mon Sep 17 00:00:00 2001 From: Mads Ager Date: Mon, 21 Sep 2020 12:08:46 +0200 Subject: [PATCH] [IR] Do not generate line numbers for synthesized data class members. Fixes KT-41903. --- .../generators/DataClassMembersGenerator.kt | 3 +- .../generators/DataClassMembersGenerator.kt | 7 +- .../ir/util/DataClassMembersGenerator.kt | 32 +-- .../debug/localVariables/copyFunction.kt | 1 - compiler/testData/debug/stepping/dataClass.kt | 61 ++++ .../synthesizedDataClassMembers.txt | 260 +++++++++--------- .../IrSteppingTestGenerated.java | 6 + .../SteppingTestGenerated.java | 6 + .../singleBreakpoint/dataClassCopy.out | 1 - 9 files changed, 222 insertions(+), 155 deletions(-) create mode 100644 compiler/testData/debug/stepping/dataClass.kt diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DataClassMembersGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DataClassMembersGenerator.kt index 1ff867fdb30..176cd4b3570 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DataClassMembersGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DataClassMembersGenerator.kt @@ -206,8 +206,7 @@ class DataClassMembersGenerator(val components: Fir2IrComponents) { val index = getComponentIndex(irFunction)!! val valueParameter = irClass.primaryConstructor!!.valueParameters[index - 1] val backingField = irDataClassMembersGenerator.getBackingField(null, valueParameter)!! - irDataClassMembersGenerator - .generateComponentFunction(irFunction, backingField, valueParameter.startOffset, valueParameter.endOffset) + irDataClassMembersGenerator.generateComponentFunction(irFunction, backingField) } fun generateCopyBody(irFunction: IrFunction) = 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 6e154830d14..8880d75874e 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 @@ -22,11 +22,10 @@ import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.expressions.IrMemberAccessExpression import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.ir.util.DataClassMembersGenerator +import org.jetbrains.kotlin.ir.util.SYNTHETIC_OFFSET import org.jetbrains.kotlin.ir.util.declareSimpleFunctionWithOverrides import org.jetbrains.kotlin.psi.KtClassOrObject import org.jetbrains.kotlin.psi.KtParameter -import org.jetbrains.kotlin.psi.psiUtil.endOffset -import org.jetbrains.kotlin.psi.psiUtil.startOffset import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils @@ -93,9 +92,7 @@ class DataClassMembersGenerator( ?: throw AssertionError("No definition for data class constructor parameter $parameter") val backingField = irDataClassMembersGenerator.getBackingField(parameter, null) ?: return - irDataClassMembersGenerator.generateComponentFunction( - function, backingField, ktParameter.startOffset, ktParameter.endOffset - ) + irDataClassMembersGenerator.generateComponentFunction(function, backingField) } override fun generateCopyFunction(function: FunctionDescriptor, constructorParameters: List) { diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DataClassMembersGenerator.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DataClassMembersGenerator.kt index 850593758cb..87f3e4a2ae9 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DataClassMembersGenerator.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DataClassMembersGenerator.kt @@ -253,8 +253,8 @@ abstract class DataClassMembersGenerator( // 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, + startOffset: Int = SYNTHETIC_OFFSET, + endOffset: Int = SYNTHETIC_OFFSET, body: MemberFunctionBuilder.(IrFunction) -> Unit ) { MemberFunctionBuilder(startOffset, endOffset, declareSimpleFunction(startOffset, endOffset, function)).addToClass { irFunction -> @@ -268,8 +268,8 @@ abstract class DataClassMembersGenerator( // 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, + startOffset: Int = SYNTHETIC_OFFSET, + endOffset: Int = SYNTHETIC_OFFSET, body: MemberFunctionBuilder.(IrFunction) -> Unit ) { MemberFunctionBuilder(startOffset, endOffset, irFunction).build { function -> @@ -281,15 +281,15 @@ abstract class DataClassMembersGenerator( } // Entry for psi2ir - fun generateComponentFunction(function: FunctionDescriptor, irField: IrField, startOffset: Int, endOffset: Int) { - buildMember(function, startOffset, endOffset) { + fun generateComponentFunction(function: FunctionDescriptor, irField: IrField) { + buildMember(function) { generateComponentFunction(irField) } } // Entry for fir2ir - fun generateComponentFunction(irFunction: IrFunction, irField: IrField, startOffset: Int, endOffset: Int) { - buildMember(irFunction, startOffset, endOffset) { + fun generateComponentFunction(irFunction: IrFunction, irField: IrField) { + buildMember(irFunction) { generateComponentFunction(irField) } } @@ -300,7 +300,7 @@ abstract class DataClassMembersGenerator( // Entry for psi2ir fun generateCopyFunction(function: FunctionDescriptor, constructorSymbol: IrConstructorSymbol) { - buildMember(function, irClass.startOffset, irClass.endOffset) { + buildMember(function) { function.valueParameters.forEach { parameter -> putDefault(parameter, irGetField(irThis(), getBackingField(parameter, null)!!)) } @@ -310,7 +310,7 @@ abstract class DataClassMembersGenerator( // Entry for fir2ir fun generateCopyFunction(irFunction: IrFunction, constructorSymbol: IrConstructorSymbol) { - buildMember(irFunction, irClass.startOffset, irClass.endOffset) { + buildMember(irFunction) { irFunction.valueParameters.forEach { irValueParameter -> irValueParameter.defaultValue = irExprBody(irGetField(irThis(), getBackingField(null, irValueParameter)!!)) } @@ -320,14 +320,14 @@ abstract class DataClassMembersGenerator( // Entry for psi2ir fun generateEqualsMethod(function: FunctionDescriptor, properties: List) { - buildMember(function, irClass.startOffset, irClass.endOffset) { + buildMember(function) { generateEqualsMethodBody(properties) } } // Entry for fir2ir fun generateEqualsMethod(irFunction: IrFunction, properties: List) { - buildMember(irFunction, irClass.startOffset, irClass.endOffset) { + buildMember(irFunction) { generateEqualsMethodBody(properties) } } @@ -368,28 +368,28 @@ abstract class DataClassMembersGenerator( // Entry for psi2ir fun generateHashCodeMethod(function: FunctionDescriptor, properties: List) { - buildMember(function, irClass.startOffset, irClass.endOffset) { + buildMember(function) { generateHashCodeMethodBody(properties) } } // Entry for fir2ir fun generateHashCodeMethod(irFunction: IrFunction, properties: List) { - buildMember(irFunction, irClass.startOffset, irClass.endOffset) { + buildMember(irFunction) { generateHashCodeMethodBody(properties) } } // Entry for psi2ir fun generateToStringMethod(function: FunctionDescriptor, properties: List) { - buildMember(function, irClass.startOffset, irClass.endOffset) { + buildMember(function) { generateToStringMethodBody(properties) } } // Entry for fir2ir fun generateToStringMethod(irFunction: IrFunction, properties: List) { - buildMember(irFunction, irClass.startOffset, irClass.endOffset) { + buildMember(irFunction) { generateToStringMethodBody(properties) } } diff --git a/compiler/testData/debug/localVariables/copyFunction.kt b/compiler/testData/debug/localVariables/copyFunction.kt index 149581dfd70..3ec0742aaab 100644 --- a/compiler/testData/debug/localVariables/copyFunction.kt +++ b/compiler/testData/debug/localVariables/copyFunction.kt @@ -7,7 +7,6 @@ fun box() { val b = a.copy(b = 3.0) } -// IGNORE_BACKEND: JVM_IR // LOCAL VARIABLES // TestKt:6: // someClass:3: a:double, b:double diff --git a/compiler/testData/debug/stepping/dataClass.kt b/compiler/testData/debug/stepping/dataClass.kt new file mode 100644 index 00000000000..60274f6cd05 --- /dev/null +++ b/compiler/testData/debug/stepping/dataClass.kt @@ -0,0 +1,61 @@ +// FILE: test.kt + +data class D(val i: Int, val s: String) + +data class E(val i: Int, val s: String) { + override fun toString() = "OK" + override fun equals(other: Any?) = false + override fun hashCode() = 42 + fun copy() = E(i, s) +} + +fun box() { + val d = D(1, "a") + d.equals(D(1, "a")) + d.hashCode() + d.toString() + val (i, s) = d + d.copy() + val e = E(1, "a") + e.equals(E(1, "a")) + e.hashCode() + e.toString() + val (s2, i2) = e + e.copy() +} + +// LINENUMBERS +// test.kt:13 box +// test.kt:3 +// test.kt:13 box +// test.kt:14 box +// test.kt:3 +// test.kt:14 box +// test.kt:15 box +// test.kt:16 box +// test.kt:17 box +// test.kt:18 box +// test.kt:3 +// test.kt:-1 copy +// test.kt:18 box +// test.kt:19 box +// test.kt:5 +// test.kt:19 box +// test.kt:20 box +// test.kt:5 +// test.kt:20 box +// test.kt:7 equals +// test.kt:20 box +// test.kt:21 box +// test.kt:8 hashCode +// test.kt:21 box +// test.kt:22 box +// test.kt:6 toString +// test.kt:22 box +// test.kt:23 box +// test.kt:24 box +// test.kt:9 copy +// test.kt:5 +// test.kt:9 copy +// test.kt:24 box +// test.kt:25 box \ No newline at end of file diff --git a/compiler/testData/ir/sourceRanges/declarations/synthesizedDataClassMembers.txt b/compiler/testData/ir/sourceRanges/declarations/synthesizedDataClassMembers.txt index 91c82cf8091..2eb348c38ef 100644 --- a/compiler/testData/ir/sourceRanges/declarations/synthesizedDataClassMembers.txt +++ b/compiler/testData/ir/sourceRanges/declarations/synthesizedDataClassMembers.txt @@ -38,136 +38,136 @@ @3:8..18 RETURN type=kotlin.Nothing from='public final fun (): kotlin.Any declared in .C' @3:8..18 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:z type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null @3:8..18 GET_VAR ': .C declared in .C.' type=.C origin=null - @1:8..18 FUN GENERATED_DATA_CLASS_MEMBER name:component1 visibility:public modality:FINAL <> ($this:.C) returnType:kotlin.Int [operator] - @1:8..18 VALUE_PARAMETER name: type:.C - @1:8..18 BLOCK_BODY - @1:8..18 RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Int [operator] declared in .C' - @1:8..18 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null - @1:8..18 GET_VAR ': .C declared in .C.component1' type=.C origin=null - @2:8..21 FUN GENERATED_DATA_CLASS_MEMBER name:component2 visibility:public modality:FINAL <> ($this:.C) returnType:kotlin.String [operator] - @2:8..21 VALUE_PARAMETER name: type:.C - @2:8..21 BLOCK_BODY - @2:8..21 RETURN type=kotlin.Nothing from='public final fun component2 (): kotlin.String [operator] declared in .C' - @2:8..21 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.String visibility:private [final]' type=kotlin.String origin=null - @2:8..21 GET_VAR ': .C declared in .C.component2' type=.C origin=null - @3:8..18 FUN GENERATED_DATA_CLASS_MEMBER name:component3 visibility:public modality:FINAL <> ($this:.C) returnType:kotlin.Any [operator] - @3:8..18 VALUE_PARAMETER name: type:.C - @3:8..18 BLOCK_BODY - @3:8..18 RETURN type=kotlin.Nothing from='public final fun component3 (): kotlin.Any [operator] declared in .C' - @3:8..18 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:z type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null - @3:8..18 GET_VAR ': .C declared in .C.component3' type=.C origin=null - @0:0..4:1 FUN GENERATED_DATA_CLASS_MEMBER name:copy visibility:public modality:FINAL <> ($this:.C, x:kotlin.Int, y:kotlin.String, z:kotlin.Any) returnType:.C - @0:0..4:1 VALUE_PARAMETER name: type:.C + @-1:-1..-1 FUN GENERATED_DATA_CLASS_MEMBER name:component1 visibility:public modality:FINAL <> ($this:.C) returnType:kotlin.Int [operator] + @-1:-1..-1 VALUE_PARAMETER name: type:.C + @-1:-1..-1 BLOCK_BODY + @-1:-1..-1 RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Int [operator] declared in .C' + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + @-1:-1..-1 GET_VAR ': .C declared in .C.component1' type=.C origin=null + @-1:-1..-1 FUN GENERATED_DATA_CLASS_MEMBER name:component2 visibility:public modality:FINAL <> ($this:.C) returnType:kotlin.String [operator] + @-1:-1..-1 VALUE_PARAMETER name: type:.C + @-1:-1..-1 BLOCK_BODY + @-1:-1..-1 RETURN type=kotlin.Nothing from='public final fun component2 (): kotlin.String [operator] declared in .C' + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + @-1:-1..-1 GET_VAR ': .C declared in .C.component2' type=.C origin=null + @-1:-1..-1 FUN GENERATED_DATA_CLASS_MEMBER name:component3 visibility:public modality:FINAL <> ($this:.C) returnType:kotlin.Any [operator] + @-1:-1..-1 VALUE_PARAMETER name: type:.C + @-1:-1..-1 BLOCK_BODY + @-1:-1..-1 RETURN type=kotlin.Nothing from='public final fun component3 (): kotlin.Any [operator] declared in .C' + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:z type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null + @-1:-1..-1 GET_VAR ': .C declared in .C.component3' type=.C origin=null + @-1:-1..-1 FUN GENERATED_DATA_CLASS_MEMBER name:copy visibility:public modality:FINAL <> ($this:.C, x:kotlin.Int, y:kotlin.String, z:kotlin.Any) returnType:.C + @-1:-1..-1 VALUE_PARAMETER name: type:.C @1:8..18 VALUE_PARAMETER name:x index:0 type:kotlin.Int - @0:0..4:1 EXPRESSION_BODY - @0:0..4:1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null - @0:0..4:1 GET_VAR ': .C declared in .C.copy' type=.C origin=null + @-1:-1..-1 EXPRESSION_BODY + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + @-1:-1..-1 GET_VAR ': .C declared in .C.copy' type=.C origin=null @2:8..21 VALUE_PARAMETER name:y index:1 type:kotlin.String - @0:0..4:1 EXPRESSION_BODY - @0:0..4:1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.String visibility:private [final]' type=kotlin.String origin=null - @0:0..4:1 GET_VAR ': .C declared in .C.copy' type=.C origin=null + @-1:-1..-1 EXPRESSION_BODY + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + @-1:-1..-1 GET_VAR ': .C declared in .C.copy' type=.C origin=null @3:8..18 VALUE_PARAMETER name:z index:2 type:kotlin.Any - @0:0..4:1 EXPRESSION_BODY - @0:0..4:1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:z type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null - @0:0..4:1 GET_VAR ': .C declared in .C.copy' type=.C origin=null - @0:0..4:1 BLOCK_BODY - @0:0..4:1 RETURN type=kotlin.Nothing from='public final fun copy (x: kotlin.Int, y: kotlin.String, z: kotlin.Any): .C declared in .C' - @0:0..4:1 CONSTRUCTOR_CALL 'public constructor (x: kotlin.Int, y: kotlin.String, z: kotlin.Any) [primary] declared in .C' type=.C origin=null - @0:0..4:1 GET_VAR 'x: kotlin.Int declared in .C.copy' type=kotlin.Int origin=null - @0:0..4:1 GET_VAR 'y: kotlin.String declared in .C.copy' type=kotlin.String origin=null - @0:0..4:1 GET_VAR 'z: kotlin.Any declared in .C.copy' type=kotlin.Any origin=null - @0:0..4:1 FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:.C) returnType:kotlin.String - @0:0..4:1 VALUE_PARAMETER name: type:.C - @0:0..4:1 BLOCK_BODY - @0:0..4:1 RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in .C' - @0:0..4:1 STRING_CONCATENATION type=kotlin.String - @0:0..4:1 CONST String type=kotlin.String value="C(" - @0:0..4:1 CONST String type=kotlin.String value="x=" - @0:0..4:1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null - @0:0..4:1 GET_VAR ': .C declared in .C.toString' type=.C origin=null - @0:0..4:1 CONST String type=kotlin.String value=", " - @0:0..4:1 CONST String type=kotlin.String value="y=" - @0:0..4:1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.String visibility:private [final]' type=kotlin.String origin=null - @0:0..4:1 GET_VAR ': .C declared in .C.toString' type=.C origin=null - @0:0..4:1 CONST String type=kotlin.String value=", " - @0:0..4:1 CONST String type=kotlin.String value="z=" - @0:0..4:1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:z type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null - @0:0..4:1 GET_VAR ': .C declared in .C.toString' type=.C origin=null - @0:0..4:1 CONST String type=kotlin.String value=")" - @0:0..4:1 FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:.C) returnType:kotlin.Int - @0:0..4:1 VALUE_PARAMETER name: type:.C - @0:0..4:1 BLOCK_BODY - @0:0..4:1 VAR name:result type:kotlin.Int [var] - @0:0..4:1 CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.Int' type=kotlin.Int origin=null - @0:0..4:1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null - @0:0..4:1 GET_VAR ': .C declared in .C.hashCode' type=.C origin=null - @0:0..4:1 SET_VAR 'var result: kotlin.Int [var] declared in .C.hashCode' type=kotlin.Unit origin=EQ - @0:0..4:1 CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null - @0:0..4:1 CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null - @0:0..4:1 GET_VAR 'var result: kotlin.Int [var] declared in .C.hashCode' type=kotlin.Int origin=null - @0:0..4:1 CONST Int type=kotlin.Int value=31 - @0:0..4:1 CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.String' type=kotlin.Int origin=null - @0:0..4:1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.String visibility:private [final]' type=kotlin.String origin=null - @0:0..4:1 GET_VAR ': .C declared in .C.hashCode' type=.C origin=null - @0:0..4:1 SET_VAR 'var result: kotlin.Int [var] declared in .C.hashCode' type=kotlin.Unit origin=EQ - @0:0..4:1 CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null - @0:0..4:1 CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null - @0:0..4:1 GET_VAR 'var result: kotlin.Int [var] declared in .C.hashCode' type=kotlin.Int origin=null - @0:0..4:1 CONST Int type=kotlin.Int value=31 - @0:0..4:1 CALL 'public open fun hashCode (): kotlin.Int declared in kotlin.Any' type=kotlin.Int origin=null - @0:0..4:1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:z type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null - @0:0..4:1 GET_VAR ': .C declared in .C.hashCode' type=.C origin=null - @0:0..4:1 RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in .C' - @0:0..4:1 GET_VAR 'var result: kotlin.Int [var] declared in .C.hashCode' type=kotlin.Int origin=null - @0:0..4:1 FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:.C, other:kotlin.Any?) returnType:kotlin.Boolean [operator] - @0:0..4:1 VALUE_PARAMETER name: type:.C - @0:0..4:1 VALUE_PARAMETER name:other index:0 type:kotlin.Any? - @0:0..4:1 BLOCK_BODY - @0:0..4:1 WHEN type=kotlin.Unit origin=null - @0:0..4:1 BRANCH - @0:0..4:1 CALL 'public final fun EQEQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQEQ - @0:0..4:1 GET_VAR ': .C declared in .C.equals' type=.C origin=null - @0:0..4:1 GET_VAR 'other: kotlin.Any? declared in .C.equals' type=kotlin.Any? origin=null - @0:0..4:1 RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .C' - @0:0..4:1 CONST Boolean type=kotlin.Boolean value=true - @0:0..4:1 WHEN type=kotlin.Unit origin=null - @0:0..4:1 BRANCH - @0:0..4:1 TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=.C - @0:0..4:1 GET_VAR 'other: kotlin.Any? declared in .C.equals' type=kotlin.Any? origin=null - @0:0..4:1 RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .C' - @0:0..4:1 CONST Boolean type=kotlin.Boolean value=false - @0:0..4:1 VAR IR_TEMPORARY_VARIABLE name:tmp0_other_with_cast type:.C [val] - @0:0..4:1 TYPE_OP type=.C origin=CAST typeOperand=.C - @0:0..4:1 GET_VAR 'other: kotlin.Any? declared in .C.equals' type=kotlin.Any? origin=null - @0:0..4:1 WHEN type=kotlin.Unit origin=null - @0:0..4:1 BRANCH - @0:0..4:1 CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ - @0:0..4:1 CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ - @0:0..4:1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null - @0:0..4:1 GET_VAR ': .C declared in .C.equals' type=.C origin=null - @0:0..4:1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null - @0:0..4:1 GET_VAR 'val tmp0_other_with_cast: .C [val] declared in .C.equals' type=.C origin=null - @0:0..4:1 RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .C' - @0:0..4:1 CONST Boolean type=kotlin.Boolean value=false - @0:0..4:1 WHEN type=kotlin.Unit origin=null - @0:0..4:1 BRANCH - @0:0..4:1 CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ - @0:0..4:1 CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ - @0:0..4:1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.String visibility:private [final]' type=kotlin.String origin=null - @0:0..4:1 GET_VAR ': .C declared in .C.equals' type=.C origin=null - @0:0..4:1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.String visibility:private [final]' type=kotlin.String origin=null - @0:0..4:1 GET_VAR 'val tmp0_other_with_cast: .C [val] declared in .C.equals' type=.C origin=null - @0:0..4:1 RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .C' - @0:0..4:1 CONST Boolean type=kotlin.Boolean value=false - @0:0..4:1 WHEN type=kotlin.Unit origin=null - @0:0..4:1 BRANCH - @0:0..4:1 CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ - @0:0..4:1 CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ - @0:0..4:1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:z type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null - @0:0..4:1 GET_VAR ': .C declared in .C.equals' type=.C origin=null - @0:0..4:1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:z type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null - @0:0..4:1 GET_VAR 'val tmp0_other_with_cast: .C [val] declared in .C.equals' type=.C origin=null - @0:0..4:1 RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .C' - @0:0..4:1 CONST Boolean type=kotlin.Boolean value=false - @0:0..4:1 RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .C' - @0:0..4:1 CONST Boolean type=kotlin.Boolean value=true + @-1:-1..-1 EXPRESSION_BODY + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:z type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null + @-1:-1..-1 GET_VAR ': .C declared in .C.copy' type=.C origin=null + @-1:-1..-1 BLOCK_BODY + @-1:-1..-1 RETURN type=kotlin.Nothing from='public final fun copy (x: kotlin.Int, y: kotlin.String, z: kotlin.Any): .C declared in .C' + @-1:-1..-1 CONSTRUCTOR_CALL 'public constructor (x: kotlin.Int, y: kotlin.String, z: kotlin.Any) [primary] declared in .C' type=.C origin=null + @-1:-1..-1 GET_VAR 'x: kotlin.Int declared in .C.copy' type=kotlin.Int origin=null + @-1:-1..-1 GET_VAR 'y: kotlin.String declared in .C.copy' type=kotlin.String origin=null + @-1:-1..-1 GET_VAR 'z: kotlin.Any declared in .C.copy' type=kotlin.Any origin=null + @-1:-1..-1 FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:.C) returnType:kotlin.String + @-1:-1..-1 VALUE_PARAMETER name: type:.C + @-1:-1..-1 BLOCK_BODY + @-1:-1..-1 RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in .C' + @-1:-1..-1 STRING_CONCATENATION type=kotlin.String + @-1:-1..-1 CONST String type=kotlin.String value="C(" + @-1:-1..-1 CONST String type=kotlin.String value="x=" + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + @-1:-1..-1 GET_VAR ': .C declared in .C.toString' type=.C origin=null + @-1:-1..-1 CONST String type=kotlin.String value=", " + @-1:-1..-1 CONST String type=kotlin.String value="y=" + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + @-1:-1..-1 GET_VAR ': .C declared in .C.toString' type=.C origin=null + @-1:-1..-1 CONST String type=kotlin.String value=", " + @-1:-1..-1 CONST String type=kotlin.String value="z=" + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:z type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null + @-1:-1..-1 GET_VAR ': .C declared in .C.toString' type=.C origin=null + @-1:-1..-1 CONST String type=kotlin.String value=")" + @-1:-1..-1 FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:.C) returnType:kotlin.Int + @-1:-1..-1 VALUE_PARAMETER name: type:.C + @-1:-1..-1 BLOCK_BODY + @-1:-1..-1 VAR name:result type:kotlin.Int [var] + @-1:-1..-1 CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.Int' type=kotlin.Int origin=null + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + @-1:-1..-1 GET_VAR ': .C declared in .C.hashCode' type=.C origin=null + @-1:-1..-1 SET_VAR 'var result: kotlin.Int [var] declared in .C.hashCode' type=kotlin.Unit origin=EQ + @-1:-1..-1 CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + @-1:-1..-1 CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + @-1:-1..-1 GET_VAR 'var result: kotlin.Int [var] declared in .C.hashCode' type=kotlin.Int origin=null + @-1:-1..-1 CONST Int type=kotlin.Int value=31 + @-1:-1..-1 CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.String' type=kotlin.Int origin=null + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + @-1:-1..-1 GET_VAR ': .C declared in .C.hashCode' type=.C origin=null + @-1:-1..-1 SET_VAR 'var result: kotlin.Int [var] declared in .C.hashCode' type=kotlin.Unit origin=EQ + @-1:-1..-1 CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + @-1:-1..-1 CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + @-1:-1..-1 GET_VAR 'var result: kotlin.Int [var] declared in .C.hashCode' type=kotlin.Int origin=null + @-1:-1..-1 CONST Int type=kotlin.Int value=31 + @-1:-1..-1 CALL 'public open fun hashCode (): kotlin.Int declared in kotlin.Any' type=kotlin.Int origin=null + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:z type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null + @-1:-1..-1 GET_VAR ': .C declared in .C.hashCode' type=.C origin=null + @-1:-1..-1 RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in .C' + @-1:-1..-1 GET_VAR 'var result: kotlin.Int [var] declared in .C.hashCode' type=kotlin.Int origin=null + @-1:-1..-1 FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:.C, other:kotlin.Any?) returnType:kotlin.Boolean [operator] + @-1:-1..-1 VALUE_PARAMETER name: type:.C + @-1:-1..-1 VALUE_PARAMETER name:other index:0 type:kotlin.Any? + @-1:-1..-1 BLOCK_BODY + @-1:-1..-1 WHEN type=kotlin.Unit origin=null + @-1:-1..-1 BRANCH + @-1:-1..-1 CALL 'public final fun EQEQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQEQ + @-1:-1..-1 GET_VAR ': .C declared in .C.equals' type=.C origin=null + @-1:-1..-1 GET_VAR 'other: kotlin.Any? declared in .C.equals' type=kotlin.Any? origin=null + @-1:-1..-1 RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .C' + @-1:-1..-1 CONST Boolean type=kotlin.Boolean value=true + @-1:-1..-1 WHEN type=kotlin.Unit origin=null + @-1:-1..-1 BRANCH + @-1:-1..-1 TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=.C + @-1:-1..-1 GET_VAR 'other: kotlin.Any? declared in .C.equals' type=kotlin.Any? origin=null + @-1:-1..-1 RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .C' + @-1:-1..-1 CONST Boolean type=kotlin.Boolean value=false + @-1:-1..-1 VAR IR_TEMPORARY_VARIABLE name:tmp0_other_with_cast type:.C [val] + @-1:-1..-1 TYPE_OP type=.C origin=CAST typeOperand=.C + @-1:-1..-1 GET_VAR 'other: kotlin.Any? declared in .C.equals' type=kotlin.Any? origin=null + @-1:-1..-1 WHEN type=kotlin.Unit origin=null + @-1:-1..-1 BRANCH + @-1:-1..-1 CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + @-1:-1..-1 CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + @-1:-1..-1 GET_VAR ': .C declared in .C.equals' type=.C origin=null + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + @-1:-1..-1 GET_VAR 'val tmp0_other_with_cast: .C [val] declared in .C.equals' type=.C origin=null + @-1:-1..-1 RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .C' + @-1:-1..-1 CONST Boolean type=kotlin.Boolean value=false + @-1:-1..-1 WHEN type=kotlin.Unit origin=null + @-1:-1..-1 BRANCH + @-1:-1..-1 CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + @-1:-1..-1 CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + @-1:-1..-1 GET_VAR ': .C declared in .C.equals' type=.C origin=null + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + @-1:-1..-1 GET_VAR 'val tmp0_other_with_cast: .C [val] declared in .C.equals' type=.C origin=null + @-1:-1..-1 RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .C' + @-1:-1..-1 CONST Boolean type=kotlin.Boolean value=false + @-1:-1..-1 WHEN type=kotlin.Unit origin=null + @-1:-1..-1 BRANCH + @-1:-1..-1 CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ + @-1:-1..-1 CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:z type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null + @-1:-1..-1 GET_VAR ': .C declared in .C.equals' type=.C origin=null + @-1:-1..-1 GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:z type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null + @-1:-1..-1 GET_VAR 'val tmp0_other_with_cast: .C [val] declared in .C.equals' type=.C origin=null + @-1:-1..-1 RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .C' + @-1:-1..-1 CONST Boolean type=kotlin.Boolean value=false + @-1:-1..-1 RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .C' + @-1:-1..-1 CONST Boolean type=kotlin.Boolean value=true diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/debugInformation/IrSteppingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/debugInformation/IrSteppingTestGenerated.java index 1b73f38c4ff..8960d684f4a 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/debugInformation/IrSteppingTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/debugInformation/IrSteppingTestGenerated.java @@ -109,6 +109,12 @@ public class IrSteppingTestGenerated extends AbstractIrSteppingTest { runTest("compiler/testData/debug/stepping/constructors.kt"); } + @Test + @TestMetadata("dataClass.kt") + public void testDataClass() throws Exception { + runTest("compiler/testData/debug/stepping/dataClass.kt"); + } + @Test @TestMetadata("defaultParameter.kt") public void testDefaultParameter() throws Exception { diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/debugInformation/SteppingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/debugInformation/SteppingTestGenerated.java index 069c8e91331..15ce7f88602 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/debugInformation/SteppingTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/debugInformation/SteppingTestGenerated.java @@ -109,6 +109,12 @@ public class SteppingTestGenerated extends AbstractSteppingTest { runTest("compiler/testData/debug/stepping/constructors.kt"); } + @Test + @TestMetadata("dataClass.kt") + public void testDataClass() throws Exception { + runTest("compiler/testData/debug/stepping/dataClass.kt"); + } + @Test @TestMetadata("defaultParameter.kt") public void testDefaultParameter() throws Exception { diff --git a/idea/jvm-debugger/jvm-debugger-test/testData/evaluation/singleBreakpoint/dataClassCopy.out b/idea/jvm-debugger/jvm-debugger-test/testData/evaluation/singleBreakpoint/dataClassCopy.out index a761424fd7d..7167326bfd3 100644 --- a/idea/jvm-debugger/jvm-debugger-test/testData/evaluation/singleBreakpoint/dataClassCopy.out +++ b/idea/jvm-debugger/jvm-debugger-test/testData/evaluation/singleBreakpoint/dataClassCopy.out @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR LineBreakpoint created at dataClassCopy.kt:6 Run Java Connected to the target VM