Replace explicit parameter isn't shown on destructuring declaration

So #KT-17026 Fixed
This commit is contained in:
Toshiaki Kameyama
2017-06-08 13:04:51 +03:00
committed by Mikhail Glukhikh
parent e5717d3e96
commit c149e956cc
3 changed files with 12 additions and 1 deletions
@@ -43,8 +43,9 @@ class ReplaceExplicitFunctionLiteralParamWithItIntention : PsiElementBaseIntenti
val parameter = functionLiteral.valueParameters.singleOrNull() ?: return false
if (parameter.typeReference != null) return false
if (parameter.destructuringDeclaration != null) return false
if (functionLiteral.anyDescendantOfType<KtFunctionLiteral>() { literal ->
if (functionLiteral.anyDescendantOfType<KtFunctionLiteral> { literal ->
literal.usesName(element.text) &&
(!literal.hasParameterSpecification() || literal.usesName("it"))
} ) return false
@@ -0,0 +1,4 @@
// WITH_RUNTIME
// IS_APPLICABLE: false
val list = listOf(Pair(1, 2), Pair(3, 4)).map { (<caret>f, s) -> f + s }
@@ -13388,6 +13388,12 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
doTest(fileName);
}
@TestMetadata("notApplicable_hasDestructuringDeclaration.kt")
public void testNotApplicable_hasDestructuringDeclaration() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/notApplicable_hasDestructuringDeclaration.kt");
doTest(fileName);
}
@TestMetadata("notApplicable_hasMultipleParameters.kt")
public void testNotApplicable_hasMultipleParameters() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/notApplicable_hasMultipleParameters.kt");