diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/FirDelegatedPropertyInferenceSession.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/FirDelegatedPropertyInferenceSession.kt index 1bd438e3324..cb990e1e42f 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/FirDelegatedPropertyInferenceSession.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/FirDelegatedPropertyInferenceSession.kt @@ -41,7 +41,7 @@ class FirDelegatedPropertyInferenceSession( } } - fun integrateResolvedCall(storage: ConstraintStorage) { + private fun integrateResolvedCall(storage: ConstraintStorage) { registerSyntheticVariables(storage) val stubToTypeVariableSubstitutor = createToSyntheticTypeVariableSubstitutor() integrateConstraints( @@ -233,9 +233,7 @@ class FirDelegatedPropertyInferenceSession( .replaceStubsAndTypeVariablesToErrors(typeContext, stubTypesByTypeVariable.values.map { it.constructor }) } - val stubTypesByTypeVariable: MutableMap = mutableMapOf() - val stubTypeBySyntheticTypeVariable: MutableMap = mutableMapOf() - + private val stubTypesByTypeVariable: MutableMap = mutableMapOf() private val syntheticTypeVariableByTypeVariable = mutableMapOf() private fun registerSyntheticVariables(storage: ConstraintStorage) { @@ -252,9 +250,7 @@ class FirDelegatedPropertyInferenceSession( ConeStubTypeForChainInference( syntheticVariable, ConeNullability.create(syntheticVariable.defaultType.isMarkedNullable) - ).also { - stubTypeBySyntheticTypeVariable[syntheticVariable] = it - } + ) } } } @@ -283,7 +279,7 @@ class FirDelegatedPropertyInferenceSession( storage: ConstraintStorage, nonFixedToVariablesSubstitutor: ConeSubstitutor, shouldIntegrateAllConstraints: Boolean - ): Boolean { + ) { if (shouldIntegrateAllConstraints) { storage.notFixedTypeVariables.values.forEach { if (isSyntheticTypeVariable(it.typeVariable)) return@forEach @@ -300,15 +296,10 @@ class FirDelegatedPropertyInferenceSession( val callSubstitutor = storage.buildAbstractResultingSubstitutor(commonSystem, transformTypeVariablesToErrorTypes = false) as ConeSubstitutor - var introducedConstraint = false - for (initialConstraint in storage.initialConstraints) { - if (integrateConstraintToSystem( - commonSystem, initialConstraint, callSubstitutor, nonFixedToVariablesSubstitutor, storage.fixedTypeVariables - ) - ) { - introducedConstraint = true - } + integrateConstraintToSystem( + commonSystem, initialConstraint, callSubstitutor, nonFixedToVariablesSubstitutor, storage.fixedTypeVariables + ) } if (shouldIntegrateAllConstraints) { @@ -318,10 +309,7 @@ class FirDelegatedPropertyInferenceSession( commonSystem.registerTypeVariableIfNotPresent(typeVariable) commonSystem.addEqualityConstraint((typeVariable as ConeTypeVariable).defaultType, type, BuilderInferencePosition) - introducedConstraint = true } } - - return introducedConstraint } }