From bd467f39d6616ae7fadf2ef50082c80c393a46b6 Mon Sep 17 00:00:00 2001 From: Toshiaki Kameyama Date: Tue, 25 Dec 2018 05:45:55 +0300 Subject: [PATCH] Convert to scope function: Also convert call expression #KT-28698 Fixed --- .../intentions/ConvertToScopeIntention.kt | 62 +++++++++++----- .../convertToAlso/callExpression.kt | 15 ++++ .../convertToAlso/callExpression.kt.after | 16 +++++ .../convertToAlso/callExpression2.kt | 15 ++++ .../convertToAlso/callExpression2.kt.after | 16 +++++ .../convertToAlso/callExpression3.kt | 15 ++++ .../convertToAlso/callExpression3.kt.after | 16 +++++ .../convertToAlso/callExpression4.kt | 16 +++++ .../convertToAlso/callExpression5.kt | 16 +++++ .../convertToApply/callExpression.kt | 15 ++++ .../convertToApply/callExpression.kt.after | 16 +++++ .../convertToApply/callExpression2.kt | 15 ++++ .../convertToApply/callExpression2.kt.after | 16 +++++ .../convertToApply/callExpression3.kt | 15 ++++ .../convertToApply/callExpression3.kt.after | 16 +++++ .../convertToApply/callExpression4.kt | 16 +++++ .../convertToApply/callExpression5.kt | 16 +++++ .../convertToRun/callExpression.kt | 14 ++++ .../convertToRun/callExpression.kt.after | 16 +++++ .../convertToRun/callExpression2.kt | 13 ++++ .../convertToWith/callExpression.kt | 14 ++++ .../convertToWith/callExpression.kt.after | 16 +++++ .../convertToWith/callExpression2.kt | 13 ++++ .../intentions/IntentionTestGenerated.java | 70 +++++++++++++++++++ 24 files changed, 451 insertions(+), 17 deletions(-) create mode 100644 idea/testData/intentions/convertToScope/convertToAlso/callExpression.kt create mode 100644 idea/testData/intentions/convertToScope/convertToAlso/callExpression.kt.after create mode 100644 idea/testData/intentions/convertToScope/convertToAlso/callExpression2.kt create mode 100644 idea/testData/intentions/convertToScope/convertToAlso/callExpression2.kt.after create mode 100644 idea/testData/intentions/convertToScope/convertToAlso/callExpression3.kt create mode 100644 idea/testData/intentions/convertToScope/convertToAlso/callExpression3.kt.after create mode 100644 idea/testData/intentions/convertToScope/convertToAlso/callExpression4.kt create mode 100644 idea/testData/intentions/convertToScope/convertToAlso/callExpression5.kt create mode 100644 idea/testData/intentions/convertToScope/convertToApply/callExpression.kt create mode 100644 idea/testData/intentions/convertToScope/convertToApply/callExpression.kt.after create mode 100644 idea/testData/intentions/convertToScope/convertToApply/callExpression2.kt create mode 100644 idea/testData/intentions/convertToScope/convertToApply/callExpression2.kt.after create mode 100644 idea/testData/intentions/convertToScope/convertToApply/callExpression3.kt create mode 100644 idea/testData/intentions/convertToScope/convertToApply/callExpression3.kt.after create mode 100644 idea/testData/intentions/convertToScope/convertToApply/callExpression4.kt create mode 100644 idea/testData/intentions/convertToScope/convertToApply/callExpression5.kt create mode 100644 idea/testData/intentions/convertToScope/convertToRun/callExpression.kt create mode 100644 idea/testData/intentions/convertToScope/convertToRun/callExpression.kt.after create mode 100644 idea/testData/intentions/convertToScope/convertToRun/callExpression2.kt create mode 100644 idea/testData/intentions/convertToScope/convertToWith/callExpression.kt create mode 100644 idea/testData/intentions/convertToScope/convertToWith/callExpression.kt.after create mode 100644 idea/testData/intentions/convertToScope/convertToWith/callExpression2.kt diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertToScopeIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertToScopeIntention.kt index 4dc8c11d722..43f4253e5a5 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertToScopeIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertToScopeIntention.kt @@ -43,6 +43,11 @@ sealed class ConvertToScopeIntention( when (element) { is KtProperty -> if (!element.isLocal) return false + is KtCallExpression -> { + if (element.parent is KtDotQualifiedExpression) return false + val propertyName = element.prevProperty()?.name ?: return false + if (!element.isTarget(propertyName)) return false + } is KtDotQualifiedExpression -> { if (element.parent is KtDotQualifiedExpression) return false val name = element.getLeftMostReceiverExpression().text @@ -55,7 +60,7 @@ sealed class ConvertToScopeIntention( } override fun applyTo(element: KtExpression, editor: Editor?) { - val targets = element.collectTargetElements() ?: return + val (targets, referenceName) = element.collectTargetElements() ?: return val first = targets.firstOrNull() ?: return val last = targets.lastOrNull() ?: return val property = element.prevProperty() @@ -68,33 +73,46 @@ sealed class ConvertToScopeIntention( val psiFactory = KtPsiFactory(element) val (scopeFunctionCall, block) = psiFactory.createScopeFunctionCall(propertyOrFirst) ?: return block.addRange(property?.nextSibling ?: first, last) - block.children.filterIsInstance(KtDotQualifiedExpression::class.java) - .forEach { - val replaced = it.deleteFirstReceiver() - if (scopeFunction.isParameterScope) { - replaced.replace(psiFactory.createExpressionByPattern("${scopeFunction.receiver}.$0", replaced)) + block.children.forEach { child -> + when (child) { + is KtDotQualifiedExpression -> { + val replaced = child.deleteFirstReceiver() + if (scopeFunction.isParameterScope) { + replaced.replace(psiFactory.createExpressionByPattern("${scopeFunction.receiver}.$0", replaced)) + } + } + is KtCallExpression -> { + child.valueArguments.forEach { arg -> + if (arg.getArgumentExpression()?.text == referenceName) { + arg.replace(psiFactory.createArgument(scopeFunction.receiver)) + } + } } } + } parent.addBefore(scopeFunctionCall, propertyOrFirst) parent.deleteChildRange(propertyOrFirst, last) } - private fun KtExpression.collectTargetElements(): List? { - val targets = when (scopeFunction) { + private fun KtExpression.collectTargetElements(): Pair, String>? { + val (targets, referenceName) = when (scopeFunction) { ALSO, APPLY -> { val property = prevProperty() ?: return null val referenceName = property.name ?: return null - property.collectTargetElements(referenceName, forward = true).toList().takeIf { this is KtProperty || this in it } + val targets = property.collectTargetElements(referenceName, forward = true).toList() + if (this !is KtProperty && this !in targets) return null + targets to referenceName } else -> { if (this !is KtDotQualifiedExpression) return null val referenceName = getLeftMostReceiverExpression().text val prev = collectTargetElements(referenceName, forward = false).toList().reversed() val next = collectTargetElements(referenceName, forward = true) - prev + listOf(this) + next + (prev + listOf(this) + next) to referenceName } } - return targets?.takeIf { it.size >= 2 } + if (targets.size < 2) return null + return targets to referenceName } private fun KtExpression.collectTargetElements(referenceName: String, forward: Boolean): Sequence { @@ -104,12 +122,22 @@ sealed class ConvertToScopeIntention( } private fun PsiElement.isTarget(referenceName: String): Boolean { - if (this !is KtDotQualifiedExpression) return false - val leftMostReceiver = getLeftMostReceiverExpression() - if (leftMostReceiver.text != referenceName) return false - if (leftMostReceiver.mainReference?.resolve() is PsiClass) return false - val callExpr = callExpression ?: return false - if (callExpr.lambdaArguments.isNotEmpty() || callExpr.valueArguments.any { it.text == scopeFunction.receiver }) return false + when (this) { + is KtDotQualifiedExpression -> { + val leftMostReceiver = getLeftMostReceiverExpression() + if (leftMostReceiver.text != referenceName) return false + if (leftMostReceiver.mainReference?.resolve() is PsiClass) return false + val callExpr = callExpression ?: return false + if (callExpr.lambdaArguments.isNotEmpty() || callExpr.valueArguments.any { it.text == scopeFunction.receiver }) return false + } + is KtCallExpression -> { + val valueArguments = this.valueArguments + if (valueArguments.none { it.getArgumentExpression()?.text == referenceName }) return false + if (lambdaArguments.isNotEmpty() || valueArguments.any { it.text == scopeFunction.receiver }) return false + } + else -> + return false + } return !anyDescendantOfType { it.text == scopeFunction.receiver } } diff --git a/idea/testData/intentions/convertToScope/convertToAlso/callExpression.kt b/idea/testData/intentions/convertToScope/convertToAlso/callExpression.kt new file mode 100644 index 00000000000..275cdaaaa2f --- /dev/null +++ b/idea/testData/intentions/convertToScope/convertToAlso/callExpression.kt @@ -0,0 +1,15 @@ +// WITH_RUNTIME + +class Foo { + fun foo(i: Int) {} +} + +fun bar(i: Int, f: Foo) {} + +fun test() { + val f2 = Foo() + val f = Foo() + f.foo(1) + bar(2, f) + bar(3, f2) +} \ No newline at end of file diff --git a/idea/testData/intentions/convertToScope/convertToAlso/callExpression.kt.after b/idea/testData/intentions/convertToScope/convertToAlso/callExpression.kt.after new file mode 100644 index 00000000000..f0a8d71d2e0 --- /dev/null +++ b/idea/testData/intentions/convertToScope/convertToAlso/callExpression.kt.after @@ -0,0 +1,16 @@ +// WITH_RUNTIME + +class Foo { + fun foo(i: Int) {} +} + +fun bar(i: Int, f: Foo) {} + +fun test() { + val f2 = Foo() + val f = Foo().also { + it.foo(1) + bar(2, it) + } + bar(3, f2) +} \ No newline at end of file diff --git a/idea/testData/intentions/convertToScope/convertToAlso/callExpression2.kt b/idea/testData/intentions/convertToScope/convertToAlso/callExpression2.kt new file mode 100644 index 00000000000..bf0e5660f03 --- /dev/null +++ b/idea/testData/intentions/convertToScope/convertToAlso/callExpression2.kt @@ -0,0 +1,15 @@ +// WITH_RUNTIME + +class Foo { + fun foo(i: Int) {} +} + +fun bar(i: Int, f: Foo) {} + +fun test() { + val f2 = Foo() + val f = Foo() + f.foo(1) + bar(2, f) + bar(3, f2) +} \ No newline at end of file diff --git a/idea/testData/intentions/convertToScope/convertToAlso/callExpression2.kt.after b/idea/testData/intentions/convertToScope/convertToAlso/callExpression2.kt.after new file mode 100644 index 00000000000..f0a8d71d2e0 --- /dev/null +++ b/idea/testData/intentions/convertToScope/convertToAlso/callExpression2.kt.after @@ -0,0 +1,16 @@ +// WITH_RUNTIME + +class Foo { + fun foo(i: Int) {} +} + +fun bar(i: Int, f: Foo) {} + +fun test() { + val f2 = Foo() + val f = Foo().also { + it.foo(1) + bar(2, it) + } + bar(3, f2) +} \ No newline at end of file diff --git a/idea/testData/intentions/convertToScope/convertToAlso/callExpression3.kt b/idea/testData/intentions/convertToScope/convertToAlso/callExpression3.kt new file mode 100644 index 00000000000..4cb7b8e3efd --- /dev/null +++ b/idea/testData/intentions/convertToScope/convertToAlso/callExpression3.kt @@ -0,0 +1,15 @@ +// WITH_RUNTIME + +class Foo { + fun foo(i: Int) {} +} + +fun bar(i: Int, f: Foo) {} + +fun test() { + val f2 = Foo() + val f = Foo() + f.foo(1) + bar(2, f) + bar(3, f2) +} \ No newline at end of file diff --git a/idea/testData/intentions/convertToScope/convertToAlso/callExpression3.kt.after b/idea/testData/intentions/convertToScope/convertToAlso/callExpression3.kt.after new file mode 100644 index 00000000000..f0a8d71d2e0 --- /dev/null +++ b/idea/testData/intentions/convertToScope/convertToAlso/callExpression3.kt.after @@ -0,0 +1,16 @@ +// WITH_RUNTIME + +class Foo { + fun foo(i: Int) {} +} + +fun bar(i: Int, f: Foo) {} + +fun test() { + val f2 = Foo() + val f = Foo().also { + it.foo(1) + bar(2, it) + } + bar(3, f2) +} \ No newline at end of file diff --git a/idea/testData/intentions/convertToScope/convertToAlso/callExpression4.kt b/idea/testData/intentions/convertToScope/convertToAlso/callExpression4.kt new file mode 100644 index 00000000000..f297bfdf04e --- /dev/null +++ b/idea/testData/intentions/convertToScope/convertToAlso/callExpression4.kt @@ -0,0 +1,16 @@ +// WITH_RUNTIME +// IS_APPLICABLE: false + +class Foo { + fun foo(i: Int) {} +} + +fun bar(i: Int, f: Foo) {} + +fun test() { + val f2 = Foo() + val f = Foo() + f.foo(1) + bar(2, f) + bar(3, f2) +} \ No newline at end of file diff --git a/idea/testData/intentions/convertToScope/convertToAlso/callExpression5.kt b/idea/testData/intentions/convertToScope/convertToAlso/callExpression5.kt new file mode 100644 index 00000000000..744285fe8ad --- /dev/null +++ b/idea/testData/intentions/convertToScope/convertToAlso/callExpression5.kt @@ -0,0 +1,16 @@ +// WITH_RUNTIME +// IS_APPLICABLE: false + +class Foo { + fun foo(i: Int) {} +} + +fun bar(i: Int, f: Foo) {} + +fun test() { + listOf(1).forEach { + val f = Foo() + f.foo(1) + bar(it, f) + } +} \ No newline at end of file diff --git a/idea/testData/intentions/convertToScope/convertToApply/callExpression.kt b/idea/testData/intentions/convertToScope/convertToApply/callExpression.kt new file mode 100644 index 00000000000..275cdaaaa2f --- /dev/null +++ b/idea/testData/intentions/convertToScope/convertToApply/callExpression.kt @@ -0,0 +1,15 @@ +// WITH_RUNTIME + +class Foo { + fun foo(i: Int) {} +} + +fun bar(i: Int, f: Foo) {} + +fun test() { + val f2 = Foo() + val f = Foo() + f.foo(1) + bar(2, f) + bar(3, f2) +} \ No newline at end of file diff --git a/idea/testData/intentions/convertToScope/convertToApply/callExpression.kt.after b/idea/testData/intentions/convertToScope/convertToApply/callExpression.kt.after new file mode 100644 index 00000000000..082a038b938 --- /dev/null +++ b/idea/testData/intentions/convertToScope/convertToApply/callExpression.kt.after @@ -0,0 +1,16 @@ +// WITH_RUNTIME + +class Foo { + fun foo(i: Int) {} +} + +fun bar(i: Int, f: Foo) {} + +fun test() { + val f2 = Foo() + val f = Foo().apply { + foo(1) + bar(2, this) + } + bar(3, f2) +} \ No newline at end of file diff --git a/idea/testData/intentions/convertToScope/convertToApply/callExpression2.kt b/idea/testData/intentions/convertToScope/convertToApply/callExpression2.kt new file mode 100644 index 00000000000..bf0e5660f03 --- /dev/null +++ b/idea/testData/intentions/convertToScope/convertToApply/callExpression2.kt @@ -0,0 +1,15 @@ +// WITH_RUNTIME + +class Foo { + fun foo(i: Int) {} +} + +fun bar(i: Int, f: Foo) {} + +fun test() { + val f2 = Foo() + val f = Foo() + f.foo(1) + bar(2, f) + bar(3, f2) +} \ No newline at end of file diff --git a/idea/testData/intentions/convertToScope/convertToApply/callExpression2.kt.after b/idea/testData/intentions/convertToScope/convertToApply/callExpression2.kt.after new file mode 100644 index 00000000000..082a038b938 --- /dev/null +++ b/idea/testData/intentions/convertToScope/convertToApply/callExpression2.kt.after @@ -0,0 +1,16 @@ +// WITH_RUNTIME + +class Foo { + fun foo(i: Int) {} +} + +fun bar(i: Int, f: Foo) {} + +fun test() { + val f2 = Foo() + val f = Foo().apply { + foo(1) + bar(2, this) + } + bar(3, f2) +} \ No newline at end of file diff --git a/idea/testData/intentions/convertToScope/convertToApply/callExpression3.kt b/idea/testData/intentions/convertToScope/convertToApply/callExpression3.kt new file mode 100644 index 00000000000..4cb7b8e3efd --- /dev/null +++ b/idea/testData/intentions/convertToScope/convertToApply/callExpression3.kt @@ -0,0 +1,15 @@ +// WITH_RUNTIME + +class Foo { + fun foo(i: Int) {} +} + +fun bar(i: Int, f: Foo) {} + +fun test() { + val f2 = Foo() + val f = Foo() + f.foo(1) + bar(2, f) + bar(3, f2) +} \ No newline at end of file diff --git a/idea/testData/intentions/convertToScope/convertToApply/callExpression3.kt.after b/idea/testData/intentions/convertToScope/convertToApply/callExpression3.kt.after new file mode 100644 index 00000000000..082a038b938 --- /dev/null +++ b/idea/testData/intentions/convertToScope/convertToApply/callExpression3.kt.after @@ -0,0 +1,16 @@ +// WITH_RUNTIME + +class Foo { + fun foo(i: Int) {} +} + +fun bar(i: Int, f: Foo) {} + +fun test() { + val f2 = Foo() + val f = Foo().apply { + foo(1) + bar(2, this) + } + bar(3, f2) +} \ No newline at end of file diff --git a/idea/testData/intentions/convertToScope/convertToApply/callExpression4.kt b/idea/testData/intentions/convertToScope/convertToApply/callExpression4.kt new file mode 100644 index 00000000000..f297bfdf04e --- /dev/null +++ b/idea/testData/intentions/convertToScope/convertToApply/callExpression4.kt @@ -0,0 +1,16 @@ +// WITH_RUNTIME +// IS_APPLICABLE: false + +class Foo { + fun foo(i: Int) {} +} + +fun bar(i: Int, f: Foo) {} + +fun test() { + val f2 = Foo() + val f = Foo() + f.foo(1) + bar(2, f) + bar(3, f2) +} \ No newline at end of file diff --git a/idea/testData/intentions/convertToScope/convertToApply/callExpression5.kt b/idea/testData/intentions/convertToScope/convertToApply/callExpression5.kt new file mode 100644 index 00000000000..50f3741c266 --- /dev/null +++ b/idea/testData/intentions/convertToScope/convertToApply/callExpression5.kt @@ -0,0 +1,16 @@ +// WITH_RUNTIME +// IS_APPLICABLE: false + +class Foo { + fun foo(i: Int) {} + + fun test(f: Foo) { + val f = Foo() + f.foo(1) + bar(2, this) + } +} + +fun bar(i: Int, f: Foo) {} + + diff --git a/idea/testData/intentions/convertToScope/convertToRun/callExpression.kt b/idea/testData/intentions/convertToScope/convertToRun/callExpression.kt new file mode 100644 index 00000000000..57b60d39186 --- /dev/null +++ b/idea/testData/intentions/convertToScope/convertToRun/callExpression.kt @@ -0,0 +1,14 @@ +// WITH_RUNTIME + +class Foo { + fun foo(i: Int) {} +} + +fun bar(i: Int, f: Foo) {} + +fun test(f: Foo) { + val f2 = Foo() + f.foo(1) + bar(2, f) + bar(3, f2) +} \ No newline at end of file diff --git a/idea/testData/intentions/convertToScope/convertToRun/callExpression.kt.after b/idea/testData/intentions/convertToScope/convertToRun/callExpression.kt.after new file mode 100644 index 00000000000..45336d08afb --- /dev/null +++ b/idea/testData/intentions/convertToScope/convertToRun/callExpression.kt.after @@ -0,0 +1,16 @@ +// WITH_RUNTIME + +class Foo { + fun foo(i: Int) {} +} + +fun bar(i: Int, f: Foo) {} + +fun test(f: Foo) { + val f2 = Foo() + f.run { + foo(1) + bar(2, this) + } + bar(3, f2) +} \ No newline at end of file diff --git a/idea/testData/intentions/convertToScope/convertToRun/callExpression2.kt b/idea/testData/intentions/convertToScope/convertToRun/callExpression2.kt new file mode 100644 index 00000000000..b2b435ecb5b --- /dev/null +++ b/idea/testData/intentions/convertToScope/convertToRun/callExpression2.kt @@ -0,0 +1,13 @@ +// WITH_RUNTIME +// IS_APPLICABLE: false + +class Foo { + fun foo(i: Int) {} +} + +fun bar(i: Int, f: Foo) {} + +fun test(f: Foo) { + f.foo(1) + bar(2, f) +} \ No newline at end of file diff --git a/idea/testData/intentions/convertToScope/convertToWith/callExpression.kt b/idea/testData/intentions/convertToScope/convertToWith/callExpression.kt new file mode 100644 index 00000000000..57b60d39186 --- /dev/null +++ b/idea/testData/intentions/convertToScope/convertToWith/callExpression.kt @@ -0,0 +1,14 @@ +// WITH_RUNTIME + +class Foo { + fun foo(i: Int) {} +} + +fun bar(i: Int, f: Foo) {} + +fun test(f: Foo) { + val f2 = Foo() + f.foo(1) + bar(2, f) + bar(3, f2) +} \ No newline at end of file diff --git a/idea/testData/intentions/convertToScope/convertToWith/callExpression.kt.after b/idea/testData/intentions/convertToScope/convertToWith/callExpression.kt.after new file mode 100644 index 00000000000..156a667af9e --- /dev/null +++ b/idea/testData/intentions/convertToScope/convertToWith/callExpression.kt.after @@ -0,0 +1,16 @@ +// WITH_RUNTIME + +class Foo { + fun foo(i: Int) {} +} + +fun bar(i: Int, f: Foo) {} + +fun test(f: Foo) { + val f2 = Foo() + with(f) { + foo(1) + bar(2, this) + } + bar(3, f2) +} \ No newline at end of file diff --git a/idea/testData/intentions/convertToScope/convertToWith/callExpression2.kt b/idea/testData/intentions/convertToScope/convertToWith/callExpression2.kt new file mode 100644 index 00000000000..b2b435ecb5b --- /dev/null +++ b/idea/testData/intentions/convertToScope/convertToWith/callExpression2.kt @@ -0,0 +1,13 @@ +// WITH_RUNTIME +// IS_APPLICABLE: false + +class Foo { + fun foo(i: Int) {} +} + +fun bar(i: Int, f: Foo) {} + +fun test(f: Foo) { + f.foo(1) + bar(2, f) +} \ 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 6519aad3dc7..144ee5a05e9 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java @@ -7458,6 +7458,31 @@ public class IntentionTestGenerated extends AbstractIntentionTest { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/convertToScope/convertToAlso"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true); } + @TestMetadata("callExpression.kt") + public void testCallExpression() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToAlso/callExpression.kt"); + } + + @TestMetadata("callExpression2.kt") + public void testCallExpression2() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToAlso/callExpression2.kt"); + } + + @TestMetadata("callExpression3.kt") + public void testCallExpression3() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToAlso/callExpression3.kt"); + } + + @TestMetadata("callExpression4.kt") + public void testCallExpression4() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToAlso/callExpression4.kt"); + } + + @TestMetadata("callExpression5.kt") + public void testCallExpression5() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToAlso/callExpression5.kt"); + } + @TestMetadata("itParameter.kt") public void testItParameter() throws Exception { runTest("idea/testData/intentions/convertToScope/convertToAlso/itParameter.kt"); @@ -7531,6 +7556,31 @@ public class IntentionTestGenerated extends AbstractIntentionTest { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/convertToScope/convertToApply"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true); } + @TestMetadata("callExpression.kt") + public void testCallExpression() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToApply/callExpression.kt"); + } + + @TestMetadata("callExpression2.kt") + public void testCallExpression2() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToApply/callExpression2.kt"); + } + + @TestMetadata("callExpression3.kt") + public void testCallExpression3() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToApply/callExpression3.kt"); + } + + @TestMetadata("callExpression4.kt") + public void testCallExpression4() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToApply/callExpression4.kt"); + } + + @TestMetadata("callExpression5.kt") + public void testCallExpression5() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToApply/callExpression5.kt"); + } + @TestMetadata("methodChain.kt") public void testMethodChain() throws Exception { runTest("idea/testData/intentions/convertToScope/convertToApply/methodChain.kt"); @@ -7604,6 +7654,16 @@ public class IntentionTestGenerated extends AbstractIntentionTest { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/convertToScope/convertToRun"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true); } + @TestMetadata("callExpression.kt") + public void testCallExpression() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToRun/callExpression.kt"); + } + + @TestMetadata("callExpression2.kt") + public void testCallExpression2() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToRun/callExpression2.kt"); + } + @TestMetadata("itReceiver.kt") public void testItReceiver() throws Exception { runTest("idea/testData/intentions/convertToScope/convertToRun/itReceiver.kt"); @@ -7692,6 +7752,16 @@ public class IntentionTestGenerated extends AbstractIntentionTest { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/convertToScope/convertToWith"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true); } + @TestMetadata("callExpression.kt") + public void testCallExpression() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToWith/callExpression.kt"); + } + + @TestMetadata("callExpression2.kt") + public void testCallExpression2() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToWith/callExpression2.kt"); + } + @TestMetadata("itReceiver.kt") public void testItReceiver() throws Exception { runTest("idea/testData/intentions/convertToScope/convertToWith/itReceiver.kt");