[FIR] Add REPEATABLE_CONTAINER_* diagnostics

REPEATABLE_CONTAINER_MUST_HAVE_VALUE_ARRAY
REPEATABLE_CONTAINER_HAS_NON_DEFAULT_PARAMETER
REPEATABLE_CONTAINER_HAS_SHORTER_RETENTION
REPEATABLE_CONTAINER_TARGET_SET_NOT_A_SUBSET
REPEATABLE_ANNOTATION_HAS_NESTED_CLASS_NAMED_CONTAINER
This commit is contained in:
Ivan Kochurkin
2021-09-02 16:03:46 +03:00
committed by TeamCityServer
parent 6fa1c0353c
commit fa12e72551
24 changed files with 501 additions and 319 deletions
@@ -1,50 +0,0 @@
// !LANGUAGE: -RepeatableAnnotations -RepeatableAnnotationContainerConstraints
// FULL_JDK
import java.lang.annotation.Repeatable as R
@R(C1::class)
annotation class A1
annotation class C1
@R(C2::class)
annotation class A2
annotation class C2(val value: A2)
@R(C3::class)
annotation class A3
annotation class C3(val value: Array<String>)
@R(C4::class)
annotation class A4
annotation class C4(val notValue: Array<A4>)
@R(C5::class)
annotation class A5
annotation class C5(val value: Array<A5>, val irrelevant: String)
@R(C6::class)
annotation class A6
annotation class C6(val irrelevant: Double, val value: Array<A6> = [])
// Should be an error after fixing KT-47932.
@R(A7::class)
annotation class A7(val value: Array<A7>)
@R(D1::class)
annotation class B1
annotation class D1(val value: Array<B1>)
@R(D2::class)
annotation class B2
annotation class D2(val value: Array<B2> = [])
@R(D3::class)
annotation class B3
annotation class D3(val value: Array<B3>, val other1: String = "", val other2: Int = 42)
@R(D4::class)
annotation class B4
annotation class D4(val value1: Array<B4> = [], val value: Array<B4>)
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: -RepeatableAnnotations -RepeatableAnnotationContainerConstraints
// FULL_JDK
@@ -1,50 +0,0 @@
// !LANGUAGE: +RepeatableAnnotations +RepeatableAnnotationContainerConstraints
// FULL_JDK
import java.lang.annotation.Repeatable as R
@R(C1::class)
annotation class A1
annotation class C1
@R(C2::class)
annotation class A2
annotation class C2(val value: A2)
@R(C3::class)
annotation class A3
annotation class C3(val value: Array<String>)
@R(C4::class)
annotation class A4
annotation class C4(val notValue: Array<A4>)
@R(C5::class)
annotation class A5
annotation class C5(val value: Array<A5>, val irrelevant: String)
@R(C6::class)
annotation class A6
annotation class C6(val irrelevant: Double, val value: Array<A6> = [])
// Should be an error after fixing KT-47932.
@R(A7::class)
annotation class A7(val value: Array<A7>)
@R(D1::class)
annotation class B1
annotation class D1(val value: Array<B1>)
@R(D2::class)
annotation class B2
annotation class D2(val value: Array<B2> = [])
@R(D3::class)
annotation class B3
annotation class D3(val value: Array<B3>, val other1: String = "", val other2: Int = 42)
@R(D4::class)
annotation class B4
annotation class D4(val value1: Array<B4> = [], val value: Array<B4>)
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +RepeatableAnnotations +RepeatableAnnotationContainerConstraints
// FULL_JDK
@@ -1,40 +0,0 @@
// !LANGUAGE: -RepeatableAnnotations -RepeatableAnnotationContainerConstraints
// FULL_JDK
import java.lang.annotation.Repeatable as R
import kotlin.annotation.AnnotationRetention.*
@R(C1::class)
@Retention(RUNTIME)
annotation class A1
@Retention(BINARY)
annotation class C1(val value: Array<A1>)
@R(C2::class)
@Retention(BINARY)
annotation class A2
@Retention(SOURCE)
annotation class C2(val value: Array<A2>)
@R(C3::class)
annotation class A3
@Retention(SOURCE)
annotation class C3(val value: Array<A3>)
@R(D1::class)
annotation class B1
@Retention(RUNTIME)
annotation class D1(val value: Array<B1>)
@R(D2::class)
@Retention(SOURCE)
annotation class B2
@Retention(BINARY)
annotation class D2(val value: Array<B2>)
@R(D3::class)
@Retention(BINARY)
annotation class B3
annotation class D3(val value: Array<B3>)
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: -RepeatableAnnotations -RepeatableAnnotationContainerConstraints
// FULL_JDK
@@ -1,40 +0,0 @@
// !LANGUAGE: +RepeatableAnnotations +RepeatableAnnotationContainerConstraints
// FULL_JDK
import java.lang.annotation.Repeatable as R
import kotlin.annotation.AnnotationRetention.*
@R(C1::class)
@Retention(RUNTIME)
annotation class A1
@Retention(BINARY)
annotation class C1(val value: Array<A1>)
@R(C2::class)
@Retention(BINARY)
annotation class A2
@Retention(SOURCE)
annotation class C2(val value: Array<A2>)
@R(C3::class)
annotation class A3
@Retention(SOURCE)
annotation class C3(val value: Array<A3>)
@R(D1::class)
annotation class B1
@Retention(RUNTIME)
annotation class D1(val value: Array<B1>)
@R(D2::class)
@Retention(SOURCE)
annotation class B2
@Retention(BINARY)
annotation class D2(val value: Array<B2>)
@R(D3::class)
@Retention(BINARY)
annotation class B3
annotation class D3(val value: Array<B3>)
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +RepeatableAnnotations +RepeatableAnnotationContainerConstraints
// FULL_JDK
@@ -1,53 +0,0 @@
// !LANGUAGE: +RepeatableAnnotations +RepeatableAnnotationContainerConstraints
// FULL_JDK
import java.lang.annotation.Repeatable as R
import kotlin.annotation.AnnotationTarget.*
@R(C1::class)
annotation class A1
@Target(FILE)
annotation class C1(val value: Array<A1>)
@R(C2::class)
@Target(CLASS)
annotation class A2
@Target(CLASS, FUNCTION)
annotation class C2(val value: Array<A2>)
@R(C3::class)
@Target(TYPE)
annotation class A3
annotation class C3(val value: Array<A3>)
@R(C4::class)
@Target(ANNOTATION_CLASS)
annotation class A4
@Target(CLASS)
annotation class C4(val value: Array<A4>)
@R(D1::class)
annotation class B1
@Target(CLASS, ANNOTATION_CLASS, PROPERTY, FIELD, LOCAL_VARIABLE, VALUE_PARAMETER, CONSTRUCTOR, FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER) // Default target set
annotation class D1(val value: Array<B1>)
@R(D2::class)
@Target(CLASS, FILE)
annotation class B2
@Target(CLASS)
annotation class D2(val value: Array<B2>)
@R(D3::class)
@Target(CLASS)
annotation class B3
@Target(ANNOTATION_CLASS)
annotation class D3(val value: Array<B3>)
@R(D4::class)
@Target(TYPE)
annotation class B4
@Target(ANNOTATION_CLASS, CLASS, TYPE_PARAMETER)
annotation class D4(val value: Array<B4>)
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +RepeatableAnnotations +RepeatableAnnotationContainerConstraints
// FULL_JDK
@@ -1,21 +0,0 @@
// !LANGUAGE: -RepeatableAnnotations -RepeatableAnnotationContainerConstraints
// FULL_JDK
@Repeatable
annotation class A1 {
class Container
}
@java.lang.annotation.Repeatable(D1::class)
annotation class B1 {
class Container
}
annotation class D1(val value: Array<B1>)
@Repeatable
@java.lang.annotation.Repeatable(D2::class)
annotation class B2 {
class Container
}
annotation class D2(val value: Array<B2>)
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: -RepeatableAnnotations -RepeatableAnnotationContainerConstraints
// FULL_JDK
@@ -1,21 +0,0 @@
// !LANGUAGE: +RepeatableAnnotations +RepeatableAnnotationContainerConstraints
// FULL_JDK
@Repeatable
annotation class A1 {
class Container
}
@java.lang.annotation.Repeatable(D1::class)
annotation class B1 {
class Container
}
annotation class D1(val value: Array<B1>)
@Repeatable
@java.lang.annotation.Repeatable(D2::class)
annotation class B2 {
class Container
}
annotation class D2(val value: Array<B2>)
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +RepeatableAnnotations +RepeatableAnnotationContainerConstraints
// FULL_JDK