mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-17 08:31:29 +00:00
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
44 lines
710 B
Kotlin
Vendored
44 lines
710 B
Kotlin
Vendored
// !USE_EXPERIMENTAL: kotlin.Experimental
|
|
// FILE: api.kt
|
|
|
|
package api
|
|
|
|
@Experimental(Experimental.Level.WARNING)
|
|
@Target(AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION)
|
|
annotation class ExperimentalAPI
|
|
|
|
@ExperimentalAPI
|
|
const val MEANING = 42
|
|
|
|
annotation class Anno(val value: Int)
|
|
|
|
// FILE: usage-propagate.kt
|
|
|
|
package usage1
|
|
|
|
import api.*
|
|
|
|
@ExperimentalAPI
|
|
@Anno(MEANING)
|
|
fun usage() {}
|
|
|
|
// FILE: usage-use.kt
|
|
|
|
@file:UseExperimental(ExperimentalAPI::class)
|
|
package usage2
|
|
|
|
import api.*
|
|
|
|
// TODO: there should be no warning here
|
|
@Anno(<!EXPERIMENTAL_API_USAGE!>MEANING<!>)
|
|
fun usage() {}
|
|
|
|
// FILE: usage-none.kt
|
|
|
|
package usage3
|
|
|
|
import api.*
|
|
|
|
@Anno(<!EXPERIMENTAL_API_USAGE!>MEANING<!>)
|
|
fun usage() {}
|