[FIR] Don't approximate captured types

This fixes some type argument mismatch errors caused by a captured type
being approximated and then captured again.
Some places need to be adapted to work with captured types that
previously only worked with approximated types.

#KT-62959 Fixed
This commit is contained in:
Kirill Rakhman
2023-12-20 11:10:25 +01:00
committed by Space Team
parent b6d7f35ebf
commit 251827c9aa
58 changed files with 506 additions and 86 deletions
@@ -229,6 +229,11 @@ interface TypeSystemInferenceExtensionContext : TypeSystemContext, TypeSystemBui
fun CapturedTypeMarker.typeParameter(): TypeParameterMarker?
fun CapturedTypeMarker.withNotNullProjection(): KotlinTypeMarker
/**
* Only for K2.
*/
fun CapturedTypeMarker.hasRawSuperType(): Boolean
fun TypeVariableMarker.defaultType(): SimpleTypeMarker
fun createTypeWithAlternativeForIntersectionResult(
@@ -533,6 +533,10 @@ interface ClassicTypeSystemContext : TypeSystemInferenceExtensionContext, TypeSy
override fun CapturedTypeMarker.isOldCapturedType(): Boolean = this is CapturedType
override fun CapturedTypeMarker.hasRawSuperType(): Boolean {
error("Is not expected to be called in K1")
}
override fun KotlinTypeMarker.isNullableType(): Boolean {
require(this is KotlinType, this::errorMessage)
return TypeUtils.isNullableType(this)