diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java index d063e15a6b1..7003da0303b 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java @@ -401,6 +401,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { runTest("compiler/testData/ir/irText/declarations/annotations/annotationsInAnnotationArguments.kt"); } + @TestMetadata("annotationsOnDelegatedMembers.kt") + public void testAnnotationsOnDelegatedMembers() throws Exception { + runTest("compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt"); + } + @TestMetadata("annotationsWithDefaultParameterValues.kt") public void testAnnotationsWithDefaultParameterValues() throws Exception { runTest("compiler/testData/ir/irText/declarations/annotations/annotationsWithDefaultParameterValues.kt"); diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/AnnotationGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/AnnotationGenerator.kt index 0e81af581d1..45103ec9838 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/AnnotationGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/AnnotationGenerator.kt @@ -30,12 +30,17 @@ class AnnotationGenerator(context: GeneratorContext) : IrElementVisitorVoid { } private fun generateAnnotationsForDeclaration(declaration: IrDeclaration) { + // For interface functions implemented by delegation, + // front-end (incorrectly) copies annotations from corresponding interface members. + if (declaration is IrProperty && declaration.origin == IrDeclarationOrigin.DELEGATED_MEMBER) return + // Delegate field is mapped to a new property descriptor with annotations of the original property delegate // (see IrPropertyDelegateDescriptorImpl), but annotations on backing fields should be processed manually here val annotatedDescriptor = if (declaration is IrField && declaration.origin != IrDeclarationOrigin.PROPERTY_DELEGATE) declaration.descriptor.backingField - else declaration.descriptor + else + declaration.descriptor if (annotatedDescriptor != null) { declaration.annotations += annotatedDescriptor.annotations.mapNotNull { diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ClassGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ClassGenerator.kt index e639a49bc03..e5ba8c9f328 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ClassGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ClassGenerator.kt @@ -75,7 +75,7 @@ class ClassGenerator( fun List.sortedByRenderer(): List { val rendered = map(DESCRIPTOR_RENDERER::render) - val sortedIndices = (0 until size).sortedWith(Comparator { i, j -> rendered[i].compareTo(rendered[j]) }) + val sortedIndices = (0 until size).sortedWith { i, j -> rendered[i].compareTo(rendered[j]) } return sortedIndices.map { this[it] } } } diff --git a/compiler/testData/codegen/bytecodeListing/annotations/annotationsOnDelegatedMembers.kt b/compiler/testData/codegen/bytecodeListing/annotations/annotationsOnDelegatedMembers.kt new file mode 100644 index 00000000000..807a2746c15 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/annotations/annotationsOnDelegatedMembers.kt @@ -0,0 +1,10 @@ +annotation class Ann + +interface IFoo { + @Ann val testVal: String + @Ann fun testFun() + @Ann val String.testExtVal: String + @Ann fun String.testExtFun() +} + +class DFoo(d: IFoo) : IFoo by d \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/annotations/annotationsOnDelegatedMembers.txt b/compiler/testData/codegen/bytecodeListing/annotations/annotationsOnDelegatedMembers.txt new file mode 100644 index 00000000000..7400c511c83 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/annotations/annotationsOnDelegatedMembers.txt @@ -0,0 +1,34 @@ +@java.lang.annotation.Retention +@kotlin.Metadata +public annotation class Ann { + // source: 'annotationsOnDelegatedMembers.kt' +} + +@kotlin.Metadata +public final class DFoo { + // source: 'annotationsOnDelegatedMembers.kt' + private synthetic final field $$delegate_0: IFoo + public method (@org.jetbrains.annotations.NotNull p0: IFoo): void + public @org.jetbrains.annotations.NotNull method getTestExtVal(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.String + public @org.jetbrains.annotations.NotNull method getTestVal(): java.lang.String + public @Ann method testExtFun(@org.jetbrains.annotations.NotNull p0: java.lang.String): void + public @Ann method testFun(): void +} + +@kotlin.Metadata +public final class IFoo$DefaultImpls { + // source: 'annotationsOnDelegatedMembers.kt' + public synthetic deprecated static @Ann method getTestExtVal$annotations(p0: java.lang.String): void + public synthetic deprecated static @Ann method getTestVal$annotations(): void + public final inner class IFoo$DefaultImpls +} + +@kotlin.Metadata +public interface IFoo { + // source: 'annotationsOnDelegatedMembers.kt' + public abstract @org.jetbrains.annotations.NotNull method getTestExtVal(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.String + public abstract @org.jetbrains.annotations.NotNull method getTestVal(): java.lang.String + public abstract @Ann method testExtFun(@org.jetbrains.annotations.NotNull p0: java.lang.String): void + public abstract @Ann method testFun(): void + public final inner class IFoo$DefaultImpls +} diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.fir.txt b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.fir.txt new file mode 100644 index 00000000000..230b63660fb --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.fir.txt @@ -0,0 +1,120 @@ +FILE fqName: fileName:/annotationsOnDelegatedMembers.kt + CLASS ANNOTATION_CLASS name:Ann modality:FINAL visibility:public superTypes:[kotlin.Annotation] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Ann + CONSTRUCTOR visibility:public <> () returnType:.Ann [primary] + 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 + CLASS INTERFACE name:IFoo modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.IFoo + PROPERTY name:testVal visibility:public modality:ABSTRACT [val] + annotations: + Ann + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:ABSTRACT <> ($this:.IFoo) returnType:kotlin.String + correspondingProperty: PROPERTY name:testVal visibility:public modality:ABSTRACT [val] + $this: VALUE_PARAMETER name: type:.IFoo + FUN name:testFun visibility:public modality:ABSTRACT <> ($this:.IFoo) returnType:kotlin.Unit + annotations: + Ann + $this: VALUE_PARAMETER name: type:.IFoo + PROPERTY name:testExtVal visibility:public modality:ABSTRACT [val] + annotations: + Ann + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:ABSTRACT <> ($this:.IFoo, $receiver:kotlin.String) returnType:kotlin.String + correspondingProperty: PROPERTY name:testExtVal visibility:public modality:ABSTRACT [val] + $this: VALUE_PARAMETER name: type:.IFoo + $receiver: VALUE_PARAMETER name: type:kotlin.String + FUN name:testExtFun visibility:public modality:ABSTRACT <> ($this:.IFoo, $receiver:kotlin.String) returnType:kotlin.Unit + annotations: + Ann + $this: VALUE_PARAMETER name: type:.IFoo + $receiver: VALUE_PARAMETER name: type:kotlin.String + 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 + CLASS CLASS name:DFoo modality:FINAL visibility:public superTypes:[.IFoo] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.DFoo + CONSTRUCTOR visibility:public <> (d:.IFoo) returnType:.DFoo [primary] + VALUE_PARAMETER name:d index:0 type:.IFoo + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:DFoo modality:FINAL visibility:public superTypes:[.IFoo]' + SET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.IFoo visibility:local [final]' type=kotlin.Unit origin=EQ + receiver: GET_VAR ': .DFoo declared in .DFoo' type=.DFoo origin=null + value: GET_VAR 'd: .IFoo declared in .DFoo.' type=.IFoo origin=null + FUN DELEGATED_MEMBER name:testFun visibility:public modality:OPEN <> ($this:.DFoo) returnType:kotlin.Unit + overridden: + public abstract fun testFun (): kotlin.Unit declared in .IFoo + $this: VALUE_PARAMETER name: type:.DFoo + BLOCK_BODY + CALL 'public abstract fun testFun (): kotlin.Unit declared in .IFoo' type=kotlin.Unit origin=null + $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.IFoo visibility:local [final]' type=.IFoo origin=null + receiver: GET_VAR ': .DFoo declared in .DFoo.testFun' type=.DFoo origin=null + FUN DELEGATED_MEMBER name:testExtFun visibility:public modality:OPEN <> ($this:.DFoo, $receiver:kotlin.String) returnType:kotlin.Unit + overridden: + public abstract fun testExtFun (): kotlin.Unit declared in .IFoo + $this: VALUE_PARAMETER name: type:.DFoo + $receiver: VALUE_PARAMETER name: type:kotlin.String + BLOCK_BODY + CALL 'public abstract fun testExtFun (): kotlin.Unit declared in .IFoo' type=kotlin.Unit origin=null + $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.IFoo visibility:local [final]' type=.IFoo origin=null + receiver: GET_VAR ': .DFoo declared in .DFoo.testExtFun' type=.DFoo origin=null + $receiver: GET_VAR ': kotlin.String declared in .DFoo.testExtFun' type=kotlin.String origin=null + PROPERTY DELEGATED_MEMBER name:testVal visibility:public modality:OPEN [val] + FUN DELEGATED_MEMBER name: visibility:public modality:OPEN <> ($this:.DFoo) returnType:kotlin.String + correspondingProperty: PROPERTY DELEGATED_MEMBER name:testVal visibility:public modality:OPEN [val] + overridden: + public abstract fun (): kotlin.String declared in .IFoo + $this: VALUE_PARAMETER name: type:.DFoo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .DFoo' + CALL 'public abstract fun (): kotlin.String declared in .IFoo' type=kotlin.String origin=null + $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.IFoo visibility:local [final]' type=.IFoo origin=null + receiver: GET_VAR ': .DFoo declared in .DFoo.' type=.DFoo origin=null + PROPERTY DELEGATED_MEMBER name:testExtVal visibility:public modality:OPEN [val] + FUN DELEGATED_MEMBER name: visibility:public modality:OPEN <> ($this:.DFoo, $receiver:kotlin.String) returnType:kotlin.String + correspondingProperty: PROPERTY DELEGATED_MEMBER name:testExtVal visibility:public modality:OPEN [val] + overridden: + public abstract fun (): kotlin.String declared in .IFoo + $this: VALUE_PARAMETER name: type:.DFoo + $receiver: VALUE_PARAMETER name: type:kotlin.String + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .DFoo' + CALL 'public abstract fun (): kotlin.String declared in .IFoo' type=kotlin.String origin=null + $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.IFoo visibility:local [final]' type=.IFoo origin=null + receiver: GET_VAR ': .DFoo declared in .DFoo.' type=.DFoo origin=null + $receiver: GET_VAR ': kotlin.String declared in .DFoo.' type=kotlin.String origin=null + FIELD DELEGATE name:<$$delegate_0> type:.IFoo visibility:local [final] + 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 diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt new file mode 100644 index 00000000000..807a2746c15 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt @@ -0,0 +1,10 @@ +annotation class Ann + +interface IFoo { + @Ann val testVal: String + @Ann fun testFun() + @Ann val String.testExtVal: String + @Ann fun String.testExtFun() +} + +class DFoo(d: IFoo) : IFoo by d \ No newline at end of file diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.txt b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.txt new file mode 100644 index 00000000000..3032d5e006c --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.txt @@ -0,0 +1,123 @@ +FILE fqName: fileName:/annotationsOnDelegatedMembers.kt + CLASS ANNOTATION_CLASS name:Ann modality:FINAL visibility:public superTypes:[kotlin.Annotation] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Ann + CONSTRUCTOR visibility:public <> () returnType:.Ann [primary] + 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 [fake_override,operator] declared in kotlin.Annotation + $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 [fake_override] declared in kotlin.Annotation + $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 [fake_override] declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:IFoo modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.IFoo + PROPERTY name:testVal visibility:public modality:ABSTRACT [val] + annotations: + Ann + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:ABSTRACT <> ($this:.IFoo) returnType:kotlin.String + correspondingProperty: PROPERTY name:testVal visibility:public modality:ABSTRACT [val] + $this: VALUE_PARAMETER name: type:.IFoo + FUN name:testFun visibility:public modality:ABSTRACT <> ($this:.IFoo) returnType:kotlin.Unit + annotations: + Ann + $this: VALUE_PARAMETER name: type:.IFoo + PROPERTY name:testExtVal visibility:public modality:ABSTRACT [val] + annotations: + Ann + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:ABSTRACT <> ($this:.IFoo, $receiver:kotlin.String) returnType:kotlin.String + correspondingProperty: PROPERTY name:testExtVal visibility:public modality:ABSTRACT [val] + $this: VALUE_PARAMETER name: type:.IFoo + $receiver: VALUE_PARAMETER name: type:kotlin.String + FUN name:testExtFun visibility:public modality:ABSTRACT <> ($this:.IFoo, $receiver:kotlin.String) returnType:kotlin.Unit + annotations: + Ann + $this: VALUE_PARAMETER name: type:.IFoo + $receiver: VALUE_PARAMETER name: type:kotlin.String + 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 + CLASS CLASS name:DFoo modality:FINAL visibility:public superTypes:[.IFoo] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.DFoo + CONSTRUCTOR visibility:public <> (d:.IFoo) returnType:.DFoo [primary] + VALUE_PARAMETER name:d index:0 type:.IFoo + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:DFoo modality:FINAL visibility:public superTypes:[.IFoo]' + FIELD DELEGATE name:$$delegate_0 type:.IFoo visibility:private [final] + EXPRESSION_BODY + GET_VAR 'd: .IFoo declared in .DFoo.' type=.IFoo origin=null + FUN DELEGATED_MEMBER name:testExtFun visibility:public modality:OPEN <> ($this:.DFoo, $receiver:kotlin.String) returnType:kotlin.Unit + annotations: + Ann + overridden: + public abstract fun testExtFun (): kotlin.Unit declared in .IFoo + $this: VALUE_PARAMETER name: type:.DFoo + $receiver: VALUE_PARAMETER name: type:kotlin.String + BLOCK_BODY + CALL 'public abstract fun testExtFun (): kotlin.Unit declared in .IFoo' type=kotlin.Unit origin=null + $this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:.IFoo visibility:private [final]' type=.IFoo origin=null + receiver: GET_VAR ': .DFoo declared in .DFoo.testExtFun' type=.DFoo origin=null + $receiver: GET_VAR ': kotlin.String declared in .DFoo.testExtFun' type=kotlin.String origin=null + FUN DELEGATED_MEMBER name:testFun visibility:public modality:OPEN <> ($this:.DFoo) returnType:kotlin.Unit + annotations: + Ann + overridden: + public abstract fun testFun (): kotlin.Unit declared in .IFoo + $this: VALUE_PARAMETER name: type:.DFoo + BLOCK_BODY + CALL 'public abstract fun testFun (): kotlin.Unit declared in .IFoo' type=kotlin.Unit origin=null + $this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:.IFoo visibility:private [final]' type=.IFoo origin=null + receiver: GET_VAR ': .DFoo declared in .DFoo.testFun' type=.DFoo origin=null + PROPERTY DELEGATED_MEMBER name:testExtVal visibility:public modality:OPEN [val] + FUN DELEGATED_MEMBER name: visibility:public modality:OPEN <> ($this:.DFoo, $receiver:kotlin.String) returnType:kotlin.String + correspondingProperty: PROPERTY DELEGATED_MEMBER name:testExtVal visibility:public modality:OPEN [val] + overridden: + public abstract fun (): kotlin.String declared in .IFoo + $this: VALUE_PARAMETER name: type:.DFoo + $receiver: VALUE_PARAMETER name: type:kotlin.String + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .DFoo' + CALL 'public abstract fun (): kotlin.String declared in .IFoo' type=kotlin.String origin=null + $this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:.IFoo visibility:private [final]' type=.IFoo origin=null + receiver: GET_VAR ': .DFoo declared in .DFoo.' type=.DFoo origin=null + $receiver: GET_VAR ': kotlin.String declared in .DFoo.' type=kotlin.String origin=null + PROPERTY DELEGATED_MEMBER name:testVal visibility:public modality:OPEN [val] + FUN DELEGATED_MEMBER name: visibility:public modality:OPEN <> ($this:.DFoo) returnType:kotlin.String + correspondingProperty: PROPERTY DELEGATED_MEMBER name:testVal visibility:public modality:OPEN [val] + overridden: + public abstract fun (): kotlin.String declared in .IFoo + $this: VALUE_PARAMETER name: type:.DFoo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .DFoo' + CALL 'public abstract fun (): kotlin.String declared in .IFoo' type=kotlin.String origin=null + $this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:.IFoo visibility:private [final]' type=.IFoo origin=null + receiver: GET_VAR ': .DFoo declared in .DFoo.' type=.DFoo origin=null + 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 [fake_override,operator] declared in .IFoo + $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 [fake_override] declared in .IFoo + $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 [fake_override] declared in .IFoo + $this: VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index 680ee0fb00f..d517d4b2cfa 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -171,6 +171,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/annotations"), Pattern.compile("^(.+)\\.kt$"), null, true); } + @TestMetadata("annotationsOnDelegatedMembers.kt") + public void testAnnotationsOnDelegatedMembers() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/annotations/annotationsOnDelegatedMembers.kt"); + } + @TestMetadata("defaultTargets.kt") public void testDefaultTargets() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/annotations/defaultTargets.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java index 8adce5c33bf..601a7f227ca 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java @@ -171,6 +171,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/annotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @TestMetadata("annotationsOnDelegatedMembers.kt") + public void testAnnotationsOnDelegatedMembers() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/annotations/annotationsOnDelegatedMembers.kt"); + } + @TestMetadata("defaultTargets.kt") public void testDefaultTargets() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/annotations/defaultTargets.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java index 6888e08b8a0..01db87ff932 100644 --- a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java @@ -400,6 +400,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase { runTest("compiler/testData/ir/irText/declarations/annotations/annotationsInAnnotationArguments.kt"); } + @TestMetadata("annotationsOnDelegatedMembers.kt") + public void testAnnotationsOnDelegatedMembers() throws Exception { + runTest("compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.kt"); + } + @TestMetadata("annotationsWithDefaultParameterValues.kt") public void testAnnotationsWithDefaultParameterValues() throws Exception { runTest("compiler/testData/ir/irText/declarations/annotations/annotationsWithDefaultParameterValues.kt");