[FIR] Support several annotation argument diagnostics
This commit is contained in:
committed by
Mikhail Glukhikh
parent
0c13d3197c
commit
cfc1ebb4be
-45
@@ -1,45 +0,0 @@
|
||||
// !LANGUAGE: +ProhibitTypeParametersInClassLiteralsInAnnotationArguments
|
||||
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
annotation class Ann(val k: KClass<*>)
|
||||
annotation class AnnArray(val kk: Array<KClass<*>>)
|
||||
|
||||
object AnObject
|
||||
|
||||
class C {
|
||||
companion object
|
||||
}
|
||||
|
||||
fun foo() = "foo"
|
||||
|
||||
@Ann("foo"::class)
|
||||
fun test1() {}
|
||||
|
||||
@Ann(String::class)
|
||||
fun test2() {}
|
||||
|
||||
@Ann(AnObject::class)
|
||||
fun test4() {}
|
||||
|
||||
@Ann(C::class)
|
||||
fun test5() {}
|
||||
|
||||
@Ann(C.Companion::class)
|
||||
fun test6() {}
|
||||
|
||||
@Ann(foo()::class)
|
||||
fun test7() {}
|
||||
|
||||
@AnnArray(arrayOf(""::class, String::class, AnObject::class))
|
||||
fun test8() {}
|
||||
|
||||
inline val <reified T> T.test9
|
||||
get() = @AnnArray(arrayOf(
|
||||
T::class,
|
||||
Array<T>::class,
|
||||
Array<Array<Array<T>>>::class
|
||||
)) object {}
|
||||
|
||||
inline val <reified T> T.test10
|
||||
get() = @AnnArray([T::class]) object {}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +ProhibitTypeParametersInClassLiteralsInAnnotationArguments
|
||||
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
+3
-3
@@ -6,7 +6,7 @@ annotation class Ann(vararg val k: KClass<*>)
|
||||
|
||||
inline val <reified T> T.test
|
||||
get() = @Ann(
|
||||
T::class,
|
||||
Array<T>::class,
|
||||
Array<Array<Array<T>>>::class
|
||||
<!ANNOTATION_ARGUMENT_KCLASS_LITERAL_OF_TYPE_PARAMETER_ERROR!>T::class<!>,
|
||||
<!ANNOTATION_ARGUMENT_KCLASS_LITERAL_OF_TYPE_PARAMETER_ERROR!>Array<T>::class<!>,
|
||||
<!ANNOTATION_ARGUMENT_KCLASS_LITERAL_OF_TYPE_PARAMETER_ERROR!>Array<Array<Array<T>>>::class<!>
|
||||
) object {}
|
||||
|
||||
Reference in New Issue
Block a user