Minor. Reformat some inference files
This commit is contained in:
committed by
Space Team
parent
9a6bff958f
commit
c163f86ecb
+9
-9
@@ -50,7 +50,7 @@ class ConstraintSystemCompleter(components: BodyResolveComponents, private val c
|
||||
candidateReturnType: ConeKotlinType,
|
||||
context: ResolutionContext,
|
||||
collectVariablesFromContext: Boolean = false,
|
||||
analyze: (PostponedResolvedAtom) -> Unit
|
||||
analyze: (PostponedResolvedAtom) -> Unit,
|
||||
) = c.runCompletion(completionMode, topLevelAtoms, candidateReturnType, context, collectVariablesFromContext, analyze)
|
||||
|
||||
private fun ConstraintSystemCompletionContext.runCompletion(
|
||||
@@ -59,7 +59,7 @@ class ConstraintSystemCompleter(components: BodyResolveComponents, private val c
|
||||
topLevelType: ConeKotlinType,
|
||||
context: ResolutionContext,
|
||||
collectVariablesFromContext: Boolean = false,
|
||||
analyze: (PostponedResolvedAtom) -> Unit
|
||||
analyze: (PostponedResolvedAtom) -> Unit,
|
||||
) {
|
||||
val topLevelTypeVariables = topLevelType.extractTypeVariables()
|
||||
|
||||
@@ -186,7 +186,7 @@ class ConstraintSystemCompleter(components: BodyResolveComponents, private val c
|
||||
topLevelType: ConeKotlinType,
|
||||
postponedArguments: List<PostponedResolvedAtom>,
|
||||
allTypeVariables: List<TypeConstructorMarker>,
|
||||
analyze: (PostponedResolvedAtom) -> Unit
|
||||
analyze: (PostponedResolvedAtom) -> Unit,
|
||||
): Boolean {
|
||||
if (completionMode != ConstraintSystemCompletionMode.FULL) return false
|
||||
|
||||
@@ -349,7 +349,7 @@ class ConstraintSystemCompleter(components: BodyResolveComponents, private val c
|
||||
|
||||
private fun ConstraintSystemCompletionContext.getOrderedAllTypeVariables(
|
||||
collectVariablesFromContext: Boolean,
|
||||
topLevelAtoms: List<FirStatement>
|
||||
topLevelAtoms: List<FirStatement>,
|
||||
): List<TypeConstructorMarker> {
|
||||
if (collectVariablesFromContext) {
|
||||
return notFixedTypeVariables.keys.toList()
|
||||
@@ -425,7 +425,7 @@ class ConstraintSystemCompleter(components: BodyResolveComponents, private val c
|
||||
|
||||
private fun fixVariable(
|
||||
c: ConstraintSystemCompletionContext,
|
||||
variableWithConstraints: VariableWithConstraints
|
||||
variableWithConstraints: VariableWithConstraints,
|
||||
) {
|
||||
val resultType = inferenceComponents.resultTypeResolver.findResultType(
|
||||
c,
|
||||
@@ -461,7 +461,7 @@ class ConstraintSystemCompleter(components: BodyResolveComponents, private val c
|
||||
|
||||
private fun findResolvedAtomBy(
|
||||
typeVariable: TypeVariableMarker,
|
||||
topLevelAtoms: List<FirStatement>
|
||||
topLevelAtoms: List<FirStatement>,
|
||||
): FirStatement? {
|
||||
|
||||
fun FirStatement.findFirstAtomContainingVariable(): FirStatement? {
|
||||
@@ -497,7 +497,7 @@ class ConstraintSystemCompleter(components: BodyResolveComponents, private val c
|
||||
private fun createCannotInferErrorType(
|
||||
typeParameterSymbol: FirTypeParameterSymbol?,
|
||||
message: String,
|
||||
isUninferredParameter: Boolean = false
|
||||
isUninferredParameter: Boolean = false,
|
||||
): ConeErrorType {
|
||||
val diagnostic = when (typeParameterSymbol) {
|
||||
null -> ConeSimpleDiagnostic(message, DiagnosticKind.CannotInferParameterType)
|
||||
@@ -506,7 +506,7 @@ class ConstraintSystemCompleter(components: BodyResolveComponents, private val c
|
||||
message,
|
||||
)
|
||||
}
|
||||
return ConeErrorType(diagnostic, isUninferredParameter,)
|
||||
return ConeErrorType(diagnostic, isUninferredParameter)
|
||||
}
|
||||
|
||||
|
||||
@@ -576,7 +576,7 @@ fun FirStatement.processAllContainingCallCandidates(processBlocks: Boolean, proc
|
||||
|
||||
private fun FirResolvable.processCandidateIfApplicable(
|
||||
processor: (Candidate) -> Unit,
|
||||
processBlocks: Boolean
|
||||
processBlocks: Boolean,
|
||||
) {
|
||||
val candidate = (calleeReference as? FirNamedReferenceWithCandidate)?.candidate ?: return
|
||||
processor(candidate)
|
||||
|
||||
+1
-1
@@ -244,7 +244,7 @@ fun LambdaWithTypeVariableAsExpectedTypeAtom.transformToResolvedLambda(
|
||||
csBuilder: ConstraintSystemBuilder,
|
||||
context: ResolutionContext,
|
||||
expectedType: ConeKotlinType? = null,
|
||||
returnTypeVariable: ConeTypeVariableForLambdaReturnType? = null
|
||||
returnTypeVariable: ConeTypeVariableForLambdaReturnType? = null,
|
||||
): ResolvedLambdaAtom {
|
||||
val fixedExpectedType = (csBuilder.buildCurrentSubstitutor() as ConeSubstitutor)
|
||||
.substituteOrSelf(expectedType ?: this.expectedType)
|
||||
|
||||
+11
-11
@@ -30,8 +30,7 @@ class NewConstraintSystemImpl(
|
||||
ConstraintSystemBuilder,
|
||||
ConstraintInjector.Context,
|
||||
ResultTypeResolver.Context,
|
||||
PostponedArgumentsAnalyzerContext
|
||||
{
|
||||
PostponedArgumentsAnalyzerContext {
|
||||
private val utilContext = constraintInjector.constraintIncorporator.utilContext
|
||||
|
||||
private val postponedComputationsAfterAllVariablesAreFixed = mutableListOf<() -> Unit>()
|
||||
@@ -122,7 +121,7 @@ class NewConstraintSystemImpl(
|
||||
|
||||
override fun addMissedConstraints(
|
||||
position: IncorporationConstraintPosition,
|
||||
constraints: MutableList<Pair<TypeVariableMarker, Constraint>>
|
||||
constraints: MutableList<Pair<TypeVariableMarker, Constraint>>,
|
||||
) {
|
||||
storage.missedConstraints.add(position to constraints)
|
||||
}
|
||||
@@ -172,21 +171,22 @@ class NewConstraintSystemImpl(
|
||||
override fun putBuiltFunctionalExpectedTypeForPostponedArgument(
|
||||
topLevelVariable: TypeConstructorMarker,
|
||||
pathToExpectedType: List<Pair<TypeConstructorMarker, Int>>,
|
||||
builtFunctionalType: KotlinTypeMarker
|
||||
builtFunctionalType: KotlinTypeMarker,
|
||||
) {
|
||||
storage.builtFunctionalTypesForPostponedArgumentsByTopLevelTypeVariables[topLevelVariable to pathToExpectedType] = builtFunctionalType
|
||||
storage.builtFunctionalTypesForPostponedArgumentsByTopLevelTypeVariables[topLevelVariable to pathToExpectedType] =
|
||||
builtFunctionalType
|
||||
}
|
||||
|
||||
override fun putBuiltFunctionalExpectedTypeForPostponedArgument(
|
||||
expectedTypeVariable: TypeConstructorMarker,
|
||||
builtFunctionalType: KotlinTypeMarker
|
||||
builtFunctionalType: KotlinTypeMarker,
|
||||
) {
|
||||
storage.builtFunctionalTypesForPostponedArgumentsByExpectedTypeVariables[expectedTypeVariable] = builtFunctionalType
|
||||
}
|
||||
|
||||
override fun getBuiltFunctionalExpectedTypeForPostponedArgument(
|
||||
topLevelVariable: TypeConstructorMarker,
|
||||
pathToExpectedType: List<Pair<TypeConstructorMarker, Int>>
|
||||
pathToExpectedType: List<Pair<TypeConstructorMarker, Int>>,
|
||||
) = storage.builtFunctionalTypesForPostponedArgumentsByTopLevelTypeVariables[topLevelVariable to pathToExpectedType]
|
||||
|
||||
override fun getBuiltFunctionalExpectedTypeForPostponedArgument(expectedTypeVariable: TypeConstructorMarker) =
|
||||
@@ -479,7 +479,7 @@ class NewConstraintSystemImpl(
|
||||
*/
|
||||
private fun applyConstraintsFromFirstSuccessfulBranchOfTheFork(
|
||||
forkPointData: ForkPointData,
|
||||
position: IncorporationConstraintPosition
|
||||
position: IncorporationConstraintPosition,
|
||||
): Boolean {
|
||||
return forkPointData.any { constraintSetForForkBranch ->
|
||||
runTransaction {
|
||||
@@ -508,7 +508,7 @@ class NewConstraintSystemImpl(
|
||||
override fun fixVariable(
|
||||
variable: TypeVariableMarker,
|
||||
resultType: KotlinTypeMarker,
|
||||
position: FixVariableConstraintPosition<*>
|
||||
position: FixVariableConstraintPosition<*>,
|
||||
) = with(utilContext) {
|
||||
checkState(State.BUILDING, State.COMPLETION)
|
||||
|
||||
@@ -607,7 +607,7 @@ class NewConstraintSystemImpl(
|
||||
|
||||
private fun ConstraintSystemUtilContext.postponeOnlyInputTypesCheck(
|
||||
variableWithConstraints: MutableVariableWithConstraints?,
|
||||
resultType: KotlinTypeMarker
|
||||
resultType: KotlinTypeMarker,
|
||||
) {
|
||||
if (variableWithConstraints != null && variableWithConstraints.typeVariable.hasOnlyInputTypesAttribute()) {
|
||||
postponedComputationsAfterAllVariablesAreFixed.add { checkOnlyInputTypesAnnotation(variableWithConstraints, resultType) }
|
||||
@@ -623,7 +623,7 @@ class NewConstraintSystemImpl(
|
||||
private fun KotlinTypeMarker.substituteAndApproximateIfNecessary(
|
||||
substitutor: TypeSubstitutorMarker,
|
||||
approximator: AbstractTypeApproximator,
|
||||
constraintKind: ConstraintKind
|
||||
constraintKind: ConstraintKind,
|
||||
): KotlinTypeMarker {
|
||||
val doesInputTypeContainsOtherVariables = this.contains { it.typeConstructor() is TypeVariableTypeConstructorMarker }
|
||||
val substitutedType = if (doesInputTypeContainsOtherVariables) substitutor.safeSubstitute(this) else this
|
||||
|
||||
Reference in New Issue
Block a user