Files
kotlin-fork/compiler/testData/diagnostics/testsWithStdLib/experimental/wasExperimental.kt
T
Alexander Udalov 7d74508529 Report experimental diagnostics on inaccessible (wrt SinceKotlin) API
If a declaration is annotated both with SinceKotlin and WasExperimental
and the SinceKotlin version makes it inaccessible, the experimental
checker must regard it as experimental, with markers specified in the
WasExperimental annotation arguments. So only errors/warnings about the
experimentality are going to be reported in this case, and no error that
the declaration is unavailable because of a low API version
2018-05-07 11:37:31 +02:00

60 lines
1.5 KiB
Kotlin
Vendored

// !API_VERSION: 1.2
// !USE_EXPERIMENTAL: kotlin.Experimental
// !DIAGNOSTICS: -INVISIBLE_MEMBER -INVISIBLE_REFERENCE -NEWER_VERSION_IN_SINCE_KOTLIN -UNUSED_PARAMETER
@SinceKotlin("1.3")
fun newPublishedFun() {}
@Experimental
annotation class Marker
@SinceKotlin("1.3")
@WasExperimental(Marker::class)
fun newFunExperimentalInThePast() {}
@SinceKotlin("1.3")
@WasExperimental(Marker::class)
val newValExperimentalInThePast = ""
@SinceKotlin("1.3")
@WasExperimental(Marker::class)
class NewClassExperimentalInThePast
@SinceKotlin("1.3")
@WasExperimental(Marker::class)
typealias TypeAliasToNewClass = <!EXPERIMENTAL_API_USAGE_ERROR!>NewClassExperimentalInThePast<!>
fun use1(
c1: <!EXPERIMENTAL_API_USAGE_ERROR!>NewClassExperimentalInThePast<!>,
t1: <!EXPERIMENTAL_API_USAGE_ERROR!>TypeAliasToNewClass<!>
) {
<!UNRESOLVED_REFERENCE!>newPublishedFun<!>()
<!UNRESOLVED_REFERENCE!>newFunExperimentalInThePast<!>()
<!UNRESOLVED_REFERENCE!>newValExperimentalInThePast<!>
<!UNRESOLVED_REFERENCE!>NewClassExperimentalInThePast<!>()
}
@UseExperimental(Marker::class)
fun use2(
c2: NewClassExperimentalInThePast,
t2: TypeAliasToNewClass
) {
<!UNRESOLVED_REFERENCE!>newPublishedFun<!>()
newFunExperimentalInThePast()
newValExperimentalInThePast
NewClassExperimentalInThePast()
}
@Marker
fun use3(
c3: NewClassExperimentalInThePast,
t3: TypeAliasToNewClass
) {
<!UNRESOLVED_REFERENCE!>newPublishedFun<!>()
newFunExperimentalInThePast()
newValExperimentalInThePast
NewClassExperimentalInThePast()
}