Files
kotlin-fork/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/receiverUseSiteTargetOnExtensionFunction_after.kt
T
Nikolay Lunyak 93ba0c3e70 [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
2023-03-07 11:35:46 +00:00

11 lines
457 B
Kotlin
Vendored

// FIR_IDENTICAL
// !LANGUAGE: +RestrictionOfWrongAnnotationsWithUseSiteTargetsOnTypes
@Target(AnnotationTarget.VALUE_PARAMETER)
annotation class Fancy
fun @receiver:Fancy String.myExtension() { }
val @receiver:Fancy Int.asVal get() = 0
fun ((<!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@receiver:Fancy<!> Int) -> Unit).complexReceiver1() {}
fun ((Int) -> <!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@receiver:Fancy<!> Unit).complexReceiver2() {}