[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:
committed by
Space Team
parent
174f39aa46
commit
93ba0c3e70
-10
@@ -1,10 +0,0 @@
|
||||
// !LANGUAGE: +RestrictionOfWrongAnnotationsWithUseSiteTargetsOnTypes
|
||||
|
||||
@Target(AnnotationTarget.VALUE_PARAMETER)
|
||||
annotation class Fancy
|
||||
|
||||
fun @receiver:Fancy String.myExtension() { }
|
||||
val @receiver:Fancy Int.asVal get() = 0
|
||||
|
||||
fun ((@receiver:Fancy Int) -> Unit).complexReceiver1() {}
|
||||
fun ((Int) -> @receiver:Fancy Unit).complexReceiver2() {}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +RestrictionOfWrongAnnotationsWithUseSiteTargetsOnTypes
|
||||
|
||||
@Target(AnnotationTarget.VALUE_PARAMETER)
|
||||
|
||||
+2
-2
@@ -6,5 +6,5 @@ annotation class Fancy
|
||||
fun @receiver:Fancy String.myExtension() { }
|
||||
val @receiver:Fancy Int.asVal get() = 0
|
||||
|
||||
fun ((@receiver:Fancy Int) -> Unit).complexReceiver1() {}
|
||||
fun ((Int) -> @receiver:Fancy Unit).complexReceiver2() {}
|
||||
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() {}
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
|
||||
fun test1(i: @setparam:Suppress Int) {}
|
||||
fun test2(i: @param:Suppress Int) {}
|
||||
fun test3(i: @receiver:Suppress Int) {}
|
||||
fun test3(i: <!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@receiver:Suppress<!> Int) {}
|
||||
|
||||
fun test4(): @setparam:Suppress Int = TODO()
|
||||
fun test5(i: (@setparam:Suppress Int) -> Unit) {}
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
|
||||
fun test1(i: @setparam:Suppress Int) {}
|
||||
fun test2(i: @param:Suppress Int) {}
|
||||
fun test3(i: @receiver:Suppress Int) {}
|
||||
fun test3(i: <!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@receiver:Suppress<!> Int) {}
|
||||
|
||||
fun test4(): @setparam:Suppress Int = TODO()
|
||||
fun test5(i: (@setparam:Suppress Int) -> Unit) {}
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
|
||||
fun test1(i: @setparam:Suppress Int) {}
|
||||
fun test2(i: @param:Suppress Int) {}
|
||||
fun test3(i: @receiver:Suppress Int) {}
|
||||
fun test3(i: <!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@receiver:Suppress<!> Int) {}
|
||||
|
||||
fun test4(): @setparam:Suppress Int = TODO()
|
||||
fun test5(i: (@setparam:Suppress Int) -> Unit) {}
|
||||
|
||||
Reference in New Issue
Block a user