[FIR] Check for subtyping during actualization of supertypes of expect class

^KT-59356 Fixed
This commit is contained in:
Dmitriy Novozhilov
2023-06-16 17:35:01 +03:00
committed by Space Team
parent ac92c129bf
commit 1b24b95cde
26 changed files with 323 additions and 15 deletions
@@ -26,6 +26,7 @@ import org.jetbrains.kotlin.types.model.*
import org.jetbrains.kotlin.types.typeUtil.asTypeProjection
import org.jetbrains.kotlin.utils.addToStdlib.UnsafeCastFunction
import org.jetbrains.kotlin.utils.addToStdlib.castAll
import org.jetbrains.kotlin.utils.addToStdlib.shouldNotBeCalled
import org.jetbrains.kotlin.utils.keysToMap
class ClassicExpectActualMatchingContext(val platformModule: ModuleDescriptor) : ExpectActualMatchingContext<MemberDescriptor>,
@@ -212,6 +213,13 @@ class ClassicExpectActualMatchingContext(val platformModule: ModuleDescriptor) :
}
}
override val RegularClassSymbolMarker.defaultType: KotlinTypeMarker
get() = asDescriptor().defaultType
override fun actualTypeIsSubtypeOfExpectType(expectType: KotlinTypeMarker, actualType: KotlinTypeMarker): Boolean {
shouldNotBeCalled("Checking for subtyping is used only in FIR and IR implementations")
}
@OptIn(TypeRefinement::class)
private fun areCompatibleTypesViaTypeRefinement(a: KotlinType, b: KotlinType): Boolean {
val typeRefinerForPlatformModule = platformModule.getKotlinTypeRefiner().let { moduleRefiner ->