[FE] Substitute fixed type variables with inferred stub types

Actually, a type variable might be fixed into a stub type. Such stub type should be substituted before sub calls completion

^KT-51988 Fixed
This commit is contained in:
Victor Petukhov
2022-05-05 11:36:39 +02:00
committed by teamcity
parent 92df5cd67f
commit 6027c2a9aa
19 changed files with 133 additions and 27 deletions
@@ -18,6 +18,7 @@ interface ConstraintSystemOperation {
fun markCouldBeResolvedWithUnrestrictedBuilderInference()
fun unmarkPostponedVariable(variable: TypeVariableMarker)
fun removePostponedVariables()
fun substituteFixedVariables(substitutor: TypeSubstitutorMarker)
fun getBuiltFunctionalExpectedTypeForPostponedArgument(
topLevelVariable: TypeConstructorMarker,
@@ -144,6 +144,10 @@ class NewConstraintSystemImpl(
storage.postponedTypeVariables.clear()
}
override fun substituteFixedVariables(substitutor: TypeSubstitutorMarker) {
storage.fixedTypeVariables.replaceAll { _, type -> substitutor.safeSubstitute(type) }
}
override fun putBuiltFunctionalExpectedTypeForPostponedArgument(
topLevelVariable: TypeConstructorMarker,
pathToExpectedType: List<Pair<TypeConstructorMarker, Int>>,