From c6578384fb6ec91de7348ae2f2329dd80b4b9190 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Fri, 9 Jun 2017 15:01:53 +0300 Subject: [PATCH] Minor: remove unused functions --- .../RemoveExplicitTypeArgumentsIntention.kt | 26 ------------------- 1 file changed, 26 deletions(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveExplicitTypeArgumentsIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveExplicitTypeArgumentsIntention.kt index 27eb1b516dc..d8b213b45f0 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveExplicitTypeArgumentsIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveExplicitTypeArgumentsIntention.kt @@ -50,32 +50,6 @@ class RemoveExplicitTypeArgumentsInspection : IntentionBasedInspection(KtTypeArgumentList::class.java, "Remove explicit type arguments") { companion object { - private fun KtCallExpression.argumentTypesDeducedFromReturnType(context: BindingContext): Boolean { - val resolvedCall = getResolvedCall(context) ?: return false - val typeParameters = resolvedCall.candidateDescriptor.typeParameters - if (typeParameters.isEmpty()) return true - val returnType = resolvedCall.candidateDescriptor.returnType ?: return false - return returnType.arguments.map { it.type }.containsAll(typeParameters.map { it.defaultType }) - } - - private fun KtCallExpression.hasExplicitExpectedType(context: BindingContext): Boolean { - // todo Check with expected type for other expressions - // If always use expected type from trace there is a problem with nested calls: - // the expression type for them can depend on their explicit type arguments (via outer call), - // therefore we should resolve outer call with erased type arguments for inner call - val parent = parent - return when (parent) { - is KtProperty -> parent.initializer == this && parent.typeReference != null - is KtDeclarationWithBody -> parent.bodyExpression == this - is KtReturnExpression -> true - is KtValueArgument -> (parent.parent.parent as? KtCallExpression)?.let { - it.typeArgumentList != null || - it.hasExplicitExpectedType(context) && it.argumentTypesDeducedFromReturnType(context) - }?: false - else -> false - } - } - fun isApplicableTo(element: KtTypeArgumentList, approximateFlexible: Boolean): Boolean { val callExpression = element.parent as? KtCallExpression ?: return false if (callExpression.typeArguments.isEmpty()) return false