Files
kotlin-fork/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalWithSeveralAnnotations.kt
T
Alexander Udalov c57864e46c Require "-Xuse-experimental=kotlin.Experimental" on usages of Experimental
Since we're not yet sure of the design of Experimental/UseExperimental,
we're making them "experimental" themselves in some sense, in that the
user is required to provide the magic argument
"-Xuse-experimental=kotlin.Experimental" to be allowed to use either
Experimental or UseExperimental. This is more convenient than the
previous approach of "-language-version 1.3
-Xskip-metadata-version-check" because it's simpler and does not cause
pre-release binaries to be produced
2018-05-04 13:48:24 +02:00

53 lines
778 B
Kotlin
Vendored

// !USE_EXPERIMENTAL: kotlin.Experimental
// FILE: api.kt
package api
@Experimental(Experimental.Level.WARNING)
@Target(AnnotationTarget.FUNCTION)
annotation class E1
@Experimental(Experimental.Level.WARNING)
@Target(AnnotationTarget.FUNCTION)
annotation class E2
@Experimental(Experimental.Level.WARNING)
@Target(AnnotationTarget.FUNCTION)
annotation class E3
@E1
fun e1() {}
@E2
fun e2() {}
@E3
fun e3() {}
// FILE: usage.kt
package usage
import api.*
@UseExperimental(E1::class, E2::class, E3::class)
fun use1() {
e1()
e2()
e3()
}
@UseExperimental(E1::class, E3::class)
fun use2() {
e1()
@UseExperimental(E2::class) e2()
e3()
}
@UseExperimental(E1::class, E2::class)
fun use3() {
e1()
e2()
<!EXPERIMENTAL_API_USAGE!>e3<!>()
}