Remove explicit type specification: don't propose for ext function type

#KT-8875 Fixed
This commit is contained in:
Toshiaki Kameyama
2018-11-16 15:45:24 +03:00
committed by Mikhail Glukhikh
parent c8cbe05722
commit 8b2fef3812
3 changed files with 10 additions and 0 deletions
@@ -77,6 +77,7 @@ class RemoveExplicitTypeIntention : SelfTargetingRangeIntention<KtCallableDeclar
if (initializer == null) return true
if (initializer !is KtLambdaExpression && initializer !is KtNamedFunction) return true
val functionType = element.typeReference?.typeElement as? KtFunctionType ?: return true
if (functionType.receiver != null) return false
if (functionType.parameters.isEmpty()) return true
val valueParameters = when (initializer) {
is KtLambdaExpression -> initializer.valueParameters
@@ -0,0 +1,4 @@
// IS_APPLICABLE: false
val foo: <caret>Int.() -> String = {
toString() + hashCode()
}
@@ -13316,6 +13316,11 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
runTest("idea/testData/intentions/removeExplicitType/anonymousFunctionInitializer3.kt");
}
@TestMetadata("extensionFunction.kt")
public void testExtensionFunction() throws Exception {
runTest("idea/testData/intentions/removeExplicitType/extensionFunction.kt");
}
@TestMetadata("funNoBody.kt")
public void testFunNoBody() throws Exception {
runTest("idea/testData/intentions/removeExplicitType/funNoBody.kt");