c57864e46c
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
37 lines
811 B
Kotlin
Vendored
37 lines
811 B
Kotlin
Vendored
// !USE_EXPERIMENTAL: kotlin.Experimental
|
|
// FILE: api.kt
|
|
|
|
package api
|
|
|
|
@Experimental(Experimental.Level.WARNING)
|
|
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY)
|
|
annotation class ExperimentalAPI
|
|
|
|
@ExperimentalAPI
|
|
class C {
|
|
@ExperimentalAPI
|
|
fun function() {}
|
|
|
|
@ExperimentalAPI
|
|
val property: String = ""
|
|
|
|
@ExperimentalAPI
|
|
class Nested {
|
|
@ExperimentalAPI
|
|
fun nestedFunction() {}
|
|
}
|
|
}
|
|
|
|
// FILE: usage.kt
|
|
|
|
package usage
|
|
|
|
import api.*
|
|
|
|
fun use() {
|
|
val c: <!EXPERIMENTAL_API_USAGE!>C<!> = <!EXPERIMENTAL_API_USAGE!>C<!>()
|
|
c.<!EXPERIMENTAL_API_USAGE!>function<!>()
|
|
c.<!EXPERIMENTAL_API_USAGE!>property<!>
|
|
<!EXPERIMENTAL_API_USAGE!>C<!>.<!EXPERIMENTAL_API_USAGE!>Nested<!>().<!EXPERIMENTAL_API_USAGE!>nestedFunction<!>()
|
|
}
|