From 1b636bf450f466496a163611933bb4201f5a808e Mon Sep 17 00:00:00 2001 From: Dmitrii Gridin Date: Tue, 24 Oct 2023 21:47:14 +0200 Subject: [PATCH] [FIR] add tests on annotations for delegated getter during implicit type phase ^KT-62874 --- .../delegateWithAnnotationOnAccessor.kt | 15 + ...ithAnnotationOnAccessorWithExplicitType.kt | 15 + ...thAnnotationOnAccessorWithExplicitType.txt | 382 ++++++++++++++++++ ...otLazyDeclarationResolveTestGenerated.java | 12 + ...ceLazyDeclarationResolveTestGenerated.java | 12 + ...CompilerTestFE10TestdataTestGenerated.java | 12 + ...sticCompilerFE10TestDataTestGenerated.java | 12 + ...eeOldFrontendDiagnosticsTestGenerated.java | 12 + ...siOldFrontendDiagnosticsTestGenerated.java | 12 + ...ithAnnotationOnAccessorWithExplicitType.kt | 17 + ...nnotationOnAccessorWithImplicitType.fir.kt | 17 + ...ithAnnotationOnAccessorWithImplicitType.kt | 17 + .../test/runners/DiagnosticTestGenerated.java | 12 + 13 files changed, 547 insertions(+) create mode 100644 analysis/low-level-api-fir/testData/lazyResolve/properties/delegateWithAnnotationOnAccessor.kt create mode 100644 analysis/low-level-api-fir/testData/lazyResolve/properties/delegateWithAnnotationOnAccessorWithExplicitType.kt create mode 100644 analysis/low-level-api-fir/testData/lazyResolve/properties/delegateWithAnnotationOnAccessorWithExplicitType.txt create mode 100644 compiler/testData/diagnostics/tests/delegatedProperty/delegateWithAnnotationOnAccessorWithExplicitType.kt create mode 100644 compiler/testData/diagnostics/tests/delegatedProperty/delegateWithAnnotationOnAccessorWithImplicitType.fir.kt create mode 100644 compiler/testData/diagnostics/tests/delegatedProperty/delegateWithAnnotationOnAccessorWithImplicitType.kt diff --git a/analysis/low-level-api-fir/testData/lazyResolve/properties/delegateWithAnnotationOnAccessor.kt b/analysis/low-level-api-fir/testData/lazyResolve/properties/delegateWithAnnotationOnAccessor.kt new file mode 100644 index 00000000000..eb8af0e9ebb --- /dev/null +++ b/analysis/low-level-api-fir/testData/lazyResolve/properties/delegateWithAnnotationOnAccessor.kt @@ -0,0 +1,15 @@ +import kotlin.reflect.KProperty + +@get:Anno("getter") +@set:Anno("setter") +@setparam:Anno("parameter") +@delegate:Anno("delegate") +var foo by MyDelegate() + +@Repeatable +annotation class Anno(val s: String) + +class MyDelegate { + operator fun getValue(thisRef: Any?, property: KProperty<*>) = 42 + operator fun setValue(thisRef: Any?, property: KProperty<*>, value: Int) {} +} \ No newline at end of file diff --git a/analysis/low-level-api-fir/testData/lazyResolve/properties/delegateWithAnnotationOnAccessorWithExplicitType.kt b/analysis/low-level-api-fir/testData/lazyResolve/properties/delegateWithAnnotationOnAccessorWithExplicitType.kt new file mode 100644 index 00000000000..d11582bad3b --- /dev/null +++ b/analysis/low-level-api-fir/testData/lazyResolve/properties/delegateWithAnnotationOnAccessorWithExplicitType.kt @@ -0,0 +1,15 @@ +import kotlin.reflect.KProperty + +@get:Anno("getter") +@set:Anno("setter") +@setparam:Anno("parameter") +@delegate:Anno("delegate") +var foo: Int by MyDelegate() + +@Repeatable +annotation class Anno(val s: String) + +class MyDelegate { + operator fun getValue(thisRef: Any?, property: KProperty<*>) = 42 + operator fun setValue(thisRef: Any?, property: KProperty<*>, value: Int) {} +} \ No newline at end of file diff --git a/analysis/low-level-api-fir/testData/lazyResolve/properties/delegateWithAnnotationOnAccessorWithExplicitType.txt b/analysis/low-level-api-fir/testData/lazyResolve/properties/delegateWithAnnotationOnAccessorWithExplicitType.txt new file mode 100644 index 00000000000..6324e6c6dfd --- /dev/null +++ b/analysis/low-level-api-fir/testData/lazyResolve/properties/delegateWithAnnotationOnAccessorWithExplicitType.txt @@ -0,0 +1,382 @@ +RAW_FIR: +FILE: [ResolvedTo(RAW_FIR)] delegateWithAnnotationOnAccessorWithExplicitType.kt + field:@PROPERTY_DELEGATE_FIELD:Anno[Unresolved](LAZY_EXPRESSION) public? final? [ResolvedTo(RAW_FIR)] var foo: Intby LAZY_EXPRESSION + @PROPERTY_GETTER:Anno[Unresolved](LAZY_EXPRESSION) public? [ResolvedTo(RAW_FIR)] get(): { + ^ D|/foo|.getValue#(Null(null), ::R|/foo|) + } + @PROPERTY_SETTER:Anno[Unresolved](LAZY_EXPRESSION) public? [ResolvedTo(RAW_FIR)] set([ResolvedTo(RAW_FIR)] @SETTER_PARAMETER:Anno[Unresolved](LAZY_EXPRESSION) : ): R|kotlin/Unit| { + ^ D|/foo|.setValue#(Null(null), ::R|/foo|, R|/foo|) + } + @Repeatable[Unresolved]() public? final? [ResolvedTo(RAW_FIR)] annotation class Anno : R|kotlin/Annotation| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] constructor([ResolvedTo(RAW_FIR)] [CorrespondingProperty=/Anno.s] s: String): R|Anno| { + LAZY_super + } + + public? final? [ResolvedTo(RAW_FIR)] [IsFromPrimaryConstructor=true] val s: String = R|/s| + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] get(): String + + } + public? final? [ResolvedTo(RAW_FIR)] class MyDelegate : R|kotlin/Any| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=MyDelegate] constructor(): R|MyDelegate| { + LAZY_super + } + + public? final? operator [ResolvedTo(RAW_FIR)] fun getValue([ResolvedTo(RAW_FIR)] thisRef: Any?, [ResolvedTo(RAW_FIR)] property: KProperty<*>): { LAZY_BLOCK } + + public? final? operator [ResolvedTo(RAW_FIR)] fun setValue([ResolvedTo(RAW_FIR)] thisRef: Any?, [ResolvedTo(RAW_FIR)] property: KProperty<*>, [ResolvedTo(RAW_FIR)] value: Int): R|kotlin/Unit| { LAZY_BLOCK } + + } + +IMPORTS: +FILE: [ResolvedTo(IMPORTS)] delegateWithAnnotationOnAccessorWithExplicitType.kt + field:@PROPERTY_DELEGATE_FIELD:Anno[Unresolved](LAZY_EXPRESSION) public? final? [ResolvedTo(RAW_FIR)] var foo: Intby LAZY_EXPRESSION + @PROPERTY_GETTER:Anno[Unresolved](LAZY_EXPRESSION) public? [ResolvedTo(RAW_FIR)] get(): { + ^ D|/foo|.getValue#(Null(null), ::R|/foo|) + } + @PROPERTY_SETTER:Anno[Unresolved](LAZY_EXPRESSION) public? [ResolvedTo(RAW_FIR)] set([ResolvedTo(RAW_FIR)] @SETTER_PARAMETER:Anno[Unresolved](LAZY_EXPRESSION) : ): R|kotlin/Unit| { + ^ D|/foo|.setValue#(Null(null), ::R|/foo|, R|/foo|) + } + @Repeatable[Unresolved]() public? final? [ResolvedTo(RAW_FIR)] annotation class Anno : R|kotlin/Annotation| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] constructor([ResolvedTo(RAW_FIR)] [CorrespondingProperty=/Anno.s] s: String): R|Anno| { + LAZY_super + } + + public? final? [ResolvedTo(RAW_FIR)] [IsFromPrimaryConstructor=true] val s: String = R|/s| + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] get(): String + + } + public? final? [ResolvedTo(RAW_FIR)] class MyDelegate : R|kotlin/Any| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=MyDelegate] constructor(): R|MyDelegate| { + LAZY_super + } + + public? final? operator [ResolvedTo(RAW_FIR)] fun getValue([ResolvedTo(RAW_FIR)] thisRef: Any?, [ResolvedTo(RAW_FIR)] property: KProperty<*>): { LAZY_BLOCK } + + public? final? operator [ResolvedTo(RAW_FIR)] fun setValue([ResolvedTo(RAW_FIR)] thisRef: Any?, [ResolvedTo(RAW_FIR)] property: KProperty<*>, [ResolvedTo(RAW_FIR)] value: Int): R|kotlin/Unit| { LAZY_BLOCK } + + } + +COMPILER_REQUIRED_ANNOTATIONS: +FILE: [ResolvedTo(IMPORTS)] delegateWithAnnotationOnAccessorWithExplicitType.kt + field:@PROPERTY_DELEGATE_FIELD:Anno[Unresolved](LAZY_EXPRESSION) public? final? [ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] var foo: Intby LAZY_EXPRESSION + @PROPERTY_GETTER:Anno[Unresolved](LAZY_EXPRESSION) public? [ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] get(): { + ^ D|/foo|.getValue#(Null(null), ::R|/foo|) + } + @PROPERTY_SETTER:Anno[Unresolved](LAZY_EXPRESSION) public? [ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] set([ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] @SETTER_PARAMETER:Anno[Unresolved](LAZY_EXPRESSION) : ): R|kotlin/Unit| { + ^ D|/foo|.setValue#(Null(null), ::R|/foo|, R|/foo|) + } + @Repeatable[Unresolved]() public? final? [ResolvedTo(RAW_FIR)] annotation class Anno : R|kotlin/Annotation| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] constructor([ResolvedTo(RAW_FIR)] [CorrespondingProperty=/Anno.s] s: String): R|Anno| { + LAZY_super + } + + public? final? [ResolvedTo(RAW_FIR)] [IsFromPrimaryConstructor=true] val s: String = R|/s| + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] get(): String + + } + public? final? [ResolvedTo(RAW_FIR)] class MyDelegate : R|kotlin/Any| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=MyDelegate] constructor(): R|MyDelegate| { + LAZY_super + } + + public? final? operator [ResolvedTo(RAW_FIR)] fun getValue([ResolvedTo(RAW_FIR)] thisRef: Any?, [ResolvedTo(RAW_FIR)] property: KProperty<*>): { LAZY_BLOCK } + + public? final? operator [ResolvedTo(RAW_FIR)] fun setValue([ResolvedTo(RAW_FIR)] thisRef: Any?, [ResolvedTo(RAW_FIR)] property: KProperty<*>, [ResolvedTo(RAW_FIR)] value: Int): R|kotlin/Unit| { LAZY_BLOCK } + + } + +COMPANION_GENERATION: +FILE: [ResolvedTo(IMPORTS)] delegateWithAnnotationOnAccessorWithExplicitType.kt + field:@PROPERTY_DELEGATE_FIELD:Anno[Unresolved](LAZY_EXPRESSION) public? final? [ResolvedTo(COMPANION_GENERATION)] var foo: Intby LAZY_EXPRESSION + @PROPERTY_GETTER:Anno[Unresolved](LAZY_EXPRESSION) public? [ResolvedTo(COMPANION_GENERATION)] get(): { + ^ D|/foo|.getValue#(Null(null), ::R|/foo|) + } + @PROPERTY_SETTER:Anno[Unresolved](LAZY_EXPRESSION) public? [ResolvedTo(COMPANION_GENERATION)] set([ResolvedTo(COMPANION_GENERATION)] @SETTER_PARAMETER:Anno[Unresolved](LAZY_EXPRESSION) : ): R|kotlin/Unit| { + ^ D|/foo|.setValue#(Null(null), ::R|/foo|, R|/foo|) + } + @Repeatable[Unresolved]() public? final? [ResolvedTo(RAW_FIR)] annotation class Anno : R|kotlin/Annotation| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] constructor([ResolvedTo(RAW_FIR)] [CorrespondingProperty=/Anno.s] s: String): R|Anno| { + LAZY_super + } + + public? final? [ResolvedTo(RAW_FIR)] [IsFromPrimaryConstructor=true] val s: String = R|/s| + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] get(): String + + } + public? final? [ResolvedTo(RAW_FIR)] class MyDelegate : R|kotlin/Any| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=MyDelegate] constructor(): R|MyDelegate| { + LAZY_super + } + + public? final? operator [ResolvedTo(RAW_FIR)] fun getValue([ResolvedTo(RAW_FIR)] thisRef: Any?, [ResolvedTo(RAW_FIR)] property: KProperty<*>): { LAZY_BLOCK } + + public? final? operator [ResolvedTo(RAW_FIR)] fun setValue([ResolvedTo(RAW_FIR)] thisRef: Any?, [ResolvedTo(RAW_FIR)] property: KProperty<*>, [ResolvedTo(RAW_FIR)] value: Int): R|kotlin/Unit| { LAZY_BLOCK } + + } + +SUPER_TYPES: +FILE: [ResolvedTo(IMPORTS)] delegateWithAnnotationOnAccessorWithExplicitType.kt + field:@PROPERTY_DELEGATE_FIELD:Anno[Unresolved](LAZY_EXPRESSION) public? final? [ResolvedTo(SUPER_TYPES)] var foo: Intby LAZY_EXPRESSION + @PROPERTY_GETTER:Anno[Unresolved](LAZY_EXPRESSION) public? [ResolvedTo(SUPER_TYPES)] get(): { + ^ D|/foo|.getValue#(Null(null), ::R|/foo|) + } + @PROPERTY_SETTER:Anno[Unresolved](LAZY_EXPRESSION) public? [ResolvedTo(SUPER_TYPES)] set([ResolvedTo(SUPER_TYPES)] @SETTER_PARAMETER:Anno[Unresolved](LAZY_EXPRESSION) : ): R|kotlin/Unit| { + ^ D|/foo|.setValue#(Null(null), ::R|/foo|, R|/foo|) + } + @Repeatable[Unresolved]() public? final? [ResolvedTo(RAW_FIR)] annotation class Anno : R|kotlin/Annotation| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] constructor([ResolvedTo(RAW_FIR)] [CorrespondingProperty=/Anno.s] s: String): R|Anno| { + LAZY_super + } + + public? final? [ResolvedTo(RAW_FIR)] [IsFromPrimaryConstructor=true] val s: String = R|/s| + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] get(): String + + } + public? final? [ResolvedTo(RAW_FIR)] class MyDelegate : R|kotlin/Any| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=MyDelegate] constructor(): R|MyDelegate| { + LAZY_super + } + + public? final? operator [ResolvedTo(RAW_FIR)] fun getValue([ResolvedTo(RAW_FIR)] thisRef: Any?, [ResolvedTo(RAW_FIR)] property: KProperty<*>): { LAZY_BLOCK } + + public? final? operator [ResolvedTo(RAW_FIR)] fun setValue([ResolvedTo(RAW_FIR)] thisRef: Any?, [ResolvedTo(RAW_FIR)] property: KProperty<*>, [ResolvedTo(RAW_FIR)] value: Int): R|kotlin/Unit| { LAZY_BLOCK } + + } + +TYPES: +FILE: [ResolvedTo(IMPORTS)] delegateWithAnnotationOnAccessorWithExplicitType.kt + field:@PROPERTY_DELEGATE_FIELD:R|Anno|[Types](LAZY_EXPRESSION) public? final? [ResolvedTo(TYPES)] var foo: R|kotlin/Int|by LAZY_EXPRESSION + @PROPERTY_GETTER:R|Anno|[Types](LAZY_EXPRESSION) public? [ResolvedTo(TYPES)] get(): R|kotlin/Int| { + ^ D|/foo|.getValue#(Null(null), ::R|/foo|) + } + @PROPERTY_SETTER:R|Anno|[Types](LAZY_EXPRESSION) public? [ResolvedTo(TYPES)] set([ResolvedTo(TYPES)] @SETTER_PARAMETER:R|Anno|[Types](LAZY_EXPRESSION) : R|kotlin/Int|): R|kotlin/Unit| { + ^ D|/foo|.setValue#(Null(null), ::R|/foo|, R|/foo|) + } + @Repeatable[Unresolved]() public? final? [ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] annotation class Anno : R|kotlin/Annotation| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] constructor([ResolvedTo(RAW_FIR)] [CorrespondingProperty=/Anno.s] s: String): R|Anno| { + LAZY_super + } + + public? final? [ResolvedTo(RAW_FIR)] [IsFromPrimaryConstructor=true] val s: String = R|/s| + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] get(): String + + } + public? final? [ResolvedTo(RAW_FIR)] class MyDelegate : R|kotlin/Any| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=MyDelegate] constructor(): R|MyDelegate| { + LAZY_super + } + + public? final? operator [ResolvedTo(RAW_FIR)] fun getValue([ResolvedTo(RAW_FIR)] thisRef: Any?, [ResolvedTo(RAW_FIR)] property: KProperty<*>): { LAZY_BLOCK } + + public? final? operator [ResolvedTo(RAW_FIR)] fun setValue([ResolvedTo(RAW_FIR)] thisRef: Any?, [ResolvedTo(RAW_FIR)] property: KProperty<*>, [ResolvedTo(RAW_FIR)] value: Int): R|kotlin/Unit| { LAZY_BLOCK } + + } + +STATUS: +FILE: [ResolvedTo(IMPORTS)] delegateWithAnnotationOnAccessorWithExplicitType.kt + field:@PROPERTY_DELEGATE_FIELD:R|Anno|[Types](LAZY_EXPRESSION) public final [ResolvedTo(STATUS)] var foo: R|kotlin/Int|by LAZY_EXPRESSION + @PROPERTY_GETTER:R|Anno|[Types](LAZY_EXPRESSION) public [ResolvedTo(STATUS)] get(): R|kotlin/Int| { + ^ D|/foo|.getValue#(Null(null), ::R|/foo|) + } + @PROPERTY_SETTER:R|Anno|[Types](LAZY_EXPRESSION) public [ResolvedTo(STATUS)] set([ResolvedTo(STATUS)] @SETTER_PARAMETER:R|Anno|[Types](LAZY_EXPRESSION) : R|kotlin/Int|): R|kotlin/Unit| { + ^ D|/foo|.setValue#(Null(null), ::R|/foo|, R|/foo|) + } + @Repeatable[Unresolved]() public? final? [ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] annotation class Anno : R|kotlin/Annotation| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] constructor([ResolvedTo(RAW_FIR)] [CorrespondingProperty=/Anno.s] s: String): R|Anno| { + LAZY_super + } + + public? final? [ResolvedTo(RAW_FIR)] [IsFromPrimaryConstructor=true] val s: String = R|/s| + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] get(): String + + } + public? final? [ResolvedTo(RAW_FIR)] class MyDelegate : R|kotlin/Any| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=MyDelegate] constructor(): R|MyDelegate| { + LAZY_super + } + + public? final? operator [ResolvedTo(RAW_FIR)] fun getValue([ResolvedTo(RAW_FIR)] thisRef: Any?, [ResolvedTo(RAW_FIR)] property: KProperty<*>): { LAZY_BLOCK } + + public? final? operator [ResolvedTo(RAW_FIR)] fun setValue([ResolvedTo(RAW_FIR)] thisRef: Any?, [ResolvedTo(RAW_FIR)] property: KProperty<*>, [ResolvedTo(RAW_FIR)] value: Int): R|kotlin/Unit| { LAZY_BLOCK } + + } + +EXPECT_ACTUAL_MATCHING: +FILE: [ResolvedTo(IMPORTS)] delegateWithAnnotationOnAccessorWithExplicitType.kt + field:@PROPERTY_DELEGATE_FIELD:R|Anno|[Types](LAZY_EXPRESSION) public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] var foo: R|kotlin/Int|by LAZY_EXPRESSION + @PROPERTY_GETTER:R|Anno|[Types](LAZY_EXPRESSION) public [ResolvedTo(EXPECT_ACTUAL_MATCHING)] get(): R|kotlin/Int| { + ^ D|/foo|.getValue#(Null(null), ::R|/foo|) + } + @PROPERTY_SETTER:R|Anno|[Types](LAZY_EXPRESSION) public [ResolvedTo(EXPECT_ACTUAL_MATCHING)] set([ResolvedTo(EXPECT_ACTUAL_MATCHING)] @SETTER_PARAMETER:R|Anno|[Types](LAZY_EXPRESSION) : R|kotlin/Int|): R|kotlin/Unit| { + ^ D|/foo|.setValue#(Null(null), ::R|/foo|, R|/foo|) + } + @Repeatable[Unresolved]() public? final? [ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] annotation class Anno : R|kotlin/Annotation| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] constructor([ResolvedTo(RAW_FIR)] [CorrespondingProperty=/Anno.s] s: String): R|Anno| { + LAZY_super + } + + public? final? [ResolvedTo(RAW_FIR)] [IsFromPrimaryConstructor=true] val s: String = R|/s| + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] get(): String + + } + public? final? [ResolvedTo(RAW_FIR)] class MyDelegate : R|kotlin/Any| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=MyDelegate] constructor(): R|MyDelegate| { + LAZY_super + } + + public? final? operator [ResolvedTo(RAW_FIR)] fun getValue([ResolvedTo(RAW_FIR)] thisRef: Any?, [ResolvedTo(RAW_FIR)] property: KProperty<*>): { LAZY_BLOCK } + + public? final? operator [ResolvedTo(RAW_FIR)] fun setValue([ResolvedTo(RAW_FIR)] thisRef: Any?, [ResolvedTo(RAW_FIR)] property: KProperty<*>, [ResolvedTo(RAW_FIR)] value: Int): R|kotlin/Unit| { LAZY_BLOCK } + + } + +CONTRACTS: +FILE: [ResolvedTo(IMPORTS)] delegateWithAnnotationOnAccessorWithExplicitType.kt + field:@PROPERTY_DELEGATE_FIELD:R|Anno|[Types](LAZY_EXPRESSION) public final [ResolvedTo(CONTRACTS)] var foo: R|kotlin/Int|by LAZY_EXPRESSION + @PROPERTY_GETTER:R|Anno|[Types](LAZY_EXPRESSION) public [ResolvedTo(CONTRACTS)] get(): R|kotlin/Int| { + ^ D|/foo|.getValue#(Null(null), ::R|/foo|) + } + @PROPERTY_SETTER:R|Anno|[Types](LAZY_EXPRESSION) public [ResolvedTo(CONTRACTS)] set([ResolvedTo(CONTRACTS)] @SETTER_PARAMETER:R|Anno|[Types](LAZY_EXPRESSION) : R|kotlin/Int|): R|kotlin/Unit| { + ^ D|/foo|.setValue#(Null(null), ::R|/foo|, R|/foo|) + } + @Repeatable[Unresolved]() public? final? [ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] annotation class Anno : R|kotlin/Annotation| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] constructor([ResolvedTo(RAW_FIR)] [CorrespondingProperty=/Anno.s] s: String): R|Anno| { + LAZY_super + } + + public? final? [ResolvedTo(RAW_FIR)] [IsFromPrimaryConstructor=true] val s: String = R|/s| + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] get(): String + + } + public? final? [ResolvedTo(RAW_FIR)] class MyDelegate : R|kotlin/Any| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=MyDelegate] constructor(): R|MyDelegate| { + LAZY_super + } + + public? final? operator [ResolvedTo(RAW_FIR)] fun getValue([ResolvedTo(RAW_FIR)] thisRef: Any?, [ResolvedTo(RAW_FIR)] property: KProperty<*>): { LAZY_BLOCK } + + public? final? operator [ResolvedTo(RAW_FIR)] fun setValue([ResolvedTo(RAW_FIR)] thisRef: Any?, [ResolvedTo(RAW_FIR)] property: KProperty<*>, [ResolvedTo(RAW_FIR)] value: Int): R|kotlin/Unit| { LAZY_BLOCK } + + } + +IMPLICIT_TYPES_BODY_RESOLVE: +FILE: [ResolvedTo(IMPORTS)] delegateWithAnnotationOnAccessorWithExplicitType.kt + field:@PROPERTY_DELEGATE_FIELD:R|Anno|[Types](LAZY_EXPRESSION) public final [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] var foo: R|kotlin/Int|by LAZY_EXPRESSION + @PROPERTY_GETTER:R|Anno|[Types](LAZY_EXPRESSION) public [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] get(): R|kotlin/Int| { + ^ D|/foo|.getValue#(Null(null), ::R|/foo|) + } + @PROPERTY_SETTER:R|Anno|[Types](LAZY_EXPRESSION) public [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] set([ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] @SETTER_PARAMETER:R|Anno|[Types](LAZY_EXPRESSION) : R|kotlin/Int|): R|kotlin/Unit| { + ^ D|/foo|.setValue#(Null(null), ::R|/foo|, R|/foo|) + } + @Repeatable[Unresolved]() public? final? [ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] annotation class Anno : R|kotlin/Annotation| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] constructor([ResolvedTo(RAW_FIR)] [CorrespondingProperty=/Anno.s] s: String): R|Anno| { + LAZY_super + } + + public? final? [ResolvedTo(RAW_FIR)] [IsFromPrimaryConstructor=true] val s: String = R|/s| + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] get(): String + + } + public? final? [ResolvedTo(RAW_FIR)] class MyDelegate : R|kotlin/Any| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=MyDelegate] constructor(): R|MyDelegate| { + LAZY_super + } + + public? final? operator [ResolvedTo(RAW_FIR)] fun getValue([ResolvedTo(RAW_FIR)] thisRef: Any?, [ResolvedTo(RAW_FIR)] property: KProperty<*>): { LAZY_BLOCK } + + public? final? operator [ResolvedTo(RAW_FIR)] fun setValue([ResolvedTo(RAW_FIR)] thisRef: Any?, [ResolvedTo(RAW_FIR)] property: KProperty<*>, [ResolvedTo(RAW_FIR)] value: Int): R|kotlin/Unit| { LAZY_BLOCK } + + } + +ANNOTATION_ARGUMENTS: +FILE: [ResolvedTo(IMPORTS)] delegateWithAnnotationOnAccessorWithExplicitType.kt + field:@PROPERTY_DELEGATE_FIELD:R|Anno|[Types](s = String(delegate)) public final [ResolvedTo(ANNOTATION_ARGUMENTS)] var foo: R|kotlin/Int|by LAZY_EXPRESSION + @PROPERTY_GETTER:R|Anno|[Types](s = String(getter)) public [ResolvedTo(ANNOTATION_ARGUMENTS)] get(): R|kotlin/Int| { + ^ D|/foo|.getValue#(Null(null), ::R|/foo|) + } + @PROPERTY_SETTER:R|Anno|[Types](s = String(setter)) public [ResolvedTo(ANNOTATION_ARGUMENTS)] set([ResolvedTo(ANNOTATION_ARGUMENTS)] @SETTER_PARAMETER:R|Anno|[Types](s = String(parameter)) : R|kotlin/Int|): R|kotlin/Unit| { + ^ D|/foo|.setValue#(Null(null), ::R|/foo|, R|/foo|) + } + @R|kotlin/annotation/Repeatable|[Types]() public final [ResolvedTo(STATUS)] annotation class Anno : R|kotlin/Annotation| { + public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] constructor([ResolvedTo(STATUS)] [CorrespondingProperty=/Anno.s] s: R|kotlin/String|): R|Anno| { + LAZY_super + } + + public final [ResolvedTo(STATUS)] [IsFromPrimaryConstructor=true] val s: R|kotlin/String| = R|/s| + public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] get(): R|kotlin/String| + + } + public? final? [ResolvedTo(RAW_FIR)] class MyDelegate : R|kotlin/Any| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=MyDelegate] constructor(): R|MyDelegate| { + LAZY_super + } + + public? final? operator [ResolvedTo(RAW_FIR)] fun getValue([ResolvedTo(RAW_FIR)] thisRef: Any?, [ResolvedTo(RAW_FIR)] property: KProperty<*>): { LAZY_BLOCK } + + public? final? operator [ResolvedTo(RAW_FIR)] fun setValue([ResolvedTo(RAW_FIR)] thisRef: Any?, [ResolvedTo(RAW_FIR)] property: KProperty<*>, [ResolvedTo(RAW_FIR)] value: Int): R|kotlin/Unit| { LAZY_BLOCK } + + } + +BODY_RESOLVE: +FILE: [ResolvedTo(IMPORTS)] delegateWithAnnotationOnAccessorWithExplicitType.kt + field:@PROPERTY_DELEGATE_FIELD:R|Anno|[Types](s = String(delegate)) public final [ResolvedTo(BODY_RESOLVE)] var foo: R|kotlin/Int|by R|/MyDelegate.MyDelegate|() + @PROPERTY_GETTER:R|Anno|[Types](s = String(getter)) public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int| { + ^ D|/foo|.R|/MyDelegate.getValue|(Null(null), ::R|/foo|) + } + @PROPERTY_SETTER:R|Anno|[Types](s = String(setter)) public [ResolvedTo(BODY_RESOLVE)] set([ResolvedTo(BODY_RESOLVE)] @SETTER_PARAMETER:R|Anno|[Types](s = String(parameter)) : R|kotlin/Int|): R|kotlin/Unit| { + ^ D|/foo|.R|/MyDelegate.setValue|(Null(null), ::R|/foo|, R|/foo|) + } + @R|kotlin/annotation/Repeatable|[Types]() public final [ResolvedTo(STATUS)] annotation class Anno : R|kotlin/Annotation| { + public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] constructor([ResolvedTo(STATUS)] [CorrespondingProperty=/Anno.s] s: R|kotlin/String|): R|Anno| { + LAZY_super + } + + public final [ResolvedTo(STATUS)] [IsFromPrimaryConstructor=true] val s: R|kotlin/String| = R|/s| + public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] get(): R|kotlin/String| + + } + public final [ResolvedTo(STATUS)] class MyDelegate : R|kotlin/Any| { + public [ResolvedTo(STATUS)] [ContainingClassKey=MyDelegate] constructor(): R|MyDelegate| { + LAZY_super + } + + public final operator [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] fun getValue([ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] thisRef: R|kotlin/Any?|, [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] property: R|kotlin/reflect/KProperty<*>|): R|kotlin/Int| { + ^getValue Int(42) + } + + public final operator [ResolvedTo(CONTRACTS)] fun setValue([ResolvedTo(CONTRACTS)] thisRef: R|kotlin/Any?|, [ResolvedTo(CONTRACTS)] property: R|kotlin/reflect/KProperty<*>|, [ResolvedTo(CONTRACTS)] value: R|kotlin/Int|): R|kotlin/Unit| { + } + + } + +FILE RAW TO BODY: +FILE: [ResolvedTo(BODY_RESOLVE)] delegateWithAnnotationOnAccessorWithExplicitType.kt + field:@PROPERTY_DELEGATE_FIELD:R|Anno|[Types](s = String(delegate)) public final [ResolvedTo(BODY_RESOLVE)] var foo: R|kotlin/Int|by R|/MyDelegate.MyDelegate|() + @PROPERTY_GETTER:R|Anno|[Types](s = String(getter)) public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int| { + ^ D|/foo|.R|/MyDelegate.getValue|(Null(null), ::R|/foo|) + } + @PROPERTY_SETTER:R|Anno|[Types](s = String(setter)) public [ResolvedTo(BODY_RESOLVE)] set([ResolvedTo(BODY_RESOLVE)] @SETTER_PARAMETER:R|Anno|[Types](s = String(parameter)) : R|kotlin/Int|): R|kotlin/Unit| { + ^ D|/foo|.R|/MyDelegate.setValue|(Null(null), ::R|/foo|, R|/foo|) + } + @R|kotlin/annotation/Repeatable|[Types]() public final [ResolvedTo(BODY_RESOLVE)] annotation class Anno : R|kotlin/Annotation| { + public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=Anno] constructor([ResolvedTo(BODY_RESOLVE)] [CorrespondingProperty=/Anno.s] s: R|kotlin/String|): R|Anno| { + super() + } + + public final [ResolvedTo(BODY_RESOLVE)] [IsFromPrimaryConstructor=true] val s: R|kotlin/String| = R|/s| + public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=Anno] get(): R|kotlin/String| + + } + public final [ResolvedTo(BODY_RESOLVE)] class MyDelegate : R|kotlin/Any| { + public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=MyDelegate] constructor(): R|MyDelegate| { + super() + } + + public final operator [ResolvedTo(BODY_RESOLVE)] fun getValue([ResolvedTo(BODY_RESOLVE)] thisRef: R|kotlin/Any?|, [ResolvedTo(BODY_RESOLVE)] property: R|kotlin/reflect/KProperty<*>|): R|kotlin/Int| { + ^getValue Int(42) + } + + public final operator [ResolvedTo(BODY_RESOLVE)] fun setValue([ResolvedTo(BODY_RESOLVE)] thisRef: R|kotlin/Any?|, [ResolvedTo(BODY_RESOLVE)] property: R|kotlin/reflect/KProperty<*>|, [ResolvedTo(BODY_RESOLVE)] value: R|kotlin/Int|): R|kotlin/Unit| { + } + + } diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/FirOutOfContentRootLazyDeclarationResolveTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/FirOutOfContentRootLazyDeclarationResolveTestGenerated.java index 0901fb27938..69cef1bb1c2 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/FirOutOfContentRootLazyDeclarationResolveTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/FirOutOfContentRootLazyDeclarationResolveTestGenerated.java @@ -895,6 +895,18 @@ public class FirOutOfContentRootLazyDeclarationResolveTestGenerated extends Abst KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testData/lazyResolve/properties"), Pattern.compile("^(.+)\\.(kt)$"), null, true); } + @Test + @TestMetadata("delegateWithAnnotationOnAccessor.kt") + public void testDelegateWithAnnotationOnAccessor() throws Exception { + runTest("analysis/low-level-api-fir/testData/lazyResolve/properties/delegateWithAnnotationOnAccessor.kt"); + } + + @Test + @TestMetadata("delegateWithAnnotationOnAccessorWithExplicitType.kt") + public void testDelegateWithAnnotationOnAccessorWithExplicitType() throws Exception { + runTest("analysis/low-level-api-fir/testData/lazyResolve/properties/delegateWithAnnotationOnAccessorWithExplicitType.kt"); + } + @Test @TestMetadata("getterWithDelegation.kt") public void testGetterWithDelegation() throws Exception { diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/FirSourceLazyDeclarationResolveTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/FirSourceLazyDeclarationResolveTestGenerated.java index 61345cc0ec0..51c558cc4a8 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/FirSourceLazyDeclarationResolveTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/FirSourceLazyDeclarationResolveTestGenerated.java @@ -895,6 +895,18 @@ public class FirSourceLazyDeclarationResolveTestGenerated extends AbstractFirSou KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testData/lazyResolve/properties"), Pattern.compile("^(.+)\\.(kt)$"), null, true); } + @Test + @TestMetadata("delegateWithAnnotationOnAccessor.kt") + public void testDelegateWithAnnotationOnAccessor() throws Exception { + runTest("analysis/low-level-api-fir/testData/lazyResolve/properties/delegateWithAnnotationOnAccessor.kt"); + } + + @Test + @TestMetadata("delegateWithAnnotationOnAccessorWithExplicitType.kt") + public void testDelegateWithAnnotationOnAccessorWithExplicitType() throws Exception { + runTest("analysis/low-level-api-fir/testData/lazyResolve/properties/delegateWithAnnotationOnAccessorWithExplicitType.kt"); + } + @Test @TestMetadata("getterWithDelegation.kt") public void testGetterWithDelegation() throws Exception { diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java index e1f4354fa16..cd430a9b8f6 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java @@ -9556,6 +9556,18 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia runTest("compiler/testData/diagnostics/tests/delegatedProperty/defaultSetter.kt"); } + @Test + @TestMetadata("delegateWithAnnotationOnAccessorWithExplicitType.kt") + public void testDelegateWithAnnotationOnAccessorWithExplicitType() throws Exception { + runTest("compiler/testData/diagnostics/tests/delegatedProperty/delegateWithAnnotationOnAccessorWithExplicitType.kt"); + } + + @Test + @TestMetadata("delegateWithAnnotationOnAccessorWithImplicitType.kt") + public void testDelegateWithAnnotationOnAccessorWithImplicitType() throws Exception { + runTest("compiler/testData/diagnostics/tests/delegatedProperty/delegateWithAnnotationOnAccessorWithImplicitType.kt"); + } + @Test @TestMetadata("delegatedPropertyOverridedInTrait.kt") public void testDelegatedPropertyOverridedInTrait() throws Exception { diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java index 5fc65be9445..0834474277d 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java @@ -9556,6 +9556,18 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated runTest("compiler/testData/diagnostics/tests/delegatedProperty/defaultSetter.kt"); } + @Test + @TestMetadata("delegateWithAnnotationOnAccessorWithExplicitType.kt") + public void testDelegateWithAnnotationOnAccessorWithExplicitType() throws Exception { + runTest("compiler/testData/diagnostics/tests/delegatedProperty/delegateWithAnnotationOnAccessorWithExplicitType.kt"); + } + + @Test + @TestMetadata("delegateWithAnnotationOnAccessorWithImplicitType.kt") + public void testDelegateWithAnnotationOnAccessorWithImplicitType() throws Exception { + runTest("compiler/testData/diagnostics/tests/delegatedProperty/delegateWithAnnotationOnAccessorWithImplicitType.kt"); + } + @Test @TestMetadata("delegatedPropertyOverridedInTrait.kt") public void testDelegatedPropertyOverridedInTrait() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java index b3df9dc3cdf..87ab95559de 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java @@ -9550,6 +9550,18 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir runTest("compiler/testData/diagnostics/tests/delegatedProperty/defaultSetter.kt"); } + @Test + @TestMetadata("delegateWithAnnotationOnAccessorWithExplicitType.kt") + public void testDelegateWithAnnotationOnAccessorWithExplicitType() throws Exception { + runTest("compiler/testData/diagnostics/tests/delegatedProperty/delegateWithAnnotationOnAccessorWithExplicitType.kt"); + } + + @Test + @TestMetadata("delegateWithAnnotationOnAccessorWithImplicitType.kt") + public void testDelegateWithAnnotationOnAccessorWithImplicitType() throws Exception { + runTest("compiler/testData/diagnostics/tests/delegatedProperty/delegateWithAnnotationOnAccessorWithImplicitType.kt"); + } + @Test @TestMetadata("delegatedPropertyOverridedInTrait.kt") public void testDelegatedPropertyOverridedInTrait() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java index c5a36202dbb..af753bfed86 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java @@ -9556,6 +9556,18 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia runTest("compiler/testData/diagnostics/tests/delegatedProperty/defaultSetter.kt"); } + @Test + @TestMetadata("delegateWithAnnotationOnAccessorWithExplicitType.kt") + public void testDelegateWithAnnotationOnAccessorWithExplicitType() throws Exception { + runTest("compiler/testData/diagnostics/tests/delegatedProperty/delegateWithAnnotationOnAccessorWithExplicitType.kt"); + } + + @Test + @TestMetadata("delegateWithAnnotationOnAccessorWithImplicitType.kt") + public void testDelegateWithAnnotationOnAccessorWithImplicitType() throws Exception { + runTest("compiler/testData/diagnostics/tests/delegatedProperty/delegateWithAnnotationOnAccessorWithImplicitType.kt"); + } + @Test @TestMetadata("delegatedPropertyOverridedInTrait.kt") public void testDelegatedPropertyOverridedInTrait() throws Exception { diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/delegateWithAnnotationOnAccessorWithExplicitType.kt b/compiler/testData/diagnostics/tests/delegatedProperty/delegateWithAnnotationOnAccessorWithExplicitType.kt new file mode 100644 index 00000000000..d3109472329 --- /dev/null +++ b/compiler/testData/diagnostics/tests/delegatedProperty/delegateWithAnnotationOnAccessorWithExplicitType.kt @@ -0,0 +1,17 @@ +// FIR_IDENTICAL +// !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + +@get:Anno(foo) +@set:Anno(foo) +@setparam:Anno(foo) +@delegate:Anno(foo) +var foo: Int by MyDelegate() + +@Repeatable +annotation class Anno(val s: Int) + +class MyDelegate { + operator fun getValue(thisRef: Any?, property: KProperty<*>) = 42 + operator fun setValue(thisRef: Any?, property: KProperty<*>, value: Int) {} +} diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/delegateWithAnnotationOnAccessorWithImplicitType.fir.kt b/compiler/testData/diagnostics/tests/delegatedProperty/delegateWithAnnotationOnAccessorWithImplicitType.fir.kt new file mode 100644 index 00000000000..4670c392541 --- /dev/null +++ b/compiler/testData/diagnostics/tests/delegatedProperty/delegateWithAnnotationOnAccessorWithImplicitType.fir.kt @@ -0,0 +1,17 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER +// IGNORE_REVERSED_RESOLVE +import kotlin.reflect.KProperty + +@get:Anno(foo) +@set:Anno(foo) +@setparam:Anno(foo) +@delegate:Anno(foo) +var foo by MyDelegate() + +@Repeatable +annotation class Anno(val i: Int) + +class MyDelegate { + operator fun getValue(thisRef: Any?, property: KProperty<*>) = 42 + operator fun setValue(thisRef: Any?, property: KProperty<*>, value: Int) {} +} diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/delegateWithAnnotationOnAccessorWithImplicitType.kt b/compiler/testData/diagnostics/tests/delegatedProperty/delegateWithAnnotationOnAccessorWithImplicitType.kt new file mode 100644 index 00000000000..3478add4ad4 --- /dev/null +++ b/compiler/testData/diagnostics/tests/delegatedProperty/delegateWithAnnotationOnAccessorWithImplicitType.kt @@ -0,0 +1,17 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER +// IGNORE_REVERSED_RESOLVE +import kotlin.reflect.KProperty + +@get:Anno(foo) +@set:Anno(foo) +@setparam:Anno(foo) +@delegate:Anno(foo) +var foo by MyDelegate() + +@Repeatable +annotation class Anno(val i: Int) + +class MyDelegate { + operator fun getValue(thisRef: Any?, property: KProperty<*>) = 42 + operator fun setValue(thisRef: Any?, property: KProperty<*>, value: Int) {} +} diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java index fe49dea399f..1b3033d4153 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java @@ -9556,6 +9556,18 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/delegatedProperty/defaultSetter.kt"); } + @Test + @TestMetadata("delegateWithAnnotationOnAccessorWithExplicitType.kt") + public void testDelegateWithAnnotationOnAccessorWithExplicitType() throws Exception { + runTest("compiler/testData/diagnostics/tests/delegatedProperty/delegateWithAnnotationOnAccessorWithExplicitType.kt"); + } + + @Test + @TestMetadata("delegateWithAnnotationOnAccessorWithImplicitType.kt") + public void testDelegateWithAnnotationOnAccessorWithImplicitType() throws Exception { + runTest("compiler/testData/diagnostics/tests/delegatedProperty/delegateWithAnnotationOnAccessorWithImplicitType.kt"); + } + @Test @TestMetadata("delegatedPropertyOverridedInTrait.kt") public void testDelegatedPropertyOverridedInTrait() throws Exception {