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
|
||||
|
||||
+4
-3
@@ -3,9 +3,9 @@ package
|
||||
@kotlin.SinceKotlin(version = "1.3") @kotlin.WasExperimental(markerClass = {Marker::class}) public val newValExperimentalInThePast: kotlin.String = ""
|
||||
@kotlin.SinceKotlin(version = "1.3") @kotlin.WasExperimental(markerClass = {Marker::class}) public fun newFunExperimentalInThePast(): kotlin.Unit
|
||||
@kotlin.SinceKotlin(version = "1.3") public fun newPublishedFun(): kotlin.Unit
|
||||
public fun use1(): kotlin.Unit
|
||||
@kotlin.UseExperimental(markerClass = {Marker::class}) public fun use2(): kotlin.Unit
|
||||
@Marker public fun use3(): kotlin.Unit
|
||||
public fun use1(/*0*/ c1: NewClassExperimentalInThePast, /*1*/ t1: TypeAliasToNewClass /* = NewClassExperimentalInThePast */): kotlin.Unit
|
||||
@kotlin.UseExperimental(markerClass = {Marker::class}) public fun use2(/*0*/ c2: NewClassExperimentalInThePast, /*1*/ t2: TypeAliasToNewClass /* = NewClassExperimentalInThePast */): kotlin.Unit
|
||||
@Marker public fun use3(/*0*/ c3: NewClassExperimentalInThePast, /*1*/ t3: TypeAliasToNewClass /* = NewClassExperimentalInThePast */): kotlin.Unit
|
||||
|
||||
@kotlin.Experimental public final annotation class Marker : kotlin.Annotation {
|
||||
public constructor Marker()
|
||||
@@ -20,3 +20,4 @@ public fun use1(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@kotlin.SinceKotlin(version = "1.3") @kotlin.WasExperimental(markerClass = {Marker::class}) public typealias TypeAliasToNewClass = NewClassExperimentalInThePast
|
||||
|
||||
Reference in New Issue
Block a user