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
This commit is contained in:
+18
-4
@@ -1,6 +1,6 @@
|
||||
// !API_VERSION: 1.2
|
||||
// !USE_EXPERIMENTAL: kotlin.Experimental
|
||||
// !DIAGNOSTICS: -INVISIBLE_MEMBER -INVISIBLE_REFERENCE -NEWER_VERSION_IN_SINCE_KOTLIN
|
||||
// !DIAGNOSTICS: -INVISIBLE_MEMBER -INVISIBLE_REFERENCE -NEWER_VERSION_IN_SINCE_KOTLIN -UNUSED_PARAMETER
|
||||
|
||||
@SinceKotlin("1.3")
|
||||
fun newPublishedFun() {}
|
||||
@@ -21,7 +21,15 @@ val newValExperimentalInThePast = ""
|
||||
@WasExperimental(Marker::class)
|
||||
class NewClassExperimentalInThePast
|
||||
|
||||
fun use1() {
|
||||
@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<!>
|
||||
@@ -29,7 +37,10 @@ fun use1() {
|
||||
}
|
||||
|
||||
@UseExperimental(Marker::class)
|
||||
fun use2() {
|
||||
fun use2(
|
||||
c2: NewClassExperimentalInThePast,
|
||||
t2: TypeAliasToNewClass
|
||||
) {
|
||||
<!UNRESOLVED_REFERENCE!>newPublishedFun<!>()
|
||||
newFunExperimentalInThePast()
|
||||
newValExperimentalInThePast
|
||||
@@ -37,7 +48,10 @@ fun use2() {
|
||||
}
|
||||
|
||||
@Marker
|
||||
fun use3() {
|
||||
fun use3(
|
||||
c3: NewClassExperimentalInThePast,
|
||||
t3: TypeAliasToNewClass
|
||||
) {
|
||||
<!UNRESOLVED_REFERENCE!>newPublishedFun<!>()
|
||||
newFunExperimentalInThePast()
|
||||
newValExperimentalInThePast
|
||||
|
||||
Reference in New Issue
Block a user