Files
kotlin/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/receiverUseSiteTargetOnExtensionFunction.kt
Mikhail Zarechenskiy 957f9c2a21 Prohibit incorrect annotations with use-site targets more precisely
#KT-21696 Fixed

The problem is coming from the fact that `AnnotationTarget.VALUE_PARAMETER` is mapped to receiver parameter and to value parameter, but annotation with use-site target `receiver` can be used only on type reference of receiver parameter
2018-03-25 18:25:19 +03:00

8 lines
385 B
Kotlin
Vendored

@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_ON_TYPE!>@receiver:Fancy<!> Int) -> Unit).complexReceiver1() {}
fun ((Int) -> <!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET_ON_TYPE!>@receiver:Fancy<!> Unit).complexReceiver2() {}