diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/ConeTypeContext.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/ConeTypeContext.kt index b4d3d703a7c..e037cf6af89 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/ConeTypeContext.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/ConeTypeContext.kt @@ -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) } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt index 1707543c875..62b0beb630a 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt @@ -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 {