Migrate UseExperimental->OptIn in project sources

This commit is contained in:
Alexander Udalov
2020-01-28 15:35:42 +01:00
parent 125b39d9be
commit 795d6ab407
164 changed files with 213 additions and 211 deletions
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.types.replace
import org.jetbrains.kotlin.utils.DFS
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
@UseExperimental(TypeRefinement::class)
@OptIn(TypeRefinement::class)
class KotlinTypeRefinerImpl(
private val moduleDescriptor: ModuleDescriptor,
storageManager: StorageManager
@@ -20,7 +20,7 @@ import org.jetbrains.kotlin.resolve.calls.tower.ImplicitScopeTower
import org.jetbrains.kotlin.resolve.calls.tower.NewResolutionOldInference
import org.jetbrains.kotlin.resolve.scopes.ResolutionScope
@UseExperimental(InternalNonStableExtensionPoints::class)
@OptIn(InternalNonStableExtensionPoints::class)
class CandidateInterceptor(project: Project) {
private val extensions = getInstances(project)
@@ -23,12 +23,13 @@ import org.jetbrains.kotlin.resolve.scopes.ResolutionScope
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.expressions.ExpressionTypingContext
/**
* This is marker for non-stable experimental extension points.
* Extension points marked with this meta-annotation will be broken in the future version.
* Please do not use them in general code.
*/
@RequiresOptIn(level = RequiresOptIn.Level.ERROR)
@Suppress("DEPRECATION")
@Experimental(level = Experimental.Level.ERROR)
@Retention(AnnotationRetention.BINARY)
internal annotation class InternalNonStableExtensionPoints
@@ -13,7 +13,7 @@ import org.jetbrains.kotlin.psi.KtLambdaExpression
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.expressions.ExpressionTypingContext
@UseExperimental(InternalNonStableExtensionPoints::class)
@OptIn(InternalNonStableExtensionPoints::class)
class TypeResolutionInterceptor(project: Project) {
private val extensions = getInstances(project)
@@ -918,7 +918,7 @@ class OverrideResolver(
declaringClass: ClassDescriptor,
kotlinTypeRefiner: KotlinTypeRefiner
): CallableMemberDescriptor? {
@UseExperimental(TypeRefinement::class)
@OptIn(TypeRefinement::class)
for (supertype in kotlinTypeRefiner.refineSupertypes(declaringClass)) {
val all = linkedSetOf<CallableMemberDescriptor>()
all.addAll(supertype.memberScope.getContributedFunctions(declared.name, NoLookupLocation.WHEN_CHECK_OVERRIDES))
@@ -378,7 +378,7 @@ class CallExpressionResolver(
val selector = element.selector
@UseExperimental(TypeRefinement::class)
@OptIn(TypeRefinement::class)
var selectorTypeInfo =
getUnsafeSelectorTypeInfo(receiver, callOperationNode, selector, context, initialDataFlowInfoForArguments)
.run {
@@ -151,7 +151,7 @@ class KotlinResolutionCallbacksImpl(
// Also note that refining the whole type might be undesired because sometimes it contains NO_EXPECTED_TYPE
// which throws exceptions on attempt to call equals
val refinedReceiverType = receiverType?.let {
@UseExperimental(TypeRefinement::class) callComponents.kotlinTypeChecker.kotlinTypeRefiner.refineType(it)
@OptIn(TypeRefinement::class) callComponents.kotlinTypeChecker.kotlinTypeRefiner.refineType(it)
}
val expectedType = createFunctionType(
@@ -100,7 +100,7 @@ open class LazyClassMemberScope(
}
val supertypes by storageManager.createLazyValue {
@UseExperimental(TypeRefinement::class)
@OptIn(TypeRefinement::class)
kotlinTypeRefiner.refineSupertypes(thisDescriptor)
}
@@ -83,7 +83,7 @@ private fun KotlinTypeRefiner.refineBareType(type: PossiblyBareType): PossiblyBa
return PossiblyBareType.type(newType)
}
@UseExperimental(TypeRefinement::class)
@OptIn(TypeRefinement::class)
private fun <T : DoubleColonLHS> KotlinTypeRefiner.refineLHS(lhs: T): T = when (lhs) {
is DoubleColonLHS.Expression -> {
val newType = lhs.typeInfo.type?.let { refineType(it) }
@@ -373,7 +373,7 @@ class DoubleColonExpressionResolver(
val resultForType = tryResolveLHS(doubleColonExpression, c, this::shouldTryResolveLHSAsType) { expression, context ->
resolveTypeOnLHS(expression, doubleColonExpression, context)?.let {
// If lhs is not expression then ExpressionTypingVisitor don't refine it's type and we should do this manually
@UseExperimental(TypeRefinement::class)
@OptIn(TypeRefinement::class)
DoubleColonLHS.Type(kotlinTypeRefiner.refineType(it.type), kotlinTypeRefiner.refineBareType(it.possiblyBareType))
}
}