Skip to content

Commit

Permalink
[FIR2IR] Minor: reuse approximateForIrOrNull utility in Fir2IrTypeC…
Browse files Browse the repository at this point in the history
…onverter
  • Loading branch information
demiurg906 authored and Space Team committed Nov 10, 2023
1 parent 0283bab commit ef01b98
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Expand Up @@ -446,8 +446,4 @@ class Fir2IrImplicitCastInserter(
return lowerBound.isMarkedNullable != upperBound.isMarkedNullable
}
}

private fun ConeKotlinType.approximateForIrOrNull(): ConeKotlinType? {
return session.typeApproximator.approximateToSuperType(this, TypeApproximatorConfiguration.FrontendToBackendTypesApproximation)
}
}
Expand Up @@ -234,10 +234,7 @@ class Fir2IrTypeConverter(
original.toIrType(typeOrigin).makeNotNull()
}
is ConeIntersectionType -> {
val approximated = session.typeApproximator.approximateToSuperType(
this,
TypeApproximatorConfiguration.FrontendToBackendTypesApproximation

This comment has been minimized.

Copy link
@Mpmhed

Mpmhed Dec 6, 2023

                TypeApproximatorConfiguration.FrontendToBackendTypesApproximation
)!!
val approximated = approximateForIrOrNull()!!
approximated.toIrType(typeOrigin)
}
is ConeStubType -> createErrorType()
Expand Down Expand Up @@ -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)
}

0 comments on commit ef01b98

Please sign in to comment.