Introduce substitution to ConeTypeContext.captureFromArguments

This commit itself does not influence anything
This commit is contained in:
Mikhail Glukhikh
2020-09-07 19:20:59 +03:00
parent 414842343d
commit e83f3bbf04
@@ -328,6 +328,10 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext, Ty
ConeCapturedType(status, lowerType, argument, typeConstructor.getParameter(index)) ConeCapturedType(status, lowerType, argument, typeConstructor.getParameter(index))
} }
val substitutor = substitutorByMap((0 until argumentsCount).map { index ->
(typeConstructor.getParameter(index) as ConeTypeParameterLookupTag).toSymbol() to (newArguments[index] as ConeKotlinType)
}.toMap())
for (index in 0 until argumentsCount) { for (index in 0 until argumentsCount) {
val oldArgument = type.typeArguments[index] val oldArgument = type.typeArguments[index]
val newArgument = newArguments[index] val newArgument = newArguments[index]
@@ -336,7 +340,9 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext, Ty
val parameter = typeConstructor.getParameter(index) val parameter = typeConstructor.getParameter(index)
val upperBounds = (0 until parameter.upperBoundCount()).mapTo(mutableListOf()) { paramIndex -> val upperBounds = (0 until parameter.upperBoundCount()).mapTo(mutableListOf()) { paramIndex ->
parameter.getUpperBound(paramIndex) // TODO: substitution substitutor.safeSubstitute(
this as TypeSystemInferenceExtensionContext, parameter.getUpperBound(paramIndex)
)
} }
if (!oldArgument.isStarProjection() && oldArgument.getVariance() == TypeVariance.OUT) { if (!oldArgument.isStarProjection() && oldArgument.getVariance() == TypeVariance.OUT) {