Report EXPERIMENTAL_API diagnostics on various implicit usages
#KT-32443 Fixed #KT-22852 Fixed
This commit is contained in:
committed by
teamcityserver
parent
d8d38862d9
commit
0a670bf055
+6
@@ -34309,6 +34309,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/fullFqNameUsage.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("implicitUsages.kt")
|
||||
public void testImplicitUsages() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/implicitUsages.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("importStatement.kt")
|
||||
public void testImportStatement() throws Exception {
|
||||
|
||||
+6
@@ -34309,6 +34309,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/fullFqNameUsage.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("implicitUsages.kt")
|
||||
public void testImplicitUsages() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/implicitUsages.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("importStatement.kt")
|
||||
public void testImportStatement() throws Exception {
|
||||
|
||||
+86
-5
@@ -46,6 +46,8 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.annotationClass
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.module
|
||||
import org.jetbrains.kotlin.storage.LockBasedStorageManager
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.isError
|
||||
import org.jetbrains.kotlin.utils.SmartSet
|
||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||
|
||||
@@ -79,11 +81,36 @@ class ExperimentalUsageChecker(project: Project) : CallChecker {
|
||||
)
|
||||
|
||||
override fun check(resolvedCall: ResolvedCall<*>, reportOn: PsiElement, context: CallCheckerContext) {
|
||||
val experimentalities =
|
||||
resolvedCall.resultingDescriptor.loadExperimentalities(moduleAnnotationsResolver, context.languageVersionSettings)
|
||||
val resultingDescriptor = resolvedCall.resultingDescriptor
|
||||
val experimentalities = resultingDescriptor.loadExperimentalities(moduleAnnotationsResolver, context.languageVersionSettings)
|
||||
if (resultingDescriptor is FunctionDescriptor &&
|
||||
resultingDescriptor.kind == CallableMemberDescriptor.Kind.SYNTHESIZED
|
||||
) {
|
||||
val propertyDescriptor = resultingDescriptor.findRelevantDataClassPropertyIfAny(context)
|
||||
if (propertyDescriptor != null) {
|
||||
reportNotAcceptedExperimentalities(
|
||||
experimentalities + propertyDescriptor.loadExperimentalities(
|
||||
moduleAnnotationsResolver, context.languageVersionSettings
|
||||
), reportOn, context
|
||||
)
|
||||
return
|
||||
}
|
||||
}
|
||||
reportNotAcceptedExperimentalities(experimentalities, reportOn, context)
|
||||
}
|
||||
|
||||
private fun FunctionDescriptor.findRelevantDataClassPropertyIfAny(context: CallCheckerContext): PropertyDescriptor? {
|
||||
val index = name.asString().removePrefix("component").toIntOrNull()
|
||||
val container = containingDeclaration
|
||||
if (container is ClassDescriptor && container.isData && index != null) {
|
||||
val dataClassParameterDescriptor = container.unsubstitutedPrimaryConstructor?.valueParameters?.getOrNull(index - 1)
|
||||
if (dataClassParameterDescriptor != null) {
|
||||
return context.trace.bindingContext[BindingContext.VALUE_PARAMETER_AS_PROPERTY, dataClassParameterDescriptor]
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
companion object {
|
||||
val OLD_EXPERIMENTAL_FQ_NAME = FqName("kotlin.Experimental")
|
||||
val OLD_USE_EXPERIMENTAL_FQ_NAME = FqName("kotlin.UseExperimental")
|
||||
@@ -145,14 +172,47 @@ class ExperimentalUsageChecker(project: Project) : CallChecker {
|
||||
|
||||
fun DeclarationDescriptor.loadExperimentalities(
|
||||
moduleAnnotationsResolver: ModuleAnnotationsResolver,
|
||||
languageVersionSettings: LanguageVersionSettings
|
||||
languageVersionSettings: LanguageVersionSettings,
|
||||
visited: MutableSet<DeclarationDescriptor> = mutableSetOf()
|
||||
): Set<Experimentality> {
|
||||
if (this in visited) return emptySet()
|
||||
visited += this
|
||||
val result = SmartSet.create<Experimentality>()
|
||||
if (this is CallableMemberDescriptor && kind == CallableMemberDescriptor.Kind.FAKE_OVERRIDE) {
|
||||
for (overridden in overriddenDescriptors) {
|
||||
result.addAll(overridden.loadExperimentalities(moduleAnnotationsResolver, languageVersionSettings, visited))
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
for (annotation in annotations) {
|
||||
result.addIfNotNull(annotation.annotationClass?.loadExperimentalityForMarkerAnnotation())
|
||||
}
|
||||
|
||||
if (this is CallableDescriptor && this !is ClassConstructorDescriptor) {
|
||||
result.addAll(
|
||||
returnType.loadExperimentalities(moduleAnnotationsResolver, languageVersionSettings, visited)
|
||||
)
|
||||
result.addAll(
|
||||
extensionReceiverParameter?.type.loadExperimentalities(
|
||||
moduleAnnotationsResolver, languageVersionSettings, visited
|
||||
)
|
||||
)
|
||||
if (this is FunctionDescriptor) {
|
||||
valueParameters.forEach {
|
||||
result.addAll(
|
||||
it.type.loadExperimentalities(
|
||||
moduleAnnotationsResolver, languageVersionSettings, visited
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this is TypeAliasDescriptor) {
|
||||
result.addAll(expandedType.loadExperimentalities(moduleAnnotationsResolver, languageVersionSettings, visited))
|
||||
}
|
||||
|
||||
if (annotations.any { it.fqName == WAS_EXPERIMENTAL_FQ_NAME }) {
|
||||
val accessibility = checkSinceKotlinVersionAccessibility(languageVersionSettings)
|
||||
if (accessibility is SinceKotlinAccessibility.NotAccessibleButWasExperimental) {
|
||||
@@ -162,7 +222,7 @@ class ExperimentalUsageChecker(project: Project) : CallChecker {
|
||||
|
||||
val container = containingDeclaration
|
||||
if (container is ClassDescriptor && this !is ConstructorDescriptor) {
|
||||
result.addAll(container.loadExperimentalities(moduleAnnotationsResolver, languageVersionSettings))
|
||||
result.addAll(container.loadExperimentalities(moduleAnnotationsResolver, languageVersionSettings, visited))
|
||||
}
|
||||
|
||||
for (moduleAnnotationClassId in moduleAnnotationsResolver.getAnnotationsOnContainingModule(this)) {
|
||||
@@ -173,6 +233,19 @@ class ExperimentalUsageChecker(project: Project) : CallChecker {
|
||||
return result
|
||||
}
|
||||
|
||||
private fun KotlinType?.loadExperimentalities(
|
||||
moduleAnnotationsResolver: ModuleAnnotationsResolver,
|
||||
languageVersionSettings: LanguageVersionSettings,
|
||||
visitedClassifiers: MutableSet<DeclarationDescriptor>
|
||||
): Set<Experimentality> =
|
||||
if (this?.isError != false) emptySet()
|
||||
else constructor.declarationDescriptor?.loadExperimentalities(
|
||||
moduleAnnotationsResolver, languageVersionSettings, visitedClassifiers
|
||||
).orEmpty() + arguments.flatMap {
|
||||
if (it.isStarProjection) emptySet()
|
||||
else it.type.loadExperimentalities(moduleAnnotationsResolver, languageVersionSettings, visitedClassifiers)
|
||||
}
|
||||
|
||||
internal fun ClassDescriptor.loadExperimentalityForMarkerAnnotation(): Experimentality? {
|
||||
val experimental =
|
||||
annotations.findAnnotation(REQUIRES_OPT_IN_FQ_NAME)
|
||||
@@ -316,7 +389,15 @@ class ExperimentalUsageChecker(project: Project) : CallChecker {
|
||||
}
|
||||
|
||||
if (element.getParentOfType<KtImportDirective>(false) == null) {
|
||||
val experimentalities = targetDescriptor.loadExperimentalities(moduleAnnotationsResolver, context.languageVersionSettings)
|
||||
val experimentalities = mutableSetOf<Experimentality>()
|
||||
experimentalities += targetDescriptor.loadExperimentalities(moduleAnnotationsResolver, context.languageVersionSettings)
|
||||
if (targetDescriptor is TypeAliasDescriptor) {
|
||||
experimentalities.addAll(
|
||||
targetDescriptor.expandedType.loadExperimentalities(
|
||||
moduleAnnotationsResolver, context.languageVersionSettings, mutableSetOf(targetDescriptor)
|
||||
)
|
||||
)
|
||||
}
|
||||
reportNotAcceptedExperimentalities(experimentalities, element, context)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,4 +11,13 @@ compiler/testData/cli/jvm/useDeclarationThatWasExperimentalWithoutMarker.kt:2:5:
|
||||
compiler/testData/cli/jvm/useDeclarationThatWasExperimentalWithoutMarker.kt:4:12: error: this declaration is experimental and its usage must be marked with '@kotlin.ExperimentalStdlibApi' or '@OptIn(kotlin.ExperimentalStdlibApi::class)'
|
||||
val x: ArrayDeque<Int>? = null
|
||||
^
|
||||
compiler/testData/cli/jvm/useDeclarationThatWasExperimentalWithoutMarker.kt:5:12: error: this declaration is experimental and its usage must be marked with '@kotlin.ExperimentalStdlibApi' or '@OptIn(kotlin.ExperimentalStdlibApi::class)'
|
||||
return x ?: s
|
||||
^
|
||||
compiler/testData/cli/jvm/useDeclarationThatWasExperimentalWithoutMarker.kt:5:14: error: this declaration is experimental and its usage must be marked with '@kotlin.ExperimentalStdlibApi' or '@OptIn(kotlin.ExperimentalStdlibApi::class)'
|
||||
return x ?: s
|
||||
^
|
||||
compiler/testData/cli/jvm/useDeclarationThatWasExperimentalWithoutMarker.kt:5:17: error: this declaration is experimental and its usage must be marked with '@kotlin.ExperimentalStdlibApi' or '@OptIn(kotlin.ExperimentalStdlibApi::class)'
|
||||
return x ?: s
|
||||
^
|
||||
COMPILATION_ERROR
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// StackOverflow
|
||||
val p = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>::p<!>
|
||||
val p = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>p<!><!>
|
||||
|
||||
fun foo() = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>::foo<!>
|
||||
fun foo() = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>foo<!><!>
|
||||
|
||||
@@ -81,9 +81,9 @@ import api.*
|
||||
|
||||
fun use() {
|
||||
val c: <!EXPERIMENTAL_API_USAGE!>C<!> = <!EXPERIMENTAL_API_USAGE!>C<!>()
|
||||
c.<!EXPERIMENTAL_API_USAGE!>function<!>()
|
||||
c.<!EXPERIMENTAL_API_USAGE!>property<!>
|
||||
<!EXPERIMENTAL_API_USAGE!>c<!>.<!EXPERIMENTAL_API_USAGE!>function<!>()
|
||||
<!EXPERIMENTAL_API_USAGE!>c<!>.<!EXPERIMENTAL_API_USAGE!>property<!>
|
||||
<!EXPERIMENTAL_API_USAGE!>C<!>.<!EXPERIMENTAL_API_USAGE!>Nested<!>()
|
||||
c.<!EXPERIMENTAL_API_USAGE!>Inner<!>()
|
||||
c.<!EXPERIMENTAL_API_USAGE!>extension<!>()
|
||||
<!EXPERIMENTAL_API_USAGE!>c<!>.<!EXPERIMENTAL_API_USAGE!>Inner<!>()
|
||||
<!EXPERIMENTAL_API_USAGE!>c<!>.<!EXPERIMENTAL_API_USAGE!>extension<!>()
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -31,7 +31,7 @@ import api.*
|
||||
|
||||
fun use() {
|
||||
val c: <!EXPERIMENTAL_API_USAGE!>C<!> = <!EXPERIMENTAL_API_USAGE!>C<!>()
|
||||
c.<!EXPERIMENTAL_API_USAGE!>function<!>()
|
||||
c.<!EXPERIMENTAL_API_USAGE!>property<!>
|
||||
<!EXPERIMENTAL_API_USAGE!>c<!>.<!EXPERIMENTAL_API_USAGE!>function<!>()
|
||||
<!EXPERIMENTAL_API_USAGE!>c<!>.<!EXPERIMENTAL_API_USAGE!>property<!>
|
||||
<!EXPERIMENTAL_API_USAGE!>C<!>.<!EXPERIMENTAL_API_USAGE!>Nested<!>().<!EXPERIMENTAL_API_USAGE!>nestedFunction<!>()
|
||||
}
|
||||
|
||||
+1
-1
@@ -55,4 +55,4 @@ 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<!>()
|
||||
fun use2(f: <!EXPERIMENTAL_API_USAGE!>C<!>.<!EXPERIMENTAL_API_USAGE!>D<!>.<!EXPERIMENTAL_API_USAGE!>E<!>.<!EXPERIMENTAL_API_USAGE!>F<!>) = <!EXPERIMENTAL_API_USAGE!>f<!>.hashCode()
|
||||
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
|
||||
@RequiresOptIn
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class Marker
|
||||
|
||||
@Marker
|
||||
interface Some
|
||||
|
||||
abstract class User {
|
||||
abstract fun createSome(): Some
|
||||
fun Some?.onSome() {}
|
||||
fun withSome(some: Some? = null) {}
|
||||
|
||||
fun use() {
|
||||
val something = createSome()
|
||||
val somethingOther: Some = createSome()
|
||||
null.onSome()
|
||||
withSome()
|
||||
}
|
||||
}
|
||||
|
||||
data class DataClass(@property:Marker val x: Int)
|
||||
|
||||
fun useDataClass(d: DataClass) {
|
||||
// Should have error in both
|
||||
d.x
|
||||
val (x) = d
|
||||
}
|
||||
|
||||
typealias My = Some
|
||||
|
||||
fun my(my: My) {}
|
||||
|
||||
fun your(my: Some) {}
|
||||
|
||||
@Marker
|
||||
interface ExperimentalType {
|
||||
fun foo() {}
|
||||
fun bar() {}
|
||||
}
|
||||
|
||||
@OptIn(Marker::class)
|
||||
interface NotExperimentalExtension : ExperimentalType {
|
||||
override fun foo() {}
|
||||
}
|
||||
|
||||
fun use(arg: NotExperimentalExtension) {
|
||||
arg.foo()
|
||||
arg.bar()
|
||||
}
|
||||
|
||||
@Marker
|
||||
interface I
|
||||
|
||||
@OptIn(Marker::class)
|
||||
class A : I
|
||||
|
||||
@OptIn(Marker::class)
|
||||
class B : I
|
||||
|
||||
fun main() {
|
||||
val x = listOf(A(), B())
|
||||
}
|
||||
|
||||
@Marker
|
||||
class C {
|
||||
operator fun getValue(x: Any?, y: Any?): String = ""
|
||||
}
|
||||
|
||||
object O {
|
||||
@OptIn(Marker::class)
|
||||
operator fun provideDelegate(x: Any?, y: Any?): C = C()
|
||||
}
|
||||
|
||||
val x: String by O
|
||||
|
||||
@Marker
|
||||
class OperatorContainer : Comparable<OperatorContainer> {
|
||||
@OptIn(Marker::class)
|
||||
override fun compareTo(other: OperatorContainer): Int {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(Marker::class)
|
||||
class AnotherContainer : Iterable<C> {
|
||||
@OptIn(Marker::class)
|
||||
override fun iterator(): Iterator<C> {
|
||||
return object : Iterator<C> {
|
||||
override fun hasNext(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun next(): C {
|
||||
throw java.util.NoSuchElementException()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(Marker::class)
|
||||
operator fun String.minus(s: String) = OperatorContainer()
|
||||
|
||||
@OptIn(Marker::class)
|
||||
operator fun String.invoke() = OperatorContainer()
|
||||
|
||||
fun operatorContainerUsage(s: String, a: AnotherContainer) {
|
||||
val res1 = s - s
|
||||
val res2 = s()
|
||||
val res3 = res1 > res2
|
||||
for (c in a) {}
|
||||
}
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
|
||||
@RequiresOptIn
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class Marker
|
||||
|
||||
@Marker
|
||||
interface Some
|
||||
|
||||
abstract class User {
|
||||
abstract fun createSome(): <!EXPERIMENTAL_API_USAGE_ERROR!>Some<!>
|
||||
fun <!EXPERIMENTAL_API_USAGE_ERROR!>Some<!>?.onSome() {}
|
||||
fun withSome(some: <!EXPERIMENTAL_API_USAGE_ERROR!>Some<!>? = null) {}
|
||||
|
||||
fun use() {
|
||||
val something = <!EXPERIMENTAL_API_USAGE_ERROR!>createSome<!>()
|
||||
val somethingOther: <!EXPERIMENTAL_API_USAGE_ERROR!>Some<!> = <!EXPERIMENTAL_API_USAGE_ERROR!>createSome<!>()
|
||||
null.<!EXPERIMENTAL_API_USAGE_ERROR!>onSome<!>()
|
||||
<!EXPERIMENTAL_API_USAGE_ERROR!>withSome<!>()
|
||||
}
|
||||
}
|
||||
|
||||
data class DataClass(@property:Marker val x: Int)
|
||||
|
||||
fun useDataClass(d: DataClass) {
|
||||
// Should have error in both
|
||||
d.<!EXPERIMENTAL_API_USAGE_ERROR!>x<!>
|
||||
val (<!EXPERIMENTAL_API_USAGE_ERROR!>x<!>) = d
|
||||
}
|
||||
|
||||
typealias My = <!EXPERIMENTAL_API_USAGE_ERROR!>Some<!>
|
||||
|
||||
fun my(my: <!EXPERIMENTAL_API_USAGE_ERROR!>My<!>) {}
|
||||
|
||||
fun your(my: <!EXPERIMENTAL_API_USAGE_ERROR!>Some<!>) {}
|
||||
|
||||
@Marker
|
||||
interface ExperimentalType {
|
||||
fun foo() {}
|
||||
fun bar() {}
|
||||
}
|
||||
|
||||
@OptIn(Marker::class)
|
||||
interface NotExperimentalExtension : ExperimentalType {
|
||||
override fun foo() {}
|
||||
}
|
||||
|
||||
fun use(arg: NotExperimentalExtension) {
|
||||
arg.foo()
|
||||
arg.<!EXPERIMENTAL_API_USAGE_ERROR!>bar<!>()
|
||||
}
|
||||
|
||||
@Marker
|
||||
interface I
|
||||
|
||||
@OptIn(Marker::class)
|
||||
class A : I
|
||||
|
||||
@OptIn(Marker::class)
|
||||
class B : I
|
||||
|
||||
fun main() {
|
||||
val x = <!EXPERIMENTAL_API_USAGE_ERROR!>listOf<!>(A(), B())
|
||||
}
|
||||
|
||||
@Marker
|
||||
class C {
|
||||
operator fun getValue(x: Any?, y: Any?): String = ""
|
||||
}
|
||||
|
||||
object O {
|
||||
@OptIn(Marker::class)
|
||||
operator fun provideDelegate(x: Any?, y: Any?): C = C()
|
||||
}
|
||||
|
||||
val x: String by <!EXPERIMENTAL_API_USAGE_ERROR!>O<!>
|
||||
|
||||
@Marker
|
||||
class OperatorContainer : Comparable<OperatorContainer> {
|
||||
@OptIn(Marker::class)
|
||||
override fun compareTo(other: OperatorContainer): Int {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(Marker::class)
|
||||
class AnotherContainer : Iterable<C> {
|
||||
@OptIn(Marker::class)
|
||||
override fun iterator(): Iterator<C> {
|
||||
return object : Iterator<C> {
|
||||
override fun hasNext(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun next(): C {
|
||||
throw java.util.NoSuchElementException()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(Marker::class)
|
||||
operator fun String.minus(s: String) = OperatorContainer()
|
||||
|
||||
@OptIn(Marker::class)
|
||||
operator fun String.invoke() = OperatorContainer()
|
||||
|
||||
fun operatorContainerUsage(s: String, a: AnotherContainer) {
|
||||
val res1 = s <!EXPERIMENTAL_API_USAGE_ERROR!>-<!> s
|
||||
val res2 = <!EXPERIMENTAL_API_USAGE_ERROR!>s<!>()
|
||||
val res3 = <!EXPERIMENTAL_API_USAGE_ERROR!>res1<!> <!EXPERIMENTAL_API_USAGE_ERROR!>><!> <!EXPERIMENTAL_API_USAGE_ERROR!>res2<!>
|
||||
for (c in <!EXPERIMENTAL_API_USAGE_ERROR!>a<!>) {}
|
||||
}
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
package
|
||||
|
||||
public val x: kotlin.String
|
||||
public fun main(): kotlin.Unit
|
||||
public fun my(/*0*/ my: My /* = Some */): kotlin.Unit
|
||||
public fun operatorContainerUsage(/*0*/ s: kotlin.String, /*1*/ a: AnotherContainer): kotlin.Unit
|
||||
public fun use(/*0*/ arg: NotExperimentalExtension): kotlin.Unit
|
||||
public fun useDataClass(/*0*/ d: DataClass): kotlin.Unit
|
||||
public fun your(/*0*/ my: Some): kotlin.Unit
|
||||
@kotlin.OptIn(markerClass = {Marker::class}) public operator fun kotlin.String.invoke(): OperatorContainer
|
||||
@kotlin.OptIn(markerClass = {Marker::class}) public operator fun kotlin.String.minus(/*0*/ s: kotlin.String): OperatorContainer
|
||||
|
||||
@kotlin.OptIn(markerClass = {Marker::class}) public final class A : I {
|
||||
public constructor A()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.OptIn(markerClass = {Marker::class}) public final class AnotherContainer : kotlin.collections.Iterable<C> {
|
||||
public constructor AnotherContainer()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
@kotlin.OptIn(markerClass = {Marker::class}) public open override /*1*/ fun iterator(): kotlin.collections.Iterator<C>
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.OptIn(markerClass = {Marker::class}) public final class B : I {
|
||||
public constructor B()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@Marker public final class C {
|
||||
public constructor C()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final operator fun getValue(/*0*/ x: kotlin.Any?, /*1*/ y: kotlin.Any?): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final data class DataClass {
|
||||
public constructor DataClass(/*0*/ x: kotlin.Int)
|
||||
@Marker public final val x: kotlin.Int
|
||||
public final operator /*synthesized*/ fun component1(): kotlin.Int
|
||||
public final /*synthesized*/ fun copy(/*0*/ x: kotlin.Int = ...): DataClass
|
||||
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@Marker public interface ExperimentalType {
|
||||
public open fun bar(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@Marker public interface I {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.RequiresOptIn @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class Marker : kotlin.Annotation {
|
||||
public constructor Marker()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.OptIn(markerClass = {Marker::class}) public interface NotExperimentalExtension : ExperimentalType {
|
||||
public open override /*1*/ /*fake_override*/ fun bar(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public object O {
|
||||
private constructor O()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
@kotlin.OptIn(markerClass = {Marker::class}) public final operator fun provideDelegate(/*0*/ x: kotlin.Any?, /*1*/ y: kotlin.Any?): C
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@Marker public final class OperatorContainer : kotlin.Comparable<OperatorContainer> {
|
||||
public constructor OperatorContainer()
|
||||
@kotlin.OptIn(markerClass = {Marker::class}) public open override /*1*/ fun compareTo(/*0*/ other: OperatorContainer): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@Marker public interface Some {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public abstract class User {
|
||||
public constructor User()
|
||||
public abstract fun createSome(): Some
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
public final fun use(): kotlin.Unit
|
||||
public final fun withSome(/*0*/ some: Some? = ...): kotlin.Unit
|
||||
public final fun Some?.onSome(): kotlin.Unit
|
||||
}
|
||||
public typealias My = Some
|
||||
|
||||
Generated
+6
@@ -34405,6 +34405,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/fullFqNameUsage.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("implicitUsages.kt")
|
||||
public void testImplicitUsages() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/implicitUsages.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("importStatement.kt")
|
||||
public void testImportStatement() throws Exception {
|
||||
|
||||
@@ -16,6 +16,7 @@ import kotlin.reflect.KClass
|
||||
class KtQuickFixesList @ForKtQuickFixesListBuilder @OptIn(PrivateForInline::class) constructor(
|
||||
private val quickFixes: Map<KClass<out KtDiagnosticWithPsi<*>>, List<HLQuickFixFactory>>
|
||||
) {
|
||||
@OptIn(PrivateForInline::class)
|
||||
fun KtAnalysisSession.getQuickFixesFor(diagnostic: KtDiagnosticWithPsi<*>): List<IntentionAction> {
|
||||
val factories = quickFixes[diagnostic.diagnosticClass] ?: return emptyList()
|
||||
return factories.flatMap { createQuickFixes(it, diagnostic) }
|
||||
|
||||
+5
@@ -30126,6 +30126,11 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/fullFqNameUsage.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("implicitUsages.kt")
|
||||
public void testImplicitUsages() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/implicitUsages.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("importStatement.kt")
|
||||
public void testImportStatement() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/importStatement.kt");
|
||||
|
||||
@@ -4,7 +4,7 @@ import lib.*
|
||||
|
||||
fun fail(foo: <error>Foo</error>): <error>Foo</error> {
|
||||
<error>bar</error>()
|
||||
return foo
|
||||
return <error>foo</error>
|
||||
}
|
||||
|
||||
@ExperimentalAPI
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import lib.*
|
||||
|
||||
fun fail(foo: <error>Foo</error>): <error>Foo</error> {
|
||||
<error>bar</error>()
|
||||
return foo
|
||||
return <error>foo</error>
|
||||
}
|
||||
|
||||
@ExperimentalAPI
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER,-UNUSED_VARIABLE
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER,-UNUSED_VARIABLE,-EXPERIMENTAL_API_USAGE
|
||||
// SKIP_TXT
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
Reference in New Issue
Block a user