[FIR] Make return type of ConeTypeContext.captureFromExpression more precise

This commit is contained in:
Kirill Rakhman
2023-11-21 13:20:23 +01:00
committed by Space Team
parent 934253878b
commit ed4941d9f9
2 changed files with 2 additions and 2 deletions
@@ -383,7 +383,7 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext, Ty
fir.classKind != ClassKind.ANNOTATION_CLASS
}
override fun captureFromExpression(type: KotlinTypeMarker): KotlinTypeMarker? {
override fun captureFromExpression(type: KotlinTypeMarker): ConeKotlinType? {
require(type is ConeKotlinType)
return captureFromExpressionInternal(type)
}
@@ -695,7 +695,7 @@ internal fun captureFromTypeParameterUpperBoundIfNeeded(
val chosenSupertype = typeParameter.symbol.resolvedBounds.map { it.coneType }
.singleOrNull { it.hasSupertypeWithGivenClassId(expectedTypeClassId, context) } ?: return argumentType
val capturedType = context.captureFromExpression(chosenSupertype) as ConeKotlinType? ?: return argumentType
val capturedType = context.captureFromExpression(chosenSupertype) ?: return argumentType
return if (argumentType is ConeDefinitelyNotNullType) {
ConeDefinitelyNotNullType.create(capturedType, session.typeContext) ?: capturedType
} else {