[FIR] Make return type of ConeTypeContext.captureFromExpression more precise
This commit is contained in:
committed by
Space Team
parent
934253878b
commit
ed4941d9f9
@@ -383,7 +383,7 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext, Ty
|
|||||||
fir.classKind != ClassKind.ANNOTATION_CLASS
|
fir.classKind != ClassKind.ANNOTATION_CLASS
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun captureFromExpression(type: KotlinTypeMarker): KotlinTypeMarker? {
|
override fun captureFromExpression(type: KotlinTypeMarker): ConeKotlinType? {
|
||||||
require(type is ConeKotlinType)
|
require(type is ConeKotlinType)
|
||||||
return captureFromExpressionInternal(type)
|
return captureFromExpressionInternal(type)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -695,7 +695,7 @@ internal fun captureFromTypeParameterUpperBoundIfNeeded(
|
|||||||
val chosenSupertype = typeParameter.symbol.resolvedBounds.map { it.coneType }
|
val chosenSupertype = typeParameter.symbol.resolvedBounds.map { it.coneType }
|
||||||
.singleOrNull { it.hasSupertypeWithGivenClassId(expectedTypeClassId, context) } ?: return argumentType
|
.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) {
|
return if (argumentType is ConeDefinitelyNotNullType) {
|
||||||
ConeDefinitelyNotNullType.create(capturedType, session.typeContext) ?: capturedType
|
ConeDefinitelyNotNullType.create(capturedType, session.typeContext) ?: capturedType
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user