@@ -28,7 +28,6 @@ import org.jetbrains.kotlin.analysis.api.resolution.KaExplicitReceiverValue
28
28
import org.jetbrains.kotlin.analysis.api.resolution.KaFunctionCall
29
29
import org.jetbrains.kotlin.analysis.api.resolution.KaImplicitReceiverValue
30
30
import org.jetbrains.kotlin.analysis.api.resolution.singleFunctionCallOrNull
31
- import org.jetbrains.kotlin.analysis.api.resolution.singleVariableAccessCall
32
31
import org.jetbrains.kotlin.analysis.api.resolution.successfulCallOrNull
33
32
import org.jetbrains.kotlin.analysis.api.resolution.successfulFunctionCallOrNull
34
33
import org.jetbrains.kotlin.analysis.api.resolution.symbol
@@ -64,14 +63,12 @@ import org.jetbrains.kotlin.psi.KtCallElement
64
63
import org.jetbrains.kotlin.psi.KtCallExpression
65
64
import org.jetbrains.kotlin.psi.KtClass
66
65
import org.jetbrains.kotlin.psi.KtClassOrObject
67
- import org.jetbrains.kotlin.psi.KtConstantExpression
68
66
import org.jetbrains.kotlin.psi.KtDotQualifiedExpression
69
67
import org.jetbrains.kotlin.psi.KtElement
70
68
import org.jetbrains.kotlin.psi.KtExpression
71
69
import org.jetbrains.kotlin.psi.KtFunction
72
70
import org.jetbrains.kotlin.psi.KtFunctionLiteral
73
71
import org.jetbrains.kotlin.psi.KtLambdaArgument
74
- import org.jetbrains.kotlin.psi.KtLambdaExpression
75
72
import org.jetbrains.kotlin.psi.KtNameReferenceExpression
76
73
import org.jetbrains.kotlin.psi.KtNamedFunction
77
74
import org.jetbrains.kotlin.psi.KtParameter
@@ -882,7 +879,6 @@ fun KaType.simpleName(): String? = withKaSession {
882
879
return lowerBoundIfFlexible().symbol?.name?.asString()
883
880
}
884
881
885
- @Deprecated(" use kotlin-analysis-api instead" , ReplaceWith (" this.determineType()" ))
886
882
fun PsiElement?.determineType (bindingContext : BindingContext ): KotlinType ? =
887
883
this ?.let {
888
884
when (this ) {
@@ -901,34 +897,6 @@ fun PsiElement?.determineType(bindingContext: BindingContext): KotlinType? =
901
897
902
898
}
903
899
904
- fun PsiElement?.determineType (): KaType ? = withKaSession {
905
- this ?.let {
906
- when (this @determineType) {
907
- is KtCallExpression -> determineTypeFromCall()
908
- is KtParameter -> symbol.returnType
909
- is KtTypeReference -> type
910
- is KtProperty -> determineTypeFromCall()
911
- is KtDotQualifiedExpression -> determineTypeFromCall()
912
- is KtReferenceExpression -> determineTypeFromCall()
913
- is KtFunction -> (symbol as KaFunctionSymbol ).returnType
914
- is KtClass -> returnType
915
- is KtConstantExpression -> this @determineType.expressionType
916
- is KtStringTemplateExpression -> this @determineType.expressionType
917
- is KtLambdaExpression -> this @determineType.expressionType
918
- is KtExpression -> determineTypeFromCall()
919
- is KtValueArgument -> this @determineType.getArgumentExpression()?.determineType()
920
- else -> null
921
- }
922
- }
923
- }
924
-
925
- private fun KtElement.determineTypeFromCall (): KaType ? = withKaSession {
926
- this @determineTypeFromCall.resolveToCall()?.let {
927
- (it.successfulFunctionCallOrNull() ? : it.singleVariableAccessCall())
928
- ?.partiallyAppliedSymbol?.symbol?.returnType
929
- }
930
- }
931
-
932
900
fun KotlinType.isSupertypeOf (other : KotlinType ): Boolean {
933
901
return findCorrespondingSupertype(other, this ).let { it != null && it != other }
934
902
}
0 commit comments