FIR IDE: use correct denotable type approximator

This commit is contained in:
Ilya Kirillov
2021-02-19 13:09:01 +01:00
parent af4d300686
commit 42103b7363
5 changed files with 26 additions and 122 deletions
@@ -105,7 +105,13 @@ abstract class KtAnalysisSession(final override val token: ValidityToken) : Vali
val builtinTypes: KtBuiltinTypes get() = typeProvider.builtinTypes
fun KtType.approximateToPublicDenotable(): KtType? = typeProvider.approximateToPublicDenotable(this)
/**
* Approximates [KtType] with the a supertype which can be rendered in a source code
*
* Return `null` if the type do not need approximation and can be rendered as is
* Otherwise, for type `T` return type `S` such `T <: S` and `T` and every it type argument is [org.jetbrains.kotlin.idea.frontend.api.types.KtDenotableType]`
*/
fun KtType.approximateToSuperPublicDenotable(): KtType? = typeProvider.approximateToSuperPublicDenotableType(this)
fun KtClassOrObjectSymbol.buildSelfClassType(): KtType = typeProvider.buildSelfClassType(this)
@@ -13,7 +13,7 @@ import org.jetbrains.kotlin.idea.frontend.api.types.KtType
abstract class KtTypeProvider : KtAnalysisSessionComponent() {
abstract val builtinTypes: KtBuiltinTypes
abstract fun approximateToPublicDenotable(type: KtType): KtType?
abstract fun approximateToSuperPublicDenotableType(type: KtType): KtType?
abstract fun buildSelfClassType(symbol: KtClassOrObjectSymbol): KtType
}