Files
kotlin/compiler/testData/diagnostics/testsWithStdLib/experimental/deeplyNestedClass.kt
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

58 lines
1.0 KiB
Kotlin
Vendored

// !USE_EXPERIMENTAL: kotlin.Experimental
// FILE: api.kt
package api
@Experimental(Experimental.Level.WARNING)
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
annotation class ExperimentalAPI
@ExperimentalAPI
class C {
class D {
class E {
class F
}
}
}
// FILE: usage-propagate.kt
package usage1
import api.*
@ExperimentalAPI
fun use1() {
C.D.E.F()
}
@ExperimentalAPI
fun use2(f: C.D.E.F) = f.hashCode()
// FILE: usage-use.kt
package usage2
import api.*
@UseExperimental(ExperimentalAPI::class)
fun use1() {
C.D.E.F()
}
@UseExperimental(ExperimentalAPI::class)
fun use2(f: C.D.E.F) = f.hashCode()
// FILE: usage-none.kt
package usage3
import api.*
fun use1() {
<!EXPERIMENTAL_API_USAGE!>C<!>.<!EXPERIMENTAL_API_USAGE!>D<!>.<!EXPERIMENTAL_API_USAGE!>E<!>.<!EXPERIMENTAL_API_USAGE!>F<!>()
}
fun use2(f: <!EXPERIMENTAL_API_USAGE!>C<!>.<!EXPERIMENTAL_API_USAGE!>D<!>.<!EXPERIMENTAL_API_USAGE!>E<!>.<!EXPERIMENTAL_API_USAGE!>F<!>) = f.<!EXPERIMENTAL_API_USAGE!>hashCode<!>()