[FIR] KT-56769: Ensure @receiver: is only allowed on receivers

Note that there's no code that checks that
FirReceiverParameter's annotation's use-site target
is indeed `@receiver:`, because otherwise the
annotation wouldn't have made it into
the FirReceiverParameter.

In contrast, in K1 all such annotations are treated
as annotations on a KtTypeReference.

^KT-56769 Fixed
This commit is contained in:
Nikolay Lunyak
2023-03-06 10:14:34 +02:00
committed by Space Team
parent 174f39aa46
commit 93ba0c3e70
13 changed files with 79 additions and 16 deletions
+19
View File
@@ -0,0 +1,19 @@
fun main(args: Array<<!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@receiver:Anno<!> String>) {}
annotation class Anno
fun Int.train(args: Array<<!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@receiver:Anno<!> String>) {}
fun Int.plane(<!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@receiver:Anno<!> args: Array<String>) {}
fun vein(args: Array<<!WRONG_ANNOTATION_TARGET!>@file:Anno<!> String>) {}
fun rain(args: Array<<!WRONG_ANNOTATION_TARGET!>@Anno<!> String>) {}
fun <!WRONG_ANNOTATION_TARGET!>@Anno<!> Int.strain() {}
fun @receiver:Anno Int.drain() {}
fun <!WRONG_ANNOTATION_TARGET!>@file:Anno<!> Int.brain() {}
fun (<!WRONG_ANNOTATION_TARGET!>@Anno<!> Int).crane() {}