Replace explicit parameter isn't shown on destructuring declaration
So #KT-17026 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
e5717d3e96
commit
c149e956cc
+2
-1
@@ -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
|
||||
|
||||
+4
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user