FIR IDE: implement expected type weigher for completion

This commit is contained in:
Ilya Kirillov
2020-12-12 12:23:21 +01:00
parent c61d4b5f9c
commit 19fff2b1e7
7 changed files with 145 additions and 26 deletions
@@ -62,9 +62,11 @@ abstract class KtAnalysisSession(final override val token: ValidityToken) : Vali
fun KtDeclaration.getReturnKtType(): KtType = typeProvider.getReturnTypeForKtDeclaration(this)
fun KtType.isEqualTo(other: KtType): Boolean = typeProvider.isEqualTo(this, other)
infix fun KtType.isEqualTo(other: KtType): Boolean = typeProvider.isEqualTo(this, other)
fun KtType.isSubTypeOf(superType: KtType): Boolean = typeProvider.isSubTypeOf(this, superType)
infix fun KtType.isSubTypeOf(superType: KtType): Boolean = typeProvider.isSubTypeOf(this, superType)
fun KtExpression.getExpectedType(): KtType? = typeProvider.getExpectedType(this)
fun KtType.isBuiltInFunctionalType(): Boolean = typeProvider.isBuiltinFunctionalType(this)
@@ -18,4 +18,6 @@ abstract class KtTypeProvider : KtAnalysisSessionComponent() {
//TODO get rid of
abstract fun isBuiltinFunctionalType(type: KtType): Boolean
abstract fun getExpectedType(expression: KtExpression): KtType?
}