Skip to content

Commit 8b81c37

Browse files
committed
Minor. Cleanup FirDelegatedPropertyInferenceSession a bit
- Some functions might be private - the stubTypeBySyntheticTypeVariable map is actually write-only - integrateConstraints Boolean return value is always unused
1 parent f425dea commit 8b81c37

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/FirDelegatedPropertyInferenceSession.kt

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class FirDelegatedPropertyInferenceSession(
4141
}
4242
}
4343

44-
fun integrateResolvedCall(storage: ConstraintStorage) {
44+
private fun integrateResolvedCall(storage: ConstraintStorage) {
4545
registerSyntheticVariables(storage)
4646
val stubToTypeVariableSubstitutor = createToSyntheticTypeVariableSubstitutor()
4747
integrateConstraints(
@@ -233,9 +233,7 @@ class FirDelegatedPropertyInferenceSession(
233233
.replaceStubsAndTypeVariablesToErrors(typeContext, stubTypesByTypeVariable.values.map { it.constructor })
234234
}
235235

236-
val stubTypesByTypeVariable: MutableMap<ConeTypeVariable, ConeStubType> = mutableMapOf()
237-
val stubTypeBySyntheticTypeVariable: MutableMap<ConeTypeVariable, ConeStubType> = mutableMapOf()
238-
236+
private val stubTypesByTypeVariable: MutableMap<ConeTypeVariable, ConeStubType> = mutableMapOf()
239237
private val syntheticTypeVariableByTypeVariable = mutableMapOf<TypeVariableMarker, ConeTypeVariable>()
240238

241239
private fun registerSyntheticVariables(storage: ConstraintStorage) {
@@ -252,9 +250,7 @@ class FirDelegatedPropertyInferenceSession(
252250
ConeStubTypeForChainInference(
253251
syntheticVariable,
254252
ConeNullability.create(syntheticVariable.defaultType.isMarkedNullable)
255-
).also {
256-
stubTypeBySyntheticTypeVariable[syntheticVariable] = it
257-
}
253+
)
258254
}
259255
}
260256
}
@@ -283,7 +279,7 @@ class FirDelegatedPropertyInferenceSession(
283279
storage: ConstraintStorage,
284280
nonFixedToVariablesSubstitutor: ConeSubstitutor,
285281
shouldIntegrateAllConstraints: Boolean
286-
): Boolean {
282+
) {
287283
if (shouldIntegrateAllConstraints) {
288284
storage.notFixedTypeVariables.values.forEach {
289285
if (isSyntheticTypeVariable(it.typeVariable)) return@forEach
@@ -300,15 +296,10 @@ class FirDelegatedPropertyInferenceSession(
300296
val callSubstitutor =
301297
storage.buildAbstractResultingSubstitutor(commonSystem, transformTypeVariablesToErrorTypes = false) as ConeSubstitutor
302298

303-
var introducedConstraint = false
304-
305299
for (initialConstraint in storage.initialConstraints) {
306-
if (integrateConstraintToSystem(
307-
commonSystem, initialConstraint, callSubstitutor, nonFixedToVariablesSubstitutor, storage.fixedTypeVariables
308-
)
309-
) {
310-
introducedConstraint = true
311-
}
300+
integrateConstraintToSystem(
301+
commonSystem, initialConstraint, callSubstitutor, nonFixedToVariablesSubstitutor, storage.fixedTypeVariables
302+
)
312303
}
313304

314305
if (shouldIntegrateAllConstraints) {
@@ -318,10 +309,7 @@ class FirDelegatedPropertyInferenceSession(
318309

319310
commonSystem.registerTypeVariableIfNotPresent(typeVariable)
320311
commonSystem.addEqualityConstraint((typeVariable as ConeTypeVariable).defaultType, type, BuilderInferencePosition)
321-
introducedConstraint = true
322312
}
323313
}
324-
325-
return introducedConstraint
326314
}
327315
}

0 commit comments

Comments
 (0)