diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirLightTreeJvmIrTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirLightTreeJvmIrTextTestGenerated.java index 27818467620..954475624b1 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirLightTreeJvmIrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirLightTreeJvmIrTextTestGenerated.java @@ -52,6 +52,12 @@ public class FirLightTreeJvmIrTextTestGenerated extends AbstractFirLightTreeJvmI runTest("compiler/testData/ir/irText/classes/annotationClasses.kt"); } + @Test + @TestMetadata("annotationsOnDelegatedMembers.kt") + public void testAnnotationsOnDelegatedMembers() throws Exception { + runTest("compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.kt"); + } + @Test @TestMetadata("argumentReorderingInDelegatingConstructorCall.kt") public void testArgumentReorderingInDelegatingConstructorCall() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirPsiJvmIrTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirPsiJvmIrTextTestGenerated.java index ab8270655a1..2c00cf655fc 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirPsiJvmIrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirPsiJvmIrTextTestGenerated.java @@ -52,6 +52,12 @@ public class FirPsiJvmIrTextTestGenerated extends AbstractFirPsiJvmIrTextTest { runTest("compiler/testData/ir/irText/classes/annotationClasses.kt"); } + @Test + @TestMetadata("annotationsOnDelegatedMembers.kt") + public void testAnnotationsOnDelegatedMembers() throws Exception { + runTest("compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.kt"); + } + @Test @TestMetadata("argumentReorderingInDelegatingConstructorCall.kt") public void testArgumentReorderingInDelegatingConstructorCall() throws Exception { diff --git a/compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.fir.ir.txt b/compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.fir.ir.txt new file mode 100644 index 00000000000..e1c056af6d4 --- /dev/null +++ b/compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.fir.ir.txt @@ -0,0 +1,127 @@ +FILE fqName: fileName:/annotationsOnDelegatedMembers.kt + CLASS ANNOTATION_CLASS name:Ann modality:OPEN visibility:public superTypes:[kotlin.Annotation] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Ann + CONSTRUCTOR visibility:public <> () returnType:.Ann [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ANNOTATION_CLASS name:Ann modality:OPEN visibility:public superTypes:[kotlin.Annotation]' + 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 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 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 declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:Base modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Base + FUN name:func visibility:public modality:ABSTRACT <> ($this:.Base) returnType:kotlin.Unit + annotations: + Ann + $this: VALUE_PARAMETER name: type:.Base + PROPERTY name:prop visibility:public modality:ABSTRACT [val] + annotations: + Ann + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:ABSTRACT <> ($this:.Base) returnType:kotlin.Int + correspondingProperty: PROPERTY name:prop visibility:public modality:ABSTRACT [val] + $this: VALUE_PARAMETER name: type:.Base + PROPERTY name:propWithAccessors visibility:public modality:ABSTRACT [var] + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:ABSTRACT <> ($this:.Base) returnType:kotlin.Int + annotations: + Ann + correspondingProperty: PROPERTY name:propWithAccessors visibility:public modality:ABSTRACT [var] + $this: VALUE_PARAMETER name: type:.Base + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:ABSTRACT <> ($this:.Base, :kotlin.Int) returnType:kotlin.Unit + annotations: + Ann + correspondingProperty: PROPERTY name:propWithAccessors visibility:public modality:ABSTRACT [var] + $this: VALUE_PARAMETER name: type:.Base + VALUE_PARAMETER name: index:0 type:kotlin.Int + 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 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:Delegated modality:FINAL visibility:public superTypes:[.Base] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Delegated + CONSTRUCTOR visibility:public <> (b:.Base) returnType:.Delegated [primary] + VALUE_PARAMETER name:b index:0 type:.Base + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Delegated modality:FINAL visibility:public superTypes:[.Base]' + FIELD DELEGATE name:$$delegate_0 type:.Base visibility:private [final] + EXPRESSION_BODY + GET_VAR 'b: .Base declared in .Delegated.' type=.Base origin=null + FUN DELEGATED_MEMBER name:func visibility:public modality:OPEN <> ($this:.Delegated) returnType:kotlin.Unit + annotations: + Ann + overridden: + public abstract fun func (): kotlin.Unit declared in .Base + $this: VALUE_PARAMETER name: type:.Delegated + BLOCK_BODY + CALL 'public abstract fun func (): kotlin.Unit declared in .Base' type=kotlin.Unit origin=null + $this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:.Base visibility:private [final]' type=.Base origin=null + receiver: GET_VAR ': .Delegated declared in .Delegated.func' type=.Delegated origin=null + PROPERTY DELEGATED_MEMBER name:prop visibility:public modality:OPEN [val] + overridden: + public abstract prop: kotlin.Int + FUN DELEGATED_MEMBER name: visibility:public modality:OPEN <> ($this:.Delegated) returnType:kotlin.Int + correspondingProperty: PROPERTY DELEGATED_MEMBER name:prop visibility:public modality:OPEN [val] + overridden: + public abstract fun (): kotlin.Int declared in .Base + $this: VALUE_PARAMETER name: type:.Delegated + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.Int declared in .Delegated' + CALL 'public abstract fun (): kotlin.Int declared in .Base' type=kotlin.Int origin=null + $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 + PROPERTY DELEGATED_MEMBER name:propWithAccessors visibility:public modality:OPEN [var] + overridden: + public abstract propWithAccessors: kotlin.Int + FUN DELEGATED_MEMBER name: visibility:public modality:OPEN <> ($this:.Delegated) returnType:kotlin.Int + correspondingProperty: PROPERTY DELEGATED_MEMBER name:propWithAccessors visibility:public modality:OPEN [var] + overridden: + public abstract fun (): kotlin.Int declared in .Base + $this: VALUE_PARAMETER name: type:.Delegated + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.Int declared in .Delegated' + CALL 'public abstract fun (): kotlin.Int declared in .Base' type=kotlin.Int origin=null + $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 + correspondingProperty: PROPERTY DELEGATED_MEMBER name:propWithAccessors visibility:public modality:OPEN [var] + overridden: + public abstract fun (: kotlin.Int): kotlin.Unit declared in .Base + $this: VALUE_PARAMETER name: type:.Delegated + VALUE_PARAMETER name: index:0 type:kotlin.Int + BLOCK_BODY + CALL 'public abstract fun (: kotlin.Int): kotlin.Unit declared in .Base' type=kotlin.Unit origin=null + $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 + : GET_VAR ': kotlin.Int declared in .Delegated.' type=kotlin.Int 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 declared in .Base + $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 .Base + $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 .Base + $this: VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.fir.kt.txt b/compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.fir.kt.txt new file mode 100644 index 00000000000..50a6e2b9a36 --- /dev/null +++ b/compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.fir.kt.txt @@ -0,0 +1,52 @@ +open annotation class Ann : Annotation { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +interface Base { + @Ann + abstract fun func() + + @Ann + abstract val prop: Int + abstract get + + abstract var propWithAccessors: Int + @Ann + abstract get + @Ann + abstract set + +} + +class Delegated : Base { + constructor(b: Base) /* primary */ { + super/*Any*/() + /* () */ + + } + + private /* final field */ val $$delegate_0: Base = b + @Ann + override fun func() { + .#$$delegate_0.func() + } + + override val prop: Int + override get(): Int { + return .#$$delegate_0.() + } + + override var propWithAccessors: Int + override get(): Int { + return .#$$delegate_0.() + } + override set(: Int) { + .#$$delegate_0.( = ) + } + +} diff --git a/compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.ir.txt b/compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.ir.txt new file mode 100644 index 00000000000..9f5c0b54408 --- /dev/null +++ b/compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.ir.txt @@ -0,0 +1,131 @@ +FILE fqName: fileName:/annotationsOnDelegatedMembers.kt + CLASS ANNOTATION_CLASS name:Ann modality:OPEN visibility:public superTypes:[kotlin.Annotation] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Ann + CONSTRUCTOR visibility:public <> () returnType:.Ann [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ANNOTATION_CLASS name:Ann modality:OPEN visibility:public superTypes:[kotlin.Annotation]' + 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 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 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 declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:Base modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Base + FUN name:func visibility:public modality:ABSTRACT <> ($this:.Base) returnType:kotlin.Unit + annotations: + Ann + $this: VALUE_PARAMETER name: type:.Base + PROPERTY name:prop visibility:public modality:ABSTRACT [val] + annotations: + Ann + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:ABSTRACT <> ($this:.Base) returnType:kotlin.Int + correspondingProperty: PROPERTY name:prop visibility:public modality:ABSTRACT [val] + $this: VALUE_PARAMETER name: type:.Base + PROPERTY name:propWithAccessors visibility:public modality:ABSTRACT [var] + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:ABSTRACT <> ($this:.Base) returnType:kotlin.Int + annotations: + Ann + correspondingProperty: PROPERTY name:propWithAccessors visibility:public modality:ABSTRACT [var] + $this: VALUE_PARAMETER name: type:.Base + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:ABSTRACT <> ($this:.Base, :kotlin.Int) returnType:kotlin.Unit + annotations: + Ann + correspondingProperty: PROPERTY name:propWithAccessors visibility:public modality:ABSTRACT [var] + $this: VALUE_PARAMETER name: type:.Base + VALUE_PARAMETER name: index:0 type:kotlin.Int + 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 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:Delegated modality:FINAL visibility:public superTypes:[.Base] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Delegated + CONSTRUCTOR visibility:public <> (b:.Base) returnType:.Delegated [primary] + VALUE_PARAMETER name:b index:0 type:.Base + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Delegated modality:FINAL visibility:public superTypes:[.Base]' + FIELD DELEGATE name:$$delegate_0 type:.Base visibility:private [final] + EXPRESSION_BODY + GET_VAR 'b: .Base declared in .Delegated.' type=.Base origin=null + PROPERTY DELEGATED_MEMBER name:prop visibility:public modality:OPEN [val] + overridden: + public abstract prop: kotlin.Int + FUN DELEGATED_MEMBER name: visibility:public modality:OPEN <> ($this:.Delegated) returnType:kotlin.Int + correspondingProperty: PROPERTY DELEGATED_MEMBER name:prop visibility:public modality:OPEN [val] + overridden: + public abstract fun (): kotlin.Int declared in .Base + $this: VALUE_PARAMETER name: type:.Delegated + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.Int declared in .Delegated' + CALL 'public abstract fun (): kotlin.Int declared in .Base' type=kotlin.Int origin=null + $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 + PROPERTY DELEGATED_MEMBER name:propWithAccessors visibility:public modality:OPEN [var] + 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 + $this: VALUE_PARAMETER name: type:.Delegated + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.Int declared in .Delegated' + CALL 'public abstract fun (): kotlin.Int declared in .Base' type=kotlin.Int origin=null + $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 + $this: VALUE_PARAMETER name: type:.Delegated + VALUE_PARAMETER name: index:0 type:kotlin.Int + BLOCK_BODY + CALL 'public abstract fun (: kotlin.Int): kotlin.Unit declared in .Base' type=kotlin.Unit origin=null + $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 + : GET_VAR ': kotlin.Int declared in .Delegated.' type=kotlin.Int origin=null + FUN DELEGATED_MEMBER name:func visibility:public modality:OPEN <> ($this:.Delegated) returnType:kotlin.Unit + annotations: + Ann + overridden: + public abstract fun func (): kotlin.Unit declared in .Base + $this: VALUE_PARAMETER name: type:.Delegated + BLOCK_BODY + CALL 'public abstract fun func (): kotlin.Unit declared in .Base' type=kotlin.Unit origin=null + $this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:.Base visibility:private [final]' type=.Base origin=null + receiver: GET_VAR ': .Delegated declared in .Delegated.func' type=.Delegated 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 declared in .Base + $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 .Base + $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 .Base + $this: VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.kt b/compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.kt new file mode 100644 index 00000000000..30c4ecbad57 --- /dev/null +++ b/compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.kt @@ -0,0 +1,17 @@ +// ISSUE: KT-64466 + +annotation class Ann + +interface Base { + @Ann + fun func() + + @Ann + val prop: Int + + var propWithAccessors: Int + @Ann get + @Ann set +} + +class Delegated(b: Base) : Base by b diff --git a/compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.kt.txt b/compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.kt.txt new file mode 100644 index 00000000000..88ebcabd006 --- /dev/null +++ b/compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.kt.txt @@ -0,0 +1,54 @@ +open annotation class Ann : Annotation { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + +} + +interface Base { + @Ann + abstract fun func() + + @Ann + abstract val prop: Int + abstract get + + abstract var propWithAccessors: Int + @Ann + abstract get + @Ann + abstract set + +} + +class Delegated : Base { + constructor(b: Base) /* primary */ { + super/*Any*/() + /* () */ + + } + + private /* final field */ val $$delegate_0: Base = b + override val prop: Int + override get(): Int { + return .#$$delegate_0.() + } + + override var propWithAccessors: Int + @Ann + override get(): Int { + return .#$$delegate_0.() + } + @Ann + override set(: Int) { + .#$$delegate_0.( = ) + } + + @Ann + override fun func() { + .#$$delegate_0.func() + } + +} diff --git a/compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.sig.kt.txt b/compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.sig.kt.txt new file mode 100644 index 00000000000..d552acb46b2 --- /dev/null +++ b/compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.sig.kt.txt @@ -0,0 +1,102 @@ +// CHECK: +// Mangled name: Ann +// Public signature: /Ann|null[0] +open annotation class Ann : Annotation { + // CHECK: + // Mangled name: Ann#(){} + // Public signature: /Ann.|-5645683436151566731[0] + // Public signature debug description: (){} + constructor() /* primary */ + +} + +// CHECK: +// Mangled name: Delegated +// Public signature: /Delegated|null[0] +class Delegated : Base { + // CHECK: + // Mangled name: Delegated#(Base){} + // Public signature: /Delegated.|8918428909696021993[0] + // Public signature debug description: (Base){} + constructor(b: Base) /* primary */ + + // CHECK: + // Mangled name: Delegated#func(){} + // Public signature: /Delegated.func|1643338395720868039[0] + // Public signature debug description: func(){} + @Ann + override fun func(): Unit + + // CHECK: + // Mangled name: Delegated{}prop + // Public signature: /Delegated.prop|3598315380056892812[0] + // Public signature debug description: {}prop + override val prop: Int + // CHECK JVM_IR: + // Mangled name: Delegated#(){}kotlin.Int + // Public signature: /Delegated.prop.|-2094203252476742575[0] + // Public signature debug description: (){}kotlin.Int + override get(): Int + + // CHECK: + // Mangled name: Delegated{}propWithAccessors + // Public signature: /Delegated.propWithAccessors|6816664192388941498[0] + // Public signature debug description: {}propWithAccessors + override var propWithAccessors: Int + // CHECK JVM_IR: + // Mangled name: Delegated#(){}kotlin.Int + // Public signature: /Delegated.propWithAccessors.|1392907778891534138[0] + // Public signature debug description: (){}kotlin.Int + @Ann + override get(): Int + // CHECK: + // Mangled name: Delegated#(kotlin.Int){} + // Public signature: /Delegated.propWithAccessors.|-5089950791342520697[0] + // Public signature debug description: (kotlin.Int){} + @Ann + override set(: Int): Unit + +} + +// CHECK: +// Mangled name: Base +// Public signature: /Base|null[0] +interface Base { + // CHECK: + // Mangled name: Base#func(){} + // Public signature: /Base.func|1643338395720868039[0] + // Public signature debug description: func(){} + @Ann + abstract fun func(): Unit + + // CHECK: + // Mangled name: Base{}prop + // Public signature: /Base.prop|3598315380056892812[0] + // Public signature debug description: {}prop + @Ann + abstract val prop: Int + // CHECK JVM_IR: + // Mangled name: Base#(){}kotlin.Int + // Public signature: /Base.prop.|-2094203252476742575[0] + // Public signature debug description: (){}kotlin.Int + abstract get + + // CHECK: + // Mangled name: Base{}propWithAccessors + // Public signature: /Base.propWithAccessors|6816664192388941498[0] + // Public signature debug description: {}propWithAccessors + abstract var propWithAccessors: Int + // CHECK JVM_IR: + // Mangled name: Base#(){}kotlin.Int + // Public signature: /Base.propWithAccessors.|1392907778891534138[0] + // Public signature debug description: (){}kotlin.Int + @Ann + abstract get + // CHECK: + // Mangled name: Base#(kotlin.Int){} + // Public signature: /Base.propWithAccessors.|-5089950791342520697[0] + // Public signature debug description: (kotlin.Int){} + @Ann + abstract set + +} diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/ClassicJvmIrTextTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/ClassicJvmIrTextTestGenerated.java index 4638da41fd9..37fbb228977 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/ClassicJvmIrTextTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/ClassicJvmIrTextTestGenerated.java @@ -52,6 +52,12 @@ public class ClassicJvmIrTextTestGenerated extends AbstractClassicJvmIrTextTest runTest("compiler/testData/ir/irText/classes/annotationClasses.kt"); } + @Test + @TestMetadata("annotationsOnDelegatedMembers.kt") + public void testAnnotationsOnDelegatedMembers() throws Exception { + runTest("compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.kt"); + } + @Test @TestMetadata("argumentReorderingInDelegatingConstructorCall.kt") public void testArgumentReorderingInDelegatingConstructorCall() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/klib/KlibIrTextTestCaseGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/klib/KlibIrTextTestCaseGenerated.java index 0d267aac329..a7ceeace311 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/klib/KlibIrTextTestCaseGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/klib/KlibIrTextTestCaseGenerated.java @@ -57,6 +57,11 @@ public class KlibIrTextTestCaseGenerated extends AbstractKlibIrTextTestCase { runTest("compiler/testData/ir/irText/classes/annotationClasses.kt"); } + @TestMetadata("annotationsOnDelegatedMembers.kt") + public void testAnnotationsOnDelegatedMembers() throws Exception { + runTest("compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.kt"); + } + @TestMetadata("argumentReorderingInDelegatingConstructorCall.kt") public void testArgumentReorderingInDelegatingConstructorCall() throws Exception { runTest("compiler/testData/ir/irText/classes/argumentReorderingInDelegatingConstructorCall.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirLightTreeJsIrTextTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirLightTreeJsIrTextTestGenerated.java index 185efd64580..dbcf1cf38ac 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirLightTreeJsIrTextTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirLightTreeJsIrTextTestGenerated.java @@ -52,6 +52,12 @@ public class FirLightTreeJsIrTextTestGenerated extends AbstractFirLightTreeJsIrT runTest("compiler/testData/ir/irText/classes/annotationClasses.kt"); } + @Test + @TestMetadata("annotationsOnDelegatedMembers.kt") + public void testAnnotationsOnDelegatedMembers() throws Exception { + runTest("compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.kt"); + } + @Test @TestMetadata("argumentReorderingInDelegatingConstructorCall.kt") public void testArgumentReorderingInDelegatingConstructorCall() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirPsiJsIrTextTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirPsiJsIrTextTestGenerated.java index c60f20ccd3c..6f721851e5c 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirPsiJsIrTextTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirPsiJsIrTextTestGenerated.java @@ -52,6 +52,12 @@ public class FirPsiJsIrTextTestGenerated extends AbstractFirPsiJsIrTextTest { runTest("compiler/testData/ir/irText/classes/annotationClasses.kt"); } + @Test + @TestMetadata("annotationsOnDelegatedMembers.kt") + public void testAnnotationsOnDelegatedMembers() throws Exception { + runTest("compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.kt"); + } + @Test @TestMetadata("argumentReorderingInDelegatingConstructorCall.kt") public void testArgumentReorderingInDelegatingConstructorCall() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/ClassicJsIrTextTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/ClassicJsIrTextTestGenerated.java index c329aa78139..3ac1350c630 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/ClassicJsIrTextTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/ClassicJsIrTextTestGenerated.java @@ -52,6 +52,12 @@ public class ClassicJsIrTextTestGenerated extends AbstractClassicJsIrTextTest { runTest("compiler/testData/ir/irText/classes/annotationClasses.kt"); } + @Test + @TestMetadata("annotationsOnDelegatedMembers.kt") + public void testAnnotationsOnDelegatedMembers() throws Exception { + runTest("compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.kt"); + } + @Test @TestMetadata("argumentReorderingInDelegatingConstructorCall.kt") public void testArgumentReorderingInDelegatingConstructorCall() throws Exception { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/irtext/ClassicNativeIrTextTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/irtext/ClassicNativeIrTextTestGenerated.java index 11dd4fd0288..bd21754eec4 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/irtext/ClassicNativeIrTextTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/irtext/ClassicNativeIrTextTestGenerated.java @@ -52,6 +52,12 @@ public class ClassicNativeIrTextTestGenerated extends AbstractClassicNativeIrTex runTest("compiler/testData/ir/irText/classes/annotationClasses.kt"); } + @Test + @TestMetadata("annotationsOnDelegatedMembers.kt") + public void testAnnotationsOnDelegatedMembers() throws Exception { + runTest("compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.kt"); + } + @Test @TestMetadata("argumentReorderingInDelegatingConstructorCall.kt") public void testArgumentReorderingInDelegatingConstructorCall() throws Exception { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/irtext/FirLightTreeNativeIrTextTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/irtext/FirLightTreeNativeIrTextTestGenerated.java index 413ebe56f6c..e924f108212 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/irtext/FirLightTreeNativeIrTextTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/irtext/FirLightTreeNativeIrTextTestGenerated.java @@ -52,6 +52,12 @@ public class FirLightTreeNativeIrTextTestGenerated extends AbstractFirLightTreeN runTest("compiler/testData/ir/irText/classes/annotationClasses.kt"); } + @Test + @TestMetadata("annotationsOnDelegatedMembers.kt") + public void testAnnotationsOnDelegatedMembers() throws Exception { + runTest("compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.kt"); + } + @Test @TestMetadata("argumentReorderingInDelegatingConstructorCall.kt") public void testArgumentReorderingInDelegatingConstructorCall() throws Exception { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/irtext/FirPsiNativeIrTextTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/irtext/FirPsiNativeIrTextTestGenerated.java index e9b9d1d30d6..72c4083cda1 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/irtext/FirPsiNativeIrTextTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/irtext/FirPsiNativeIrTextTestGenerated.java @@ -52,6 +52,12 @@ public class FirPsiNativeIrTextTestGenerated extends AbstractFirPsiNativeIrTextT runTest("compiler/testData/ir/irText/classes/annotationClasses.kt"); } + @Test + @TestMetadata("annotationsOnDelegatedMembers.kt") + public void testAnnotationsOnDelegatedMembers() throws Exception { + runTest("compiler/testData/ir/irText/classes/annotationsOnDelegatedMembers.kt"); + } + @Test @TestMetadata("argumentReorderingInDelegatingConstructorCall.kt") public void testArgumentReorderingInDelegatingConstructorCall() throws Exception {