diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DelegatedMemberGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DelegatedMemberGenerator.kt index 4f1add4aa4e..038bdbd347e 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DelegatedMemberGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DelegatedMemberGenerator.kt @@ -400,7 +400,15 @@ class DelegatedMemberGenerator(private val components: Fir2IrComponents) : Fir2I baseSymbols.add(it) } basePropertySymbols[delegateProperty] = baseSymbols - // Do not generate annotations to copy K1 behavior, see KT-57228. + // Do not generate annotations on property to copy K1 behavior, see KT-57228. + // But generate annotations on accessors, see KT-64466. + firDelegateProperty.getter?.let { firGetter -> + annotationGenerator.generate(delegateProperty.getter!!, firGetter) + } + + firDelegateProperty.setter?.let { firSetter -> + annotationGenerator.generate(delegateProperty.setter!!, firSetter) + } return delegateProperty } diff --git a/compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.fir.ir.txt b/compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.fir.ir.txt index e1c056af6d4..5090700b284 100644 --- a/compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.fir.ir.txt +++ b/compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.fir.ir.txt @@ -92,6 +92,8 @@ FILE fqName: fileName:/annotationsOnDelegatedMembers.kt overridden: public abstract propWithAccessors: kotlin.Int FUN DELEGATED_MEMBER name: visibility:public modality:OPEN <> ($this:.Delegated) returnType:kotlin.Int + annotations: + Ann correspondingProperty: PROPERTY DELEGATED_MEMBER name:propWithAccessors visibility:public modality:OPEN [var] overridden: public abstract fun (): kotlin.Int declared in .Base @@ -102,6 +104,8 @@ FILE fqName: fileName:/annotationsOnDelegatedMembers.kt $this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:.Base visibility:private [final]' type=.Base origin=null receiver: GET_VAR ': .Delegated declared in .Delegated.' type=.Delegated origin=null FUN DELEGATED_MEMBER name: visibility:public modality:OPEN <> ($this:.Delegated, :kotlin.Int) returnType:kotlin.Unit + annotations: + Ann correspondingProperty: PROPERTY DELEGATED_MEMBER name:propWithAccessors visibility:public modality:OPEN [var] overridden: public abstract fun (: kotlin.Int): kotlin.Unit declared in .Base diff --git a/compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.fir.kt.txt b/compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.fir.kt.txt index 50a6e2b9a36..638df3fbbcd 100644 --- a/compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.fir.kt.txt +++ b/compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.fir.kt.txt @@ -42,9 +42,11 @@ class Delegated : Base { } override var propWithAccessors: Int + @Ann override get(): Int { return .#$$delegate_0.() } + @Ann override set(: Int) { .#$$delegate_0.( = ) } diff --git a/compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.sig.kt.txt b/compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.sig.kt.txt index d552acb46b2..a9b2387538d 100644 --- a/compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.sig.kt.txt +++ b/compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.sig.kt.txt @@ -36,6 +36,10 @@ class Delegated : Base { // Mangled name: Delegated#(){}kotlin.Int // Public signature: /Delegated.prop.|-2094203252476742575[0] // Public signature debug description: (){}kotlin.Int + // CHECK JS_IR NATIVE: + // Mangled name: Delegated#(){} + // Public signature: /Delegated.prop.|-5734736374948136327[0] + // Public signature debug description: (){} override get(): Int // CHECK: @@ -47,6 +51,10 @@ class Delegated : Base { // Mangled name: Delegated#(){}kotlin.Int // Public signature: /Delegated.propWithAccessors.|1392907778891534138[0] // Public signature debug description: (){}kotlin.Int + // CHECK JS_IR NATIVE: + // Mangled name: Delegated#(){} + // Public signature: /Delegated.propWithAccessors.|5253508570158188209[0] + // Public signature debug description: (){} @Ann override get(): Int // CHECK: @@ -79,6 +87,10 @@ interface Base { // Mangled name: Base#(){}kotlin.Int // Public signature: /Base.prop.|-2094203252476742575[0] // Public signature debug description: (){}kotlin.Int + // CHECK JS_IR NATIVE: + // Mangled name: Base#(){} + // Public signature: /Base.prop.|-5734736374948136327[0] + // Public signature debug description: (){} abstract get // CHECK: @@ -90,6 +102,10 @@ interface Base { // Mangled name: Base#(){}kotlin.Int // Public signature: /Base.propWithAccessors.|1392907778891534138[0] // Public signature debug description: (){}kotlin.Int + // CHECK JS_IR NATIVE: + // Mangled name: Base#(){} + // Public signature: /Base.propWithAccessors.|5253508570158188209[0] + // Public signature debug description: (){} @Ann abstract get // CHECK: @@ -100,3 +116,4 @@ interface Base { abstract set } +