[FIR] Generify resolution and inference of arguments of functional types
This commit is contained in:
committed by
Space Team
parent
67aa80562d
commit
d1b797ed97
+5
-1
@@ -85,6 +85,8 @@ abstract class FunctionalTypeKind internal constructor(
|
||||
|
||||
fun numberedClassName(arity: Int): Name = Name.identifier("$classNamePrefix$arity")
|
||||
|
||||
fun numberedClassId(arity: Int): ClassId = ClassId(packageFqName, numberedClassName(arity))
|
||||
|
||||
override fun toString(): String {
|
||||
return "$packageFqName.${classNamePrefix}N"
|
||||
}
|
||||
@@ -141,5 +143,7 @@ val FunctionalTypeKind.isBuiltin: Boolean
|
||||
}
|
||||
|
||||
val FunctionalTypeKind.isSuspendType: Boolean
|
||||
get() = this == FunctionalTypeKind.SuspendFunction || this == FunctionalTypeKind.KSuspendFunction
|
||||
get() = this.nonReflectKind() == FunctionalTypeKind.SuspendFunction
|
||||
|
||||
val FunctionalTypeKind.isRegularFunction: Boolean
|
||||
get() = this.nonReflectKind() == FunctionalTypeKind.Function
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.types.model
|
||||
|
||||
import org.jetbrains.kotlin.builtins.functions.FunctionalTypeKind
|
||||
import org.jetbrains.kotlin.resolve.checkers.EmptyIntersectionTypeChecker
|
||||
import org.jetbrains.kotlin.resolve.checkers.EmptyIntersectionTypeInfo
|
||||
import org.jetbrains.kotlin.types.*
|
||||
@@ -247,9 +248,11 @@ interface TypeSystemInferenceExtensionContext : TypeSystemContext, TypeSystemBui
|
||||
|
||||
fun KotlinTypeMarker.isSignedOrUnsignedNumberType(): Boolean
|
||||
|
||||
// ------------- functional type utils -------------
|
||||
|
||||
fun KotlinTypeMarker.isFunctionOrKFunctionWithAnySuspendability(): Boolean
|
||||
|
||||
fun KotlinTypeMarker.isSuspendFunctionTypeOrSubtype(): Boolean
|
||||
fun KotlinTypeMarker.functionalTypeKind(): FunctionalTypeKind?
|
||||
|
||||
fun KotlinTypeMarker.isExtensionFunctionType(): Boolean
|
||||
|
||||
@@ -257,12 +260,14 @@ interface TypeSystemInferenceExtensionContext : TypeSystemContext, TypeSystemBui
|
||||
|
||||
fun KotlinTypeMarker.getFunctionalTypeFromSupertypes(): KotlinTypeMarker
|
||||
|
||||
fun getNonReflectFunctionTypeConstructor(parametersNumber: Int, kind: FunctionalTypeKind): TypeConstructorMarker
|
||||
|
||||
fun getReflectFunctionTypeConstructor(parametersNumber: Int, kind: FunctionalTypeKind): TypeConstructorMarker
|
||||
|
||||
// -------------------------------------------------
|
||||
|
||||
fun StubTypeMarker.getOriginalTypeVariable(): TypeVariableTypeConstructorMarker
|
||||
|
||||
fun getFunctionTypeConstructor(parametersNumber: Int, isSuspend: Boolean): TypeConstructorMarker
|
||||
|
||||
fun getKFunctionTypeConstructor(parametersNumber: Int, isSuspend: Boolean): TypeConstructorMarker
|
||||
|
||||
private fun <T> KotlinTypeMarker.extractTypeOf(to: MutableSet<T>, getIfApplicable: (TypeConstructorMarker) -> T?) {
|
||||
for (i in 0 until argumentsCount()) {
|
||||
val argument = getArgument(i)
|
||||
|
||||
Reference in New Issue
Block a user