[FIR2IR] Minor: reuse approximateForIrOrNull utility in Fir2IrTypeConverter
This commit is contained in:
committed by
Space Team
parent
10914eb23f
commit
40f95cd5dd
@@ -446,8 +446,4 @@ class Fir2IrImplicitCastInserter(
|
||||
return lowerBound.isMarkedNullable != upperBound.isMarkedNullable
|
||||
}
|
||||
}
|
||||
|
||||
private fun ConeKotlinType.approximateForIrOrNull(): ConeKotlinType? {
|
||||
return session.typeApproximator.approximateToSuperType(this, TypeApproximatorConfiguration.FrontendToBackendTypesApproximation)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,10 +234,7 @@ class Fir2IrTypeConverter(
|
||||
original.toIrType(typeOrigin).makeNotNull()
|
||||
}
|
||||
is ConeIntersectionType -> {
|
||||
val approximated = session.typeApproximator.approximateToSuperType(
|
||||
this,
|
||||
TypeApproximatorConfiguration.FrontendToBackendTypesApproximation
|
||||
)!!
|
||||
val approximated = approximateForIrOrNull()!!
|
||||
approximated.toIrType(typeOrigin)
|
||||
}
|
||||
is ConeStubType -> createErrorType()
|
||||
@@ -362,3 +359,8 @@ fun ConeKotlinType.toIrType(
|
||||
with(typeConverter) {
|
||||
toIrType(typeOrigin)
|
||||
}
|
||||
|
||||
context(Fir2IrComponents)
|
||||
internal fun ConeKotlinType.approximateForIrOrNull(): ConeKotlinType? {
|
||||
return session.typeApproximator.approximateToSuperType(this, TypeApproximatorConfiguration.FrontendToBackendTypesApproximation)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user