Rename RestrictsSuspendExtensions -> RestrictsSuspension
This commit is contained in:
+9
-9
@@ -31,7 +31,7 @@ import org.jetbrains.kotlin.psi.KtExpression
|
||||
import org.jetbrains.kotlin.psi.KtThisExpression
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.hasRestrictsSuspendExtensionsAnnotation
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.hasRestrictsSuspensionAnnotation
|
||||
import org.jetbrains.kotlin.resolve.inline.InlineUtil
|
||||
import org.jetbrains.kotlin.resolve.scopes.LexicalScope
|
||||
import org.jetbrains.kotlin.resolve.scopes.LexicalScopeKind
|
||||
@@ -67,7 +67,7 @@ object CoroutineSuspendCallChecker : CallChecker {
|
||||
// Here we only record enclosing function mapping (for backends purposes)
|
||||
context.trace.record(BindingContext.ENCLOSING_SUSPEND_FUNCTION_FOR_SUSPEND_FUNCTION_CALL, resolvedCall.call, enclosingSuspendFunction)
|
||||
|
||||
checkRestrictsSuspendExtensions(enclosingSuspendFunction, resolvedCall, reportOn, context)
|
||||
checkRestrictsSuspension(enclosingSuspendFunction, resolvedCall, reportOn, context)
|
||||
}
|
||||
closestSuspensionLambdaDescriptor != null -> {
|
||||
val callElement = resolvedCall.call.callElement as KtExpression
|
||||
@@ -80,7 +80,7 @@ object CoroutineSuspendCallChecker : CallChecker {
|
||||
BindingContext.ENCLOSING_SUSPEND_LAMBDA_FOR_SUSPENSION_POINT, resolvedCall.call, closestSuspensionLambdaDescriptor
|
||||
)
|
||||
|
||||
checkRestrictsSuspendExtensions(closestSuspensionLambdaDescriptor, resolvedCall, reportOn, context)
|
||||
checkRestrictsSuspension(closestSuspensionLambdaDescriptor, resolvedCall, reportOn, context)
|
||||
}
|
||||
else -> {
|
||||
context.trace.report(Errors.ILLEGAL_SUSPEND_FUNCTION_CALL.on(reportOn))
|
||||
@@ -110,7 +110,7 @@ fun checkCoroutinesFeature(languageVersionSettings: LanguageVersionSettings, dia
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkRestrictsSuspendExtensions(
|
||||
private fun checkRestrictsSuspension(
|
||||
enclosingCallableDescriptor: CallableDescriptor,
|
||||
resolvedCall: ResolvedCall<*>,
|
||||
reportOn: PsiElement,
|
||||
@@ -118,8 +118,8 @@ private fun checkRestrictsSuspendExtensions(
|
||||
) {
|
||||
val enclosingSuspendReceiverValue = enclosingCallableDescriptor.extensionReceiverParameter?.value ?: return
|
||||
|
||||
fun ReceiverValue.isRestrictsSuspendExtensionsReceiver() = (type.supertypes() + type).any {
|
||||
it.constructor.declarationDescriptor?.hasRestrictsSuspendExtensionsAnnotation() == true
|
||||
fun ReceiverValue.isRestrictsSuspensionReceiver() = (type.supertypes() + type).any {
|
||||
it.constructor.declarationDescriptor?.hasRestrictsSuspensionAnnotation() == true
|
||||
}
|
||||
|
||||
infix fun ReceiverValue.sameInstance(other: ReceiverValue?): Boolean {
|
||||
@@ -134,13 +134,13 @@ private fun checkRestrictsSuspendExtensions(
|
||||
return this === (referenceTarget as? CallableDescriptor)?.extensionReceiverParameter?.value
|
||||
}
|
||||
|
||||
if (!enclosingSuspendReceiverValue.isRestrictsSuspendExtensionsReceiver()) return
|
||||
if (!enclosingSuspendReceiverValue.isRestrictsSuspensionReceiver()) return
|
||||
|
||||
// member of suspend receiver
|
||||
if (enclosingSuspendReceiverValue sameInstance resolvedCall.dispatchReceiver) return
|
||||
|
||||
if (enclosingSuspendReceiverValue sameInstance resolvedCall.extensionReceiver &&
|
||||
resolvedCall.candidateDescriptor.extensionReceiverParameter!!.value.isRestrictsSuspendExtensionsReceiver()) return
|
||||
resolvedCall.candidateDescriptor.extensionReceiverParameter!!.value.isRestrictsSuspensionReceiver()) return
|
||||
|
||||
context.trace.report(Errors.ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL.on(reportOn))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ package-fragment kotlin.coroutines
|
||||
public final inline suspend fun </*0*/ T> suspendCoroutineOrReturn(/*0*/ block: (kotlin.coroutines.Continuation<T>) -> kotlin.Any?): T
|
||||
}
|
||||
|
||||
@kotlin.SinceKotlin(version = "1.1") @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS}) @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class RestrictsSuspendExtensions : kotlin.Annotation {
|
||||
/*primary*/ public constructor RestrictsSuspendExtensions()
|
||||
@kotlin.SinceKotlin(version = "1.1") @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS}) @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class RestrictsSuspension : kotlin.Annotation {
|
||||
/*primary*/ public constructor RestrictsSuspension()
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ interface SuperInterface {
|
||||
suspend fun String.superExtFun() {}
|
||||
}
|
||||
|
||||
@kotlin.coroutines.RestrictsSuspendExtensions
|
||||
@kotlin.coroutines.RestrictsSuspension
|
||||
open class RestrictedController : SuperInterface {
|
||||
suspend fun memberFun() {}
|
||||
suspend fun String.memberExtFun() {}
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ public fun generate2(/*0*/ f: suspend RestrictedController.() -> kotlin.Unit): k
|
||||
public fun generate3(/*0*/ f: suspend SubClass.() -> kotlin.Unit): kotlin.Unit
|
||||
public fun kotlin.String.test(): kotlin.Unit
|
||||
|
||||
@kotlin.coroutines.RestrictsSuspendExtensions public open class RestrictedController : SuperInterface {
|
||||
@kotlin.coroutines.RestrictsSuspension public open class RestrictedController : SuperInterface {
|
||||
public constructor RestrictedController()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
interface SuperInterface
|
||||
|
||||
@kotlin.coroutines.RestrictsSuspendExtensions
|
||||
@kotlin.coroutines.RestrictsSuspension
|
||||
open class RestrictedController : SuperInterface
|
||||
|
||||
class SubClass : RestrictedController()
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ public final class A {
|
||||
public final suspend fun SuperInterface.memExtSuper(): kotlin.Unit
|
||||
}
|
||||
|
||||
@kotlin.coroutines.RestrictsSuspendExtensions public open class RestrictedController : SuperInterface {
|
||||
@kotlin.coroutines.RestrictsSuspension public open class RestrictedController : SuperInterface {
|
||||
public constructor RestrictedController()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
interface SuperInterface
|
||||
|
||||
@kotlin.coroutines.RestrictsSuspendExtensions
|
||||
@kotlin.coroutines.RestrictsSuspension
|
||||
open class RestrictedController : SuperInterface
|
||||
|
||||
class SubClass : RestrictedController()
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ public final class A {
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.coroutines.RestrictsSuspendExtensions public open class RestrictedController : SuperInterface {
|
||||
@kotlin.coroutines.RestrictsSuspension public open class RestrictedController : SuperInterface {
|
||||
public constructor RestrictedController()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -SUSPENSION_CALL_MUST_BE_USED_AS_RETURN_VALUE
|
||||
|
||||
@kotlin.coroutines.RestrictsSuspendExtensions
|
||||
@kotlin.coroutines.RestrictsSuspension
|
||||
class RestrictedController {
|
||||
suspend fun member() {}
|
||||
}
|
||||
@@ -50,4 +50,4 @@ suspend fun RestrictedController.l() {
|
||||
this@l.extension()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ public fun test(): kotlin.Unit
|
||||
public suspend fun RestrictedController.extension(): kotlin.Unit
|
||||
public suspend fun RestrictedController.l(): kotlin.Unit
|
||||
|
||||
@kotlin.coroutines.RestrictsSuspendExtensions public final class RestrictedController {
|
||||
@kotlin.coroutines.RestrictsSuspension public final class RestrictedController {
|
||||
public constructor RestrictedController()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
@kotlin.coroutines.RestrictsSuspendExtensions
|
||||
@kotlin.coroutines.RestrictsSuspension
|
||||
class RestrictedController
|
||||
|
||||
suspend fun Any?.extFun() {}
|
||||
@@ -11,4 +11,4 @@ fun test() {
|
||||
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>extFun<!>()
|
||||
<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>suspendFun<!>()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ public suspend fun suspendFun(): kotlin.Unit
|
||||
public fun test(): kotlin.Unit
|
||||
public suspend fun kotlin.Any?.extFun(): kotlin.Unit
|
||||
|
||||
@kotlin.coroutines.RestrictsSuspendExtensions public final class RestrictedController {
|
||||
@kotlin.coroutines.RestrictsSuspension public final class RestrictedController {
|
||||
public constructor RestrictedController()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
@@ -59,7 +59,7 @@ public interface ContinuationDispatcher {
|
||||
@SinceKotlin("1.1")
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
public annotation class RestrictsSuspendExtensions
|
||||
public annotation class RestrictsSuspension
|
||||
|
||||
/**
|
||||
* Contains intrinsic functions for coroutines.
|
||||
|
||||
@@ -32,7 +32,7 @@ val LOW_PRIORITY_IN_OVERLOAD_RESOLUTION_FQ_NAME = FqName("kotlin.internal.LowPri
|
||||
private val HIDES_MEMBERS_ANNOTATION_FQ_NAME = FqName("kotlin.internal.HidesMembers")
|
||||
private val ONLY_INPUT_TYPES_FQ_NAME = FqName("kotlin.internal.OnlyInputTypes")
|
||||
private val DYNAMIC_EXTENSION_FQ_NAME = FqName("kotlin.internal.DynamicExtension")
|
||||
private val RESTRICTS_SUSPEND_EXTENSIONS_FQ_NAME = FqName("kotlin.coroutines.RestrictsSuspendExtensions")
|
||||
private val RESTRICTS_SUSPENSION_FQ_NAME = FqName("kotlin.coroutines.RestrictsSuspension")
|
||||
|
||||
// @HidesMembers annotation only has effect for members with these names
|
||||
val HIDES_MEMBERS_NAME_LIST = setOf(Name.identifier("forEach"))
|
||||
@@ -50,7 +50,7 @@ fun CallableDescriptor.hasLowPriorityInOverloadResolution(): Boolean = annotatio
|
||||
|
||||
fun CallableDescriptor.hasHidesMembersAnnotation(): Boolean = annotations.hasAnnotation(HIDES_MEMBERS_ANNOTATION_FQ_NAME)
|
||||
fun CallableDescriptor.hasDynamicExtensionAnnotation(): Boolean = annotations.hasAnnotation(DYNAMIC_EXTENSION_FQ_NAME)
|
||||
fun ClassifierDescriptor.hasRestrictsSuspendExtensionsAnnotation(): Boolean = annotations.hasAnnotation(RESTRICTS_SUSPEND_EXTENSIONS_FQ_NAME)
|
||||
fun ClassifierDescriptor.hasRestrictsSuspensionAnnotation(): Boolean = annotations.hasAnnotation(RESTRICTS_SUSPENSION_FQ_NAME)
|
||||
|
||||
fun TypeParameterDescriptor.hasOnlyInputTypesAnnotation(): Boolean = annotations.hasAnnotation(ONLY_INPUT_TYPES_FQ_NAME)
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
<node text="Retention (kotlin.annotation)"/>
|
||||
<node text="Repeatable (kotlin.annotation)"/>
|
||||
<node text="MustBeDocumented (kotlin.annotation)"/>
|
||||
<node text="RestrictsSuspendExtensions (kotlin.coroutines)"/>
|
||||
<node text="RestrictsSuspension (kotlin.coroutines)"/>
|
||||
<node text="ExtensionFunctionType (kotlin)"/>
|
||||
<node text="Metadata (kotlin)"/>
|
||||
<node text="DslMarker (kotlin)"/>
|
||||
|
||||
+1
-1
@@ -204,7 +204,7 @@ public final class kotlin/coroutines/CoroutinesKt {
|
||||
public static final fun suspendWithCurrentContinuation (Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
}
|
||||
|
||||
public abstract interface annotation class kotlin/coroutines/RestrictsSuspendExtensions : java/lang/annotation/Annotation {
|
||||
public abstract interface annotation class kotlin/coroutines/RestrictsSuspension : java/lang/annotation/Annotation {
|
||||
}
|
||||
|
||||
public final class kotlin/jvm/JvmClassMappingKt {
|
||||
|
||||
Reference in New Issue
Block a user