FIR: add OptIn checkers draft + some annotation / SinceKotlin utilities

This commit is contained in:
Mikhail Glukhikh
2021-06-11 19:05:39 +03:00
parent bd39e457a7
commit ceb527c5e4
30 changed files with 617 additions and 46 deletions
@@ -1,6 +1,6 @@
// FILE: api.kt
@RequiresOptIn
@<!EXPERIMENTAL_IS_NOT_ENABLED!>RequiresOptIn<!>
@Retention(AnnotationRetention.BINARY)
annotation class Marker
@@ -18,7 +18,7 @@ fun use2() {
f()
}
@OptIn(Marker::class)
@<!EXPERIMENTAL_IS_NOT_ENABLED!>OptIn<!>(Marker::class)
fun use3() {
f()
}
@@ -12,21 +12,21 @@ import kotlin.annotation.AnnotationTarget.*
annotation class E1
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
@Target(FILE)
<!EXPERIMENTAL_ANNOTATION_WITH_WRONG_TARGET!>@Target(FILE)<!>
annotation class E2
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
@Target(EXPRESSION)
@Retention(AnnotationRetention.SOURCE)
<!EXPERIMENTAL_ANNOTATION_WITH_WRONG_TARGET!>@Target(EXPRESSION)<!>
<!EXPERIMENTAL_ANNOTATION_WITH_WRONG_RETENTION!>@Retention(AnnotationRetention.SOURCE)<!>
annotation class E3
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
@Target(TYPE_PARAMETER)
<!EXPERIMENTAL_ANNOTATION_WITH_WRONG_TARGET!>@Target(TYPE_PARAMETER)<!>
@Retention(AnnotationRetention.BINARY)
annotation class E3A
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
@Target(TYPE)
<!EXPERIMENTAL_ANNOTATION_WITH_WRONG_TARGET!>@Target(TYPE)<!>
@Retention(AnnotationRetention.BINARY)
annotation class E3B
@@ -1,9 +0,0 @@
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
annotation class NotAMarker
@OptIn
fun f1() {}
@OptIn(NotAMarker::class)
fun f2() {}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
annotation class NotAMarker
@@ -35,10 +35,10 @@ fun f4(u: OptIn0 /* TODO */) {}
annotation class VarargKClasses(vararg val k: KClass<*>)
@VarargKClasses(
RequiresOptIn::class,
OptIn::class,
kotlin.RequiresOptIn::class,
kotlin.OptIn::class
<!EXPERIMENTAL_CAN_ONLY_BE_USED_AS_ANNOTATION!>RequiresOptIn<!>::class,
<!EXPERIMENTAL_CAN_ONLY_BE_USED_AS_ANNOTATION!>OptIn<!>::class,
<!EXPERIMENTAL_CAN_ONLY_BE_USED_AS_ANNOTATION!>kotlin.RequiresOptIn<!>::class,
<!EXPERIMENTAL_CAN_ONLY_BE_USED_AS_ANNOTATION!>kotlin.OptIn<!>::class
)
fun f5() {}