Minor. Rename FunctionClassDescriptor#functionKind -> functionTypeKind
This commit is needed for the following commit. There we will restore the compatibility API with Android IDEA plugin
This commit is contained in:
committed by
Space Team
parent
a14f3c8cc2
commit
bec9ad0f6b
+8
-8
@@ -52,10 +52,10 @@ internal class KtFe10FunctionalType(
|
||||
}
|
||||
|
||||
override val isSuspend: Boolean
|
||||
get() = withValidityAssertion { descriptor.functionKind.isSuspendOrKSuspendFunction }
|
||||
get() = withValidityAssertion { descriptor.functionTypeKind.isSuspendOrKSuspendFunction }
|
||||
|
||||
override val isReflectType: Boolean
|
||||
get() = withValidityAssertion { descriptor.functionKind.isReflectType }
|
||||
get() = withValidityAssertion { descriptor.functionTypeKind.isReflectType }
|
||||
|
||||
override val arity: Int
|
||||
get() = withValidityAssertion { descriptor.arity }
|
||||
@@ -78,20 +78,20 @@ internal class KtFe10FunctionalType(
|
||||
|
||||
override val hasReceiver: Boolean
|
||||
get() = withValidityAssertion {
|
||||
if (descriptor.functionKind.isReflectType) false
|
||||
if (descriptor.functionTypeKind.isReflectType) false
|
||||
else fe10Type.getReceiverTypeFromFunctionType() != null
|
||||
}
|
||||
|
||||
override val receiverType: KtType?
|
||||
get() = withValidityAssertion {
|
||||
if (descriptor.functionKind.isReflectType) null
|
||||
if (descriptor.functionTypeKind.isReflectType) null
|
||||
else fe10Type.getReceiverTypeFromFunctionType()?.toKtType(analysisContext)
|
||||
}
|
||||
|
||||
override val parameterTypes: List<KtType>
|
||||
get() = withValidityAssertion {
|
||||
when {
|
||||
descriptor.functionKind.isReflectType -> fe10Type.arguments.dropLast(1)
|
||||
descriptor.functionTypeKind.isReflectType -> fe10Type.arguments.dropLast(1)
|
||||
else -> fe10Type.getValueParameterTypesFromFunctionType()
|
||||
}.map { it.type.toKtType(analysisContext) }
|
||||
}
|
||||
@@ -99,7 +99,7 @@ internal class KtFe10FunctionalType(
|
||||
override val returnType: KtType
|
||||
get() = withValidityAssertion {
|
||||
when {
|
||||
descriptor.functionKind.isReflectType -> fe10Type.arguments.last().type
|
||||
descriptor.functionTypeKind.isReflectType -> fe10Type.arguments.last().type
|
||||
else -> fe10Type.getReturnTypeFromFunctionType()
|
||||
}.toKtType(analysisContext)
|
||||
}
|
||||
@@ -107,8 +107,8 @@ internal class KtFe10FunctionalType(
|
||||
override val classId: ClassId
|
||||
get() = withValidityAssertion {
|
||||
ClassId(
|
||||
descriptor.functionKind.packageFqName,
|
||||
descriptor.functionKind.numberedClassName(descriptor.arity)
|
||||
descriptor.functionTypeKind.packageFqName,
|
||||
descriptor.functionTypeKind.numberedClassName(descriptor.arity)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ internal class KtFe10TypeSystemCommonBackendContextForTypeMapping(
|
||||
override fun SimpleTypeMarker.isSuspendFunction(): Boolean {
|
||||
require(this is SimpleType)
|
||||
val declaration = constructor.declarationDescriptor
|
||||
return declaration is FunctionClassDescriptor && declaration.functionKind.isSuspendOrKSuspendFunction
|
||||
return declaration is FunctionClassDescriptor && declaration.functionTypeKind.isSuspendOrKSuspendFunction
|
||||
}
|
||||
|
||||
override fun SimpleTypeMarker.isKClass(): Boolean {
|
||||
|
||||
@@ -342,8 +342,8 @@ class KotlinTypeMapper @JvmOverloads constructor(
|
||||
|
||||
if (classDescriptor is FunctionClassDescriptor) {
|
||||
if (classDescriptor.hasBigArity ||
|
||||
classDescriptor.functionKind == FunctionTypeKind.KFunction ||
|
||||
classDescriptor.functionKind == FunctionTypeKind.KSuspendFunction
|
||||
classDescriptor.functionTypeKind == FunctionTypeKind.KFunction ||
|
||||
classDescriptor.functionTypeKind == FunctionTypeKind.KSuspendFunction
|
||||
) {
|
||||
// kotlin.reflect.KFunction{n}<P1, ..., Pn, R> is mapped to kotlin.reflect.KFunction<R> (for all n), and
|
||||
// kotlin.Function{n}<P1, ..., Pn, R> is mapped to kotlin.jvm.functions.FunctionN<R> (for n > 22).
|
||||
|
||||
+4
-4
@@ -22,14 +22,14 @@ object SuspendFunctionAsSupertypeChecker : DeclarationChecker {
|
||||
val functionalSupertypes = descriptor.getAllSuperClassifiers().filterIsInstance<FunctionClassDescriptor>().toList()
|
||||
|
||||
if (functionalSupertypes.none {
|
||||
it.functionKind == FunctionTypeKind.SuspendFunction ||
|
||||
it.functionKind == FunctionTypeKind.KSuspendFunction
|
||||
it.functionTypeKind == FunctionTypeKind.SuspendFunction ||
|
||||
it.functionTypeKind == FunctionTypeKind.KSuspendFunction
|
||||
}
|
||||
) return
|
||||
|
||||
if (functionalSupertypes.any {
|
||||
it.functionKind == FunctionTypeKind.Function ||
|
||||
it.functionKind == FunctionTypeKind.KFunction
|
||||
it.functionTypeKind == FunctionTypeKind.Function ||
|
||||
it.functionTypeKind == FunctionTypeKind.KFunction
|
||||
}
|
||||
) {
|
||||
val reportOn = (declaration as? KtClassOrObject)?.getSuperTypeList() ?: declaration
|
||||
|
||||
+3
-3
@@ -31,9 +31,9 @@ import org.jetbrains.kotlin.utils.addToStdlib.shouldNotBeCalled
|
||||
class FunctionClassDescriptor(
|
||||
private val storageManager: StorageManager,
|
||||
private val containingDeclaration: PackageFragmentDescriptor,
|
||||
val functionKind: FunctionTypeKind,
|
||||
val functionTypeKind: FunctionTypeKind,
|
||||
val arity: Int
|
||||
) : AbstractClassDescriptor(storageManager, functionKind.numberedClassName(arity)) {
|
||||
) : AbstractClassDescriptor(storageManager, functionTypeKind.numberedClassName(arity)) {
|
||||
|
||||
private val typeConstructor = FunctionTypeConstructor()
|
||||
private val memberScope = FunctionClassScope(storageManager, this)
|
||||
@@ -95,7 +95,7 @@ class FunctionClassDescriptor(
|
||||
private inner class FunctionTypeConstructor : AbstractClassTypeConstructor(storageManager) {
|
||||
override fun computeSupertypes(): Collection<KotlinType> {
|
||||
// For K{Suspend}Function{n}, add corresponding numbered {Suspend}Function{n} class, e.g. {Suspend}Function2 for K{Suspend}Function2
|
||||
val supertypes = when (functionKind) {
|
||||
val supertypes = when (functionTypeKind) {
|
||||
FunctionTypeKind.Function -> // Function$N <: Function
|
||||
listOf(functionClassId)
|
||||
FunctionTypeKind.KFunction -> // KFunction$N <: KFunction
|
||||
|
||||
@@ -25,7 +25,7 @@ class FunctionClassScope(
|
||||
containingClass: FunctionClassDescriptor
|
||||
) : GivenFunctionsMemberScope(storageManager, containingClass) {
|
||||
override fun computeDeclaredFunctions(): List<FunctionDescriptor> =
|
||||
when ((containingClass as FunctionClassDescriptor).functionKind) {
|
||||
when ((containingClass as FunctionClassDescriptor).functionTypeKind) {
|
||||
FunctionTypeKind.Function -> listOf(FunctionInvokeDescriptor.create(containingClass, isSuspend = false))
|
||||
FunctionTypeKind.SuspendFunction -> listOf(FunctionInvokeDescriptor.create(containingClass, isSuspend = true))
|
||||
else -> emptyList()
|
||||
|
||||
+1
-1
@@ -338,7 +338,7 @@ public final class ExpressionVisitor extends TranslatorVisitor<JsNode> {
|
||||
default: {
|
||||
if (descriptor instanceof FunctionClassDescriptor) {
|
||||
FunctionClassDescriptor functionClassDescriptor = (FunctionClassDescriptor) descriptor;
|
||||
if (functionClassDescriptor.getFunctionKind() == FunctionTypeKind.Function.INSTANCE) {
|
||||
if (functionClassDescriptor.getFunctionTypeKind() == FunctionTypeKind.Function.INSTANCE) {
|
||||
ClassDescriptor primitivesObject = findPrimitiveClassesObject(context);
|
||||
assert primitivesObject != null;
|
||||
FunctionDescriptor function = DescriptorUtils.getFunctionByName(
|
||||
|
||||
+1
-1
@@ -168,7 +168,7 @@ internal class BuiltInFictitiousFunctionIrClassFactory(
|
||||
|
||||
val builtFunctionNClasses get() = builtClassesMap.entries.mapNotNull { (descriptor, irClass) ->
|
||||
with(descriptor) {
|
||||
if (functionKind == FunctionTypeKind.Function)
|
||||
if (functionTypeKind == FunctionTypeKind.Function)
|
||||
FunctionalInterface(irClass, descriptor, arity)
|
||||
else null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user