Files
kotlin-fork/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnFile.kt
T
Alexander Udalov f954a6c812 Support custom message in RequiresOptIn
#KT-34648 Fixed
2020-01-14 21:04:43 +01:00

38 lines
659 B
Kotlin
Vendored

// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
// FILE: api.kt
package api
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
@Target(AnnotationTarget.FUNCTION)
annotation class ExperimentalAPI1
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
@Target(AnnotationTarget.FUNCTION)
annotation class ExperimentalAPI2
@ExperimentalAPI1
fun compilation() {}
@ExperimentalAPI2
fun runtime() {}
// FILE: usage.kt
@file:OptIn(ExperimentalAPI1::class)
package usage
import api.*
fun use() {
compilation()
<!EXPERIMENTAL_API_USAGE!>runtime<!>()
}
class Use {
fun use() {
compilation()
<!EXPERIMENTAL_API_USAGE!>runtime<!>()
}
}