Minor. Cleanup FirDelegatedPropertyInferenceSession a bit
- Some functions might be private - the stubTypeBySyntheticTypeVariable map is actually write-only - integrateConstraints Boolean return value is always unused
This commit is contained in:
+7
-19
@@ -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<ConeTypeVariable, ConeStubType> = mutableMapOf()
|
||||
val stubTypeBySyntheticTypeVariable: MutableMap<ConeTypeVariable, ConeStubType> = mutableMapOf()
|
||||
|
||||
private val stubTypesByTypeVariable: MutableMap<ConeTypeVariable, ConeStubType> = mutableMapOf()
|
||||
private val syntheticTypeVariableByTypeVariable = mutableMapOf<TypeVariableMarker, ConeTypeVariable>()
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user