[FIR] Forbid annotations on anonymous initializers and destructuring declarations

#KT-59896


Merge-request: KT-MR-13197
Merged-by: Evgeniy Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>
This commit is contained in:
Evgeniy.Zhelenskiy
2023-11-28 11:59:26 +00:00
committed by Space Team
parent e901629cf0
commit 5258e2044d
9 changed files with 10 additions and 40 deletions
@@ -1,9 +0,0 @@
annotation class Ann
data class Pair(val x: Int, val y: Int)
fun foo(): Int {
@Ann val (a, b) = Pair(12, 34)
@<!UNRESOLVED_REFERENCE!>Err<!> val (c, d) = Pair(56, 78)
return a + b + c + d
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
annotation class Ann
data class Pair(val x: Int, val y: Int)
@@ -1,14 +0,0 @@
annotation class Ann(val x: Int)
data class A(val x: Int, val y: Int)
fun bar(): Array<A> = null!!
fun foo() {
for (@Ann(1) i in 1..100) {}
for (@Ann(2) i in 1..100) {}
for (@Ann(3) (x, @Ann(4) y) in bar()) {}
for (@<!UNRESOLVED_REFERENCE!>Err<!>() (x,y) in bar()) {}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
annotation class Ann(val x: Int)
data class A(val x: Int, val y: Int)
@@ -1,7 +0,0 @@
fun test(): Any? {
@ann val (a, b) = P(1, 1)
return a + b
}
annotation class ann
data class P(val a: Int, val b: Int)
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
fun test(): Any? {
<!WRONG_ANNOTATION_TARGET!>@ann<!> val (a, b) = P(1, 1)
return a + b