FIR IDE: introduce expected type provider for return expressions
This commit is contained in:
+2
-1
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.idea.frontend.api
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.diagnostics.Diagnostic
|
||||
import org.jetbrains.kotlin.idea.frontend.api.calls.KtCall
|
||||
import org.jetbrains.kotlin.idea.frontend.api.components.*
|
||||
@@ -66,7 +67,7 @@ abstract class KtAnalysisSession(final override val token: ValidityToken) : Vali
|
||||
|
||||
infix fun KtType.isSubTypeOf(superType: KtType): Boolean = typeProvider.isSubTypeOf(this, superType)
|
||||
|
||||
fun KtExpression.getExpectedType(): KtType? = typeProvider.getExpectedType(this)
|
||||
fun PsiElement.getExpectedType(): KtType? = typeProvider.getExpectedType(this)
|
||||
|
||||
fun KtType.isBuiltInFunctionalType(): Boolean = typeProvider.isBuiltinFunctionalType(this)
|
||||
|
||||
|
||||
+2
-1
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.idea.frontend.api.components
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.idea.frontend.api.types.KtType
|
||||
import org.jetbrains.kotlin.psi.KtDeclaration
|
||||
import org.jetbrains.kotlin.psi.KtExpression
|
||||
@@ -19,5 +20,5 @@ abstract class KtTypeProvider : KtAnalysisSessionComponent() {
|
||||
//TODO get rid of
|
||||
abstract fun isBuiltinFunctionalType(type: KtType): Boolean
|
||||
|
||||
abstract fun getExpectedType(expression: KtExpression): KtType?
|
||||
abstract fun getExpectedType(expression: PsiElement): KtType?
|
||||
}
|
||||
Reference in New Issue
Block a user