[FIR] Prepare commonization of PostponedArgumentInputTypesResolver

This commit is contained in:
Pavel Kirpichenkov
2020-09-17 18:14:16 +03:00
parent 0685beb765
commit 3822a32fce
12 changed files with 443 additions and 208 deletions
@@ -5,7 +5,11 @@
package org.jetbrains.kotlin.resolve.calls.inference.components
import org.jetbrains.kotlin.resolve.calls.inference.model.ArgumentConstraintPosition
import org.jetbrains.kotlin.resolve.calls.inference.model.FixVariableConstraintPosition
import org.jetbrains.kotlin.resolve.calls.model.PostponedAtomWithRevisableExpectedType
import org.jetbrains.kotlin.types.model.KotlinTypeMarker
import org.jetbrains.kotlin.types.model.TypeConstructorMarker
import org.jetbrains.kotlin.types.model.TypeVariableMarker
/*
@@ -19,4 +23,25 @@ interface ConstraintSystemUtilContext {
fun KotlinTypeMarker.unCapture(): KotlinTypeMarker
fun TypeVariableMarker.isReified(): Boolean
fun KotlinTypeMarker.refineType(): KotlinTypeMarker
// PostponedArgumentInputTypesResolver
fun extractFunctionalTypeFromSupertypes(type: KotlinTypeMarker): KotlinTypeMarker
fun KotlinTypeMarker.extractArgumentsForFunctionalTypeOrSubtype(): List<KotlinTypeMarker>
fun KotlinTypeMarker.isFunctionOrKFunctionTypeWithAnySuspendability(): Boolean
fun KotlinTypeMarker.isSuspendFunctionTypeOrSubtype(): Boolean
fun <T> createArgumentConstraintPosition(argument: T): ArgumentConstraintPosition<T>
fun <T> createFixVariableConstraintPosition(variable: TypeVariableMarker, atom: T): FixVariableConstraintPosition<T>
fun extractParameterTypesFromDeclaration(declaration: PostponedAtomWithRevisableExpectedType): List<KotlinTypeMarker?>?
fun KotlinTypeMarker.isExtensionFunctionType(): Boolean
fun getFunctionTypeConstructor(parametersNumber: Int, isSuspend: Boolean): TypeConstructorMarker
fun getKFunctionTypeConstructor(parametersNumber: Int, isSuspend: Boolean): TypeConstructorMarker
fun isAnonymousFunction(argument: PostponedAtomWithRevisableExpectedType): Boolean
fun PostponedAtomWithRevisableExpectedType.isFunctionExpressionWithReceiver(): Boolean
fun createTypeVariableForLambdaReturnType(): TypeVariableMarker
fun createTypeVariableForLambdaParameterType(argument: PostponedAtomWithRevisableExpectedType, index: Int): TypeVariableMarker
fun createTypeVariableForCallableReferenceParameterType(
argument: PostponedAtomWithRevisableExpectedType,
index: Int
): TypeVariableMarker
fun createTypeVariableForCallableReferenceReturnType(): TypeVariableMarker
}
@@ -10,5 +10,20 @@ import org.jetbrains.kotlin.types.model.KotlinTypeMarker
interface PostponedResolvedAtomMarker {
val inputTypes: Collection<KotlinTypeMarker>
val outputType: KotlinTypeMarker?
val expectedType: KotlinTypeMarker?
val analyzed: Boolean
}
interface PostponedAtomWithRevisableExpectedType : PostponedResolvedAtomMarker {
val revisedExpectedType: KotlinTypeMarker?
fun reviseExpectedType(expectedType: KotlinTypeMarker)
}
interface PostponedCallableReferenceMarker : PostponedAtomWithRevisableExpectedType
interface LambdaWithTypeVariableAsExpectedTypeMarker : PostponedAtomWithRevisableExpectedType {
val parameterTypesFromDeclaration: List<KotlinTypeMarker?>?
fun updateParameterTypesFromDeclaration(types: List<KotlinTypeMarker?>?)
}