FIR: report WRONG_ANNOTATION_TARGET on types
This commit is contained in:
-20
@@ -1,20 +0,0 @@
|
||||
@Target(AnnotationTarget.ANNOTATION_CLASS) annotation class base
|
||||
|
||||
@base annotation class derived
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> class correct(<!WRONG_ANNOTATION_TARGET!>@base<!> val x: Int) {
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> constructor(): this(0)
|
||||
}
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> enum class My {
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> FIRST,
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> SECOND
|
||||
}
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> fun foo(<!WRONG_ANNOTATION_TARGET!>@base<!> y: @base Int): Int {
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> fun bar(<!WRONG_ANNOTATION_TARGET!>@base<!> z: @base Int) = z + 1
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> val local = bar(y)
|
||||
return local
|
||||
}
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> val z = 0
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
@Target(AnnotationTarget.ANNOTATION_CLASS) annotation class base
|
||||
|
||||
@base annotation class derived
|
||||
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
@Target(AnnotationTarget.CLASS) annotation class base
|
||||
|
||||
@base annotation class derived
|
||||
|
||||
@base class correct(<!WRONG_ANNOTATION_TARGET!>@base<!> val x: Int, <!WRONG_ANNOTATION_TARGET!>@base<!> w: @base Int) {
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> constructor(): this(0, 0)
|
||||
}
|
||||
|
||||
@base enum class My <!WRONG_ANNOTATION_TARGET!>@base<!> constructor() {
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> FIRST,
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> SECOND
|
||||
}
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> fun foo(<!WRONG_ANNOTATION_TARGET!>@base<!> y: @base Int): Int {
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> fun bar(<!WRONG_ANNOTATION_TARGET!>@base<!> z: @base Int) = z + 1
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> val local = bar(y)
|
||||
return local
|
||||
}
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> val z = 0
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
@Target(AnnotationTarget.CLASS) annotation class base
|
||||
|
||||
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
@Target(AnnotationTarget.CONSTRUCTOR) annotation class base
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> annotation class derived
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> class correct(<!WRONG_ANNOTATION_TARGET!>@base<!> val x: Int) {
|
||||
@base constructor(): this(0)
|
||||
}
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> enum class My @base constructor() {
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> FIRST,
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> SECOND
|
||||
}
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> fun foo(<!WRONG_ANNOTATION_TARGET!>@base<!> y: @base Int): Int {
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> fun bar(<!WRONG_ANNOTATION_TARGET!>@base<!> z: @base Int) = z + 1
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> val local = bar(y)
|
||||
return local
|
||||
}
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> val z = 0
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
@Target(AnnotationTarget.CONSTRUCTOR) annotation class base
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> annotation class derived
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
@Target() annotation class empty
|
||||
|
||||
@empty annotation class derived
|
||||
|
||||
@empty class correct(@empty val x: Int, @empty w: @empty Int) {
|
||||
@empty constructor(): this(0, 0)
|
||||
}
|
||||
|
||||
@empty enum class My @empty constructor() {
|
||||
@empty FIRST,
|
||||
@empty SECOND
|
||||
}
|
||||
|
||||
@empty fun foo(@empty y: @empty Int): Int {
|
||||
@empty fun bar(@empty z: @empty Int) = z + 1
|
||||
@empty val local = bar(y)
|
||||
return local
|
||||
}
|
||||
|
||||
@empty val z = <!WRONG_ANNOTATION_TARGET!>@empty<!> 0
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
@Target() annotation class empty
|
||||
|
||||
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
@Target(AnnotationTarget.FUNCTION) annotation class base
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> annotation class derived
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> class correct(<!WRONG_ANNOTATION_TARGET!>@base<!> val x: Int) {
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> constructor(): this(0)
|
||||
|
||||
@base public fun baz() {}
|
||||
}
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> enum class My <!WRONG_ANNOTATION_TARGET!>@base<!> constructor() {
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> FIRST,
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> SECOND
|
||||
}
|
||||
|
||||
@base fun foo(<!WRONG_ANNOTATION_TARGET!>@base<!> y: @base Int): Int {
|
||||
@base fun bar(<!WRONG_ANNOTATION_TARGET!>@base<!> z: @base Int) = z + 1
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> val local = bar(y)
|
||||
return local
|
||||
}
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> val z = 0
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
@Target(AnnotationTarget.FUNCTION) annotation class base
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> annotation class derived
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ annotation class special
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class base
|
||||
|
||||
fun transform(i: Int, tr: (@special Int) -> Int): Int = @special tr(@special i)
|
||||
fun transform(i: Int, tr: (<!WRONG_ANNOTATION_TARGET!>@special<!> Int) -> Int): Int = @special tr(@special i)
|
||||
|
||||
fun foo(i: Int): Int {
|
||||
val j = @special i + 1
|
||||
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
@Target(AnnotationTarget.<!UNRESOLVED_REFERENCE!>INIT<!>) annotation class incorrect
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@incorrect<!> annotation class derived
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@incorrect<!> class correct(<!WRONG_ANNOTATION_TARGET!>@incorrect<!> val x: Int, <!WRONG_ANNOTATION_TARGET!>@incorrect<!> w: @incorrect Int) {
|
||||
<!WRONG_ANNOTATION_TARGET!>@incorrect<!> constructor(): this(0, 0)
|
||||
}
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@incorrect<!> enum class My <!WRONG_ANNOTATION_TARGET!>@incorrect<!> constructor() {
|
||||
<!WRONG_ANNOTATION_TARGET!>@incorrect<!> FIRST,
|
||||
<!WRONG_ANNOTATION_TARGET!>@incorrect<!> SECOND
|
||||
}
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@incorrect<!> fun foo(<!WRONG_ANNOTATION_TARGET!>@incorrect<!> y: @incorrect Int): Int {
|
||||
<!WRONG_ANNOTATION_TARGET!>@incorrect<!> fun bar(<!WRONG_ANNOTATION_TARGET!>@incorrect<!> z: @incorrect Int) = z + 1
|
||||
<!WRONG_ANNOTATION_TARGET!>@incorrect<!> val local = bar(y)
|
||||
return local
|
||||
}
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@incorrect<!> val z = <!WRONG_ANNOTATION_TARGET!>@incorrect<!> 0
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
@Target(AnnotationTarget.<!UNRESOLVED_REFERENCE!>INIT<!>) annotation class incorrect
|
||||
|
||||
|
||||
+3
-3
@@ -64,15 +64,15 @@ import test.AnnotationTargets.*
|
||||
|
||||
@base <!WRONG_ANNOTATION_TARGET!>@meta<!> @type <!WRONG_ANNOTATION_TARGET!>@method<!> <!WRONG_ANNOTATION_TARGET!>@multiple<!> class KClass(
|
||||
@base @fieldann @parameter val y:
|
||||
@base @type Int) {
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> <!WRONG_ANNOTATION_TARGET!>@type<!> Int) {
|
||||
|
||||
@base @multiple @fieldann <!WRONG_ANNOTATION_TARGET!>@local<!> val x = 0
|
||||
@method @konstructor @type get
|
||||
|
||||
@base @method @multiple <!WRONG_ANNOTATION_TARGET!>@konstructor<!>
|
||||
fun foo(@parameter <!WRONG_ANNOTATION_TARGET!>@type<!> i:
|
||||
@base @multiple Int
|
||||
): @fieldann @parameter Int {
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> <!WRONG_ANNOTATION_TARGET!>@multiple<!> Int
|
||||
): <!WRONG_ANNOTATION_TARGET!>@fieldann<!> <!WRONG_ANNOTATION_TARGET!>@parameter<!> Int {
|
||||
|
||||
@local @base <!WRONG_ANNOTATION_TARGET!>@multiple<!> <!WRONG_ANNOTATION_TARGET!>@fieldann<!> val j = i + 1
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> <!WRONG_ANNOTATION_TARGET!>@multiple<!> return j
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
@Target(AnnotationTarget.LOCAL_VARIABLE) annotation class base
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> annotation class derived
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> class correct(<!WRONG_ANNOTATION_TARGET!>@base<!> val x: Int) {
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> constructor(): this(0)
|
||||
}
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> enum class My {
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> FIRST,
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> SECOND
|
||||
}
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> fun foo(<!WRONG_ANNOTATION_TARGET!>@base<!> y: @base Int): Int {
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> fun bar(<!WRONG_ANNOTATION_TARGET!>@base<!> z: @base Int) = z + 1
|
||||
@base val local = bar(y)
|
||||
return local
|
||||
}
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> val z = 0
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
@Target(AnnotationTarget.LOCAL_VARIABLE) annotation class base
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> annotation class derived
|
||||
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
@Target(AnnotationTarget.PROPERTY) annotation class base
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> annotation class derived
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> class correct(@base val x: Int, <!WRONG_ANNOTATION_TARGET!>@base<!> w: Int) {
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> constructor(): this(0, 0)
|
||||
}
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> enum class My {
|
||||
@base FIRST,
|
||||
@base SECOND
|
||||
}
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> fun foo(<!WRONG_ANNOTATION_TARGET!>@base<!> y: @base Int): Int {
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> fun bar(<!WRONG_ANNOTATION_TARGET!>@base<!> z: @base Int) = z + 1
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> val local = bar(y)
|
||||
return local
|
||||
}
|
||||
|
||||
@base val z = 0
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
@Target(AnnotationTarget.PROPERTY) annotation class base
|
||||
|
||||
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
annotation class base
|
||||
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class typed
|
||||
|
||||
@base class My(val x: @base @typed Int, y: @base @typed Int) {
|
||||
val z: @base @typed Int = y
|
||||
fun foo(): @base @typed Int = z
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
annotation class base
|
||||
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
|
||||
+2
-2
@@ -26,10 +26,10 @@ class Class2 {
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@A<!> fun foo() {}
|
||||
<!WRONG_ANNOTATION_TARGET!>@A<!> class D
|
||||
fun foo(i: @A Int) {
|
||||
fun foo(i: <!WRONG_ANNOTATION_TARGET!>@A<!> Int) {
|
||||
<!WRONG_ANNOTATION_TARGET!>@A<!> val i = 1
|
||||
}
|
||||
fun <T> test(t: @A T): T = t
|
||||
fun <T> test(t: <!WRONG_ANNOTATION_TARGET!>@A<!> T): T = t
|
||||
|
||||
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
annotation class base
|
||||
|
||||
val x: List<@base String>? = null
|
||||
|
||||
val y: List<@[base] String>? = null
|
||||
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class typeAnn
|
||||
|
||||
fun foo(list: List<@typeAnn Int>) = list
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
annotation class base
|
||||
|
||||
val x: List<<!WRONG_ANNOTATION_TARGET!>@base<!> String>? = null
|
||||
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
@Target(AnnotationTarget.VALUE_PARAMETER) annotation class base
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> annotation class derived
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> class correct(@base val x: Int, @base w: Int) {
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> constructor(): this(0, 0)
|
||||
}
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> enum class My {
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> FIRST,
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> SECOND
|
||||
}
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> fun foo(@base y: @base Int): Int {
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> fun bar(@base z: @base Int) = z + 1
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> val local = bar(y)
|
||||
return local
|
||||
}
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@base<!> val z = 0
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
@Target(AnnotationTarget.VALUE_PARAMETER) annotation class base
|
||||
|
||||
|
||||
Reference in New Issue
Block a user