diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveExplicitLambdaParameterTypesIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveExplicitLambdaParameterTypesIntention.kt index c7409c7c959..08a3ba3a42e 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveExplicitLambdaParameterTypesIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveExplicitLambdaParameterTypesIntention.kt @@ -31,7 +31,9 @@ class RemoveExplicitLambdaParameterTypesIntention : SelfTargetingIntention Unit) = lambda(DataIntString(i, s)) +fun useDestruct() { + destruct(0, "a") { (x, y): DataIntString -> } +} \ No newline at end of file diff --git a/idea/testData/intentions/removeExplicitLambdaParameterTypes/withDestructuring.kt.after b/idea/testData/intentions/removeExplicitLambdaParameterTypes/withDestructuring.kt.after new file mode 100644 index 00000000000..078c430f3b3 --- /dev/null +++ b/idea/testData/intentions/removeExplicitLambdaParameterTypes/withDestructuring.kt.after @@ -0,0 +1,5 @@ +data class DataIntString(var i: Int, var s: String) +fun destruct(i: Int, s: String, lambda: (DataIntString) -> Unit) = lambda(DataIntString(i, s)) +fun useDestruct() { + destruct(0, "a") { (x, y) -> } +} \ No newline at end of file diff --git a/idea/testData/intentions/removeExplicitLambdaParameterTypes/withDestructuringAndSimple.kt b/idea/testData/intentions/removeExplicitLambdaParameterTypes/withDestructuringAndSimple.kt new file mode 100644 index 00000000000..2cb97fb21e1 --- /dev/null +++ b/idea/testData/intentions/removeExplicitLambdaParameterTypes/withDestructuringAndSimple.kt @@ -0,0 +1,5 @@ +data class DataIntString(var i: Int, var s: String) +fun destruct(i: Int, s: String, lambda: (DataIntString, Int) -> Unit) = lambda(DataIntString(i, s), i) +fun useDestruct() { + destruct(0, "a") { (x, y): DataIntString, i: Int -> } +} \ No newline at end of file diff --git a/idea/testData/intentions/removeExplicitLambdaParameterTypes/withDestructuringAndSimple.kt.after b/idea/testData/intentions/removeExplicitLambdaParameterTypes/withDestructuringAndSimple.kt.after new file mode 100644 index 00000000000..38616b46ac5 --- /dev/null +++ b/idea/testData/intentions/removeExplicitLambdaParameterTypes/withDestructuringAndSimple.kt.after @@ -0,0 +1,5 @@ +data class DataIntString(var i: Int, var s: String) +fun destruct(i: Int, s: String, lambda: (DataIntString, Int) -> Unit) = lambda(DataIntString(i, s), i) +fun useDestruct() { + destruct(0, "a") { (x, y), i -> } +} \ No newline at end of file diff --git a/idea/testData/intentions/removeExplicitLambdaParameterTypes/withDestructuringInMiddle.kt b/idea/testData/intentions/removeExplicitLambdaParameterTypes/withDestructuringInMiddle.kt new file mode 100644 index 00000000000..215f682a58f --- /dev/null +++ b/idea/testData/intentions/removeExplicitLambdaParameterTypes/withDestructuringInMiddle.kt @@ -0,0 +1,3 @@ +data class A(val x: String, val y: String) +fun foo(a: A, block: (Int, A, String) -> String): String = block(1, a, "#") +fun bb() = foo(A("O", "K")) { i: Int, (x, y):A, v:String -> i.toString() + x + y + v } \ No newline at end of file diff --git a/idea/testData/intentions/removeExplicitLambdaParameterTypes/withDestructuringInMiddle.kt.after b/idea/testData/intentions/removeExplicitLambdaParameterTypes/withDestructuringInMiddle.kt.after new file mode 100644 index 00000000000..6c50804dce8 --- /dev/null +++ b/idea/testData/intentions/removeExplicitLambdaParameterTypes/withDestructuringInMiddle.kt.after @@ -0,0 +1,3 @@ +data class A(val x: String, val y: String) +fun foo(a: A, block: (Int, A, String) -> String): String = block(1, a, "#") +fun bb() = foo(A("O", "K")) { i, (x, y), v -> i.toString() + x + y + v } \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java index cc75996ecae..41a3d12e0aa 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java @@ -11847,6 +11847,24 @@ public class IntentionTestGenerated extends AbstractIntentionTest { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/removeExplicitLambdaParameterTypes/typesAlreadyImplicit.kt"); doTest(fileName); } + + @TestMetadata("withDestructuring.kt") + public void testWithDestructuring() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/removeExplicitLambdaParameterTypes/withDestructuring.kt"); + doTest(fileName); + } + + @TestMetadata("withDestructuringAndSimple.kt") + public void testWithDestructuringAndSimple() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/removeExplicitLambdaParameterTypes/withDestructuringAndSimple.kt"); + doTest(fileName); + } + + @TestMetadata("withDestructuringInMiddle.kt") + public void testWithDestructuringInMiddle() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/removeExplicitLambdaParameterTypes/withDestructuringInMiddle.kt"); + doTest(fileName); + } } @TestMetadata("idea/testData/intentions/removeExplicitSuperQualifier")