diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxModernJdkCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxModernJdkCodegenTestGenerated.java index 94d8e994df6..636f1f592de 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxModernJdkCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxModernJdkCodegenTestGenerated.java @@ -405,6 +405,12 @@ public class FirBlackBoxModernJdkCodegenTestGenerated extends AbstractFirBlackBo public void testRecordPropertyAccess() throws Exception { runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordPropertyAccess.kt"); } + + @Test + @TestMetadata("recordWithCompanion.kt") + public void testRecordWithCompanion() throws Exception { + runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordWithCompanion.kt"); + } } @Nested diff --git a/compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordWithCompanion.fir.ir.txt b/compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordWithCompanion.fir.ir.txt new file mode 100644 index 00000000000..ef8af68d708 --- /dev/null +++ b/compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordWithCompanion.fir.ir.txt @@ -0,0 +1,131 @@ +FILE fqName: fileName:/recordWithCompanion.kt + CLASS CLASS name:Tag modality:FINAL visibility:public [data] superTypes:[java.lang.Record] + annotations: + JvmRecord + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Tag + CONSTRUCTOR visibility:public <> (id:kotlin.String) returnType:.Tag [primary] + VALUE_PARAMETER name:id index:0 type:kotlin.String + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'protected/*protected and package*/ constructor () declared in java.lang.Record' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Tag modality:FINAL visibility:public [data] superTypes:[java.lang.Record]' + PROPERTY name:id visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:id type:kotlin.String visibility:private [final] + EXPRESSION_BODY + GET_VAR 'id: kotlin.String declared in .Tag.' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Tag) returnType:kotlin.String + correspondingProperty: PROPERTY name:id visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Tag + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .Tag' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:id type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .Tag declared in .Tag.' type=.Tag origin=null + CLASS OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Tag.Companion + CONSTRUCTOR visibility:private <> () returnType:.Tag.Companion [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'protected/*protected and package*/ constructor () declared in java.lang.Record' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlin.Any]' + 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 name:component1 visibility:public modality:FINAL <> ($this:.Tag) returnType:kotlin.String [operator] + $this: VALUE_PARAMETER name: type:.Tag + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.String [operator] declared in .Tag' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:id type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .Tag declared in .Tag.component1' type=.Tag origin=null + FUN name:copy visibility:public modality:FINAL <> ($this:.Tag, id:kotlin.String) returnType:.Tag + $this: VALUE_PARAMETER name: type:.Tag + VALUE_PARAMETER name:id index:0 type:kotlin.String + EXPRESSION_BODY + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:id type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .Tag declared in .Tag.copy' type=.Tag origin=null + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun copy (id: kotlin.String): .Tag declared in .Tag' + CONSTRUCTOR_CALL 'public constructor (id: kotlin.String) [primary] declared in .Tag' type=.Tag origin=null + id: GET_VAR 'id: kotlin.String declared in .Tag.copy' type=kotlin.String origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:.Tag, other:kotlin.Any?) returnType:kotlin.Boolean + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Tag + 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 ': .Tag declared in .Tag.equals' type=.Tag origin=null + arg1: GET_VAR 'other: kotlin.Any? declared in .Tag.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Tag' + CONST Boolean type=kotlin.Boolean value=true + WHEN type=kotlin.Unit origin=null + BRANCH + if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=.Tag + GET_VAR 'other: kotlin.Any? declared in .Tag.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Tag' + CONST Boolean type=kotlin.Boolean value=false + VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:.Tag [val] + TYPE_OP type=.Tag origin=CAST typeOperand=.Tag + GET_VAR 'other: kotlin.Any? declared in .Tag.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:id type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .Tag declared in .Tag.equals' type=.Tag origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:id type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR 'val tmp_0: .Tag [val] declared in .Tag.equals' type=.Tag origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Tag' + CONST Boolean type=kotlin.Boolean value=false + RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Tag' + CONST Boolean type=kotlin.Boolean value=true + FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:.Tag) returnType:kotlin.Int + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Tag + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in .Tag' + 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:id type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .Tag declared in .Tag.hashCode' type=.Tag origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:.Tag) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Tag + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in .Tag' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="Tag(" + CONST String type=kotlin.String value="id=" + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:id type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .Tag declared in .Tag.toString' type=.Tag origin=null + CONST String type=kotlin.String value=")" + FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + CALL 'public final fun (): kotlin.String declared in .Tag' type=kotlin.String origin=GET_PROPERTY + $this: CONSTRUCTOR_CALL 'public constructor (id: kotlin.String) [primary] declared in .Tag' type=.Tag origin=null + id: CONST String type=kotlin.String value="OK" +FILE fqName: fileName:/Generated_Box_Main.kt + FUN name:main visibility:public modality:FINAL <> () returnType:kotlin.Unit [suspend] + BLOCK_BODY + VAR name:res type:kotlin.String [val] + CALL 'public final fun box (): kotlin.String declared in ' type=kotlin.String origin=null + WHEN type=kotlin.Unit origin=IF + 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_VAR 'val res: kotlin.String [val] declared in .main' type=kotlin.String origin=null + arg1: CONST String type=kotlin.String value="OK" + then: THROW type=kotlin.Nothing + CONSTRUCTOR_CALL 'public constructor (p0: @[FlexibleNullability] kotlin.Any?) declared in java.lang.AssertionError' type=java.lang.AssertionError origin=null + p0: GET_VAR 'val res: kotlin.String [val] declared in .main' type=kotlin.String origin=null diff --git a/compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordWithCompanion.ir.txt b/compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordWithCompanion.ir.txt new file mode 100644 index 00000000000..150f7c839d1 --- /dev/null +++ b/compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordWithCompanion.ir.txt @@ -0,0 +1,131 @@ +FILE fqName: fileName:/recordWithCompanion.kt + CLASS CLASS name:Tag modality:FINAL visibility:public [data] superTypes:[java.lang.Record] + annotations: + JvmRecord + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Tag + CONSTRUCTOR visibility:public <> (id:kotlin.String) returnType:.Tag [primary] + VALUE_PARAMETER name:id index:0 type:kotlin.String + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'protected/*protected and package*/ constructor () declared in java.lang.Record' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Tag modality:FINAL visibility:public [data] superTypes:[java.lang.Record]' + PROPERTY name:id visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:id type:kotlin.String visibility:private [final] + EXPRESSION_BODY + GET_VAR 'id: kotlin.String declared in .Tag.' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Tag) returnType:kotlin.String + correspondingProperty: PROPERTY name:id visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Tag + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .Tag' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:id type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .Tag declared in .Tag.' type=.Tag origin=null + CLASS OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Tag.Companion + CONSTRUCTOR visibility:private <> () returnType:.Tag.Companion [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlin.Any]' + 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:component1 visibility:public modality:FINAL <> ($this:.Tag) returnType:kotlin.String [operator] + $this: VALUE_PARAMETER name: type:.Tag + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.String [operator] declared in .Tag' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:id type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .Tag declared in .Tag.component1' type=.Tag origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:copy visibility:public modality:FINAL <> ($this:.Tag, id:kotlin.String) returnType:.Tag + $this: VALUE_PARAMETER name: type:.Tag + VALUE_PARAMETER name:id index:0 type:kotlin.String + EXPRESSION_BODY + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:id type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .Tag declared in .Tag.copy' type=.Tag origin=null + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun copy (id: kotlin.String): .Tag declared in .Tag' + CONSTRUCTOR_CALL 'public constructor (id: kotlin.String) [primary] declared in .Tag' type=.Tag origin=null + id: GET_VAR 'id: kotlin.String declared in .Tag.copy' type=kotlin.String origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:.Tag) returnType:kotlin.String + overridden: + public abstract fun toString (): @[EnhancedNullability] kotlin.String declared in java.lang.Record + $this: VALUE_PARAMETER name: type:.Tag + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in .Tag' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="Tag(" + CONST String type=kotlin.String value="id=" + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:id type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .Tag declared in .Tag.toString' type=.Tag origin=null + CONST String type=kotlin.String value=")" + FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:.Tag) returnType:kotlin.Int + overridden: + public abstract fun hashCode (): kotlin.Int declared in java.lang.Record + $this: VALUE_PARAMETER name: type:.Tag + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in .Tag' + 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:id type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .Tag declared in .Tag.hashCode' type=.Tag origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:.Tag, other:kotlin.Any?) returnType:kotlin.Boolean [operator] + overridden: + public abstract fun equals (other: @[EnhancedNullability] kotlin.Any?): kotlin.Boolean [operator] declared in java.lang.Record + $this: VALUE_PARAMETER name: type:.Tag + VALUE_PARAMETER 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 ': .Tag declared in .Tag.equals' type=.Tag origin=null + arg1: GET_VAR 'other: kotlin.Any? declared in .Tag.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .Tag' + CONST Boolean type=kotlin.Boolean value=true + WHEN type=kotlin.Unit origin=null + BRANCH + if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=.Tag + GET_VAR 'other: kotlin.Any? declared in .Tag.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .Tag' + CONST Boolean type=kotlin.Boolean value=false + VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:.Tag [val] + TYPE_OP type=.Tag origin=CAST typeOperand=.Tag + GET_VAR 'other: kotlin.Any? declared in .Tag.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:id type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .Tag declared in .Tag.equals' type=.Tag origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:id type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR 'val tmp_0: .Tag [val] declared in .Tag.equals' type=.Tag origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .Tag' + CONST Boolean type=kotlin.Boolean value=false + RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .Tag' + CONST Boolean type=kotlin.Boolean value=true + FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + CALL 'public final fun (): kotlin.String declared in .Tag' type=kotlin.String origin=GET_PROPERTY + $this: CONSTRUCTOR_CALL 'public constructor (id: kotlin.String) [primary] declared in .Tag' type=.Tag origin=null + id: CONST String type=kotlin.String value="OK" +FILE fqName: fileName:/Generated_Box_Main.kt + FUN name:main visibility:public modality:FINAL <> () returnType:kotlin.Unit [suspend] + BLOCK_BODY + VAR name:res type:kotlin.String [val] + CALL 'public final fun box (): kotlin.String declared in ' type=kotlin.String origin=null + WHEN type=kotlin.Unit origin=IF + 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_VAR 'val res: kotlin.String [val] declared in .main' type=kotlin.String origin=null + arg1: CONST String type=kotlin.String value="OK" + then: THROW type=kotlin.Nothing + CONSTRUCTOR_CALL 'public constructor (p0: @[FlexibleNullability] kotlin.Any?) declared in java.lang.AssertionError' type=java.lang.AssertionError origin=null + p0: GET_VAR 'val res: kotlin.String [val] declared in .main' type=kotlin.String origin=null diff --git a/compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordWithCompanion.kt b/compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordWithCompanion.kt new file mode 100644 index 00000000000..66f823b82b3 --- /dev/null +++ b/compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordWithCompanion.kt @@ -0,0 +1,13 @@ +// ISSUE: KT-55703 +// DUMP_IR + +@JvmRecord +data class Tag( + val id: String, +) { + companion object +} + +fun box(): String { + return Tag("OK").id +} diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxModernJdkCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxModernJdkCodegenTestGenerated.java index 59cc8708906..de5ba730df6 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxModernJdkCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxModernJdkCodegenTestGenerated.java @@ -381,6 +381,12 @@ public class BlackBoxModernJdkCodegenTestGenerated extends AbstractBlackBoxCodeg public void testRecordPropertyAccess() throws Exception { runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordPropertyAccess.kt"); } + + @Test + @TestMetadata("recordWithCompanion.kt") + public void testRecordWithCompanion() throws Exception { + runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordWithCompanion.kt"); + } } @Nested diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxModernJdkCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxModernJdkCodegenTestGenerated.java index 5b80298c240..6848bd2e9f9 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxModernJdkCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxModernJdkCodegenTestGenerated.java @@ -405,6 +405,12 @@ public class IrBlackBoxModernJdkCodegenTestGenerated extends AbstractIrBlackBoxC public void testRecordPropertyAccess() throws Exception { runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordPropertyAccess.kt"); } + + @Test + @TestMetadata("recordWithCompanion.kt") + public void testRecordWithCompanion() throws Exception { + runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordWithCompanion.kt"); + } } @Nested