diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/ConstraintSystemCompleter.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/ConstraintSystemCompleter.kt index cdd63d86ef9..add073684a3 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/ConstraintSystemCompleter.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/ConstraintSystemCompleter.kt @@ -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, allTypeVariables: List, - 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 + topLevelAtoms: List, ): List { 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 + topLevelAtoms: List, ): 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) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/PostponedArgumentsAnalyzer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/PostponedArgumentsAnalyzer.kt index bb3f84befb4..2012422e9d7 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/PostponedArgumentsAnalyzer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/PostponedArgumentsAnalyzer.kt @@ -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) diff --git a/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/model/NewConstraintSystemImpl.kt b/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/model/NewConstraintSystemImpl.kt index 85935fa1f5c..d14628c9186 100644 --- a/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/model/NewConstraintSystemImpl.kt +++ b/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/model/NewConstraintSystemImpl.kt @@ -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> + constraints: MutableList>, ) { storage.missedConstraints.add(position to constraints) } @@ -172,21 +171,22 @@ class NewConstraintSystemImpl( override fun putBuiltFunctionalExpectedTypeForPostponedArgument( topLevelVariable: TypeConstructorMarker, pathToExpectedType: List>, - 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> + pathToExpectedType: List>, ) = 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