From 955bfd6e7b99550d7641673592ae0aba28e8d82e Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Mon, 6 May 2019 15:45:51 +0300 Subject: [PATCH] Introduce "add parameter names to following arguments" This commit also refactors relevant intentions & inspections, like "add name to argument", "add names to call arguments", "unnamed boolean literal argument" #KT-30622 Fixed --- idea/resources/META-INF/plugin-common.xml | 5 ++ .../after.kt.template | 7 ++ .../before.kt.template | 7 ++ .../description.html | 6 ++ .../BooleanLiteralArgumentInspection.kt | 89 +++++++++---------- .../intentions/AddNameToArgumentIntention.kt | 12 +-- .../AddNamesToCallArgumentsIntention.kt | 17 ++-- .../AddNamesToFollowingArgumentsIntention.kt | 46 ++++++++++ .../booleanLiteralFixAll.kt | 4 +- .../booleanLiteralFixAll.kt.after | 2 +- .../booleanLiteralFixPart.kt | 4 +- .../booleanLiteralFixPart.kt.after | 2 +- .../addNamesToCallArguments/simple.kt | 2 +- .../addNamesToCallArguments/simple.kt.after | 2 +- .../{notOnCallee.kt => singleArgument.kt} | 0 .../addNamesToFollowingArguments/.intention | 1 + .../addNamesToFollowingArguments/first.kt | 6 ++ .../addNamesToFollowingArguments/last.kt | 6 ++ .../addNamesToFollowingArguments/simple.kt | 5 ++ .../simple.kt.after | 5 ++ .../intentions/IntentionTestGenerated.java | 38 ++++++-- 21 files changed, 189 insertions(+), 77 deletions(-) create mode 100644 idea/resources/intentionDescriptions/AddNamesToFollowingArgumentsIntention/after.kt.template create mode 100644 idea/resources/intentionDescriptions/AddNamesToFollowingArgumentsIntention/before.kt.template create mode 100644 idea/resources/intentionDescriptions/AddNamesToFollowingArgumentsIntention/description.html create mode 100644 idea/src/org/jetbrains/kotlin/idea/intentions/AddNamesToFollowingArgumentsIntention.kt rename idea/testData/intentions/addNamesToCallArguments/{notOnCallee.kt => singleArgument.kt} (100%) create mode 100644 idea/testData/intentions/addNamesToFollowingArguments/.intention create mode 100644 idea/testData/intentions/addNamesToFollowingArguments/first.kt create mode 100644 idea/testData/intentions/addNamesToFollowingArguments/last.kt create mode 100644 idea/testData/intentions/addNamesToFollowingArguments/simple.kt create mode 100644 idea/testData/intentions/addNamesToFollowingArguments/simple.kt.after diff --git a/idea/resources/META-INF/plugin-common.xml b/idea/resources/META-INF/plugin-common.xml index c0999805cca..62efa1033c5 100644 --- a/idea/resources/META-INF/plugin-common.xml +++ b/idea/resources/META-INF/plugin-common.xml @@ -1261,6 +1261,11 @@ Kotlin + + org.jetbrains.kotlin.idea.intentions.AddNamesToFollowingArgumentsIntention + Kotlin + + org.jetbrains.kotlin.idea.intentions.ReplaceUnderscoreWithParameterNameIntention Kotlin diff --git a/idea/resources/intentionDescriptions/AddNamesToFollowingArgumentsIntention/after.kt.template b/idea/resources/intentionDescriptions/AddNamesToFollowingArgumentsIntention/after.kt.template new file mode 100644 index 00000000000..8b9ac07a23b --- /dev/null +++ b/idea/resources/intentionDescriptions/AddNamesToFollowingArgumentsIntention/after.kt.template @@ -0,0 +1,7 @@ +fun foo(x: Int, y: Int, comment: String) { + +} + +fun test() { + foo(24, y = 42, comment = "Hello") +} \ No newline at end of file diff --git a/idea/resources/intentionDescriptions/AddNamesToFollowingArgumentsIntention/before.kt.template b/idea/resources/intentionDescriptions/AddNamesToFollowingArgumentsIntention/before.kt.template new file mode 100644 index 00000000000..ec4957276df --- /dev/null +++ b/idea/resources/intentionDescriptions/AddNamesToFollowingArgumentsIntention/before.kt.template @@ -0,0 +1,7 @@ +fun foo(x: Int, y: Int, comment: String) { + +} + +fun test() { + foo(24, 42, "Hello") +} \ No newline at end of file diff --git a/idea/resources/intentionDescriptions/AddNamesToFollowingArgumentsIntention/description.html b/idea/resources/intentionDescriptions/AddNamesToFollowingArgumentsIntention/description.html new file mode 100644 index 00000000000..b20719bf5e9 --- /dev/null +++ b/idea/resources/intentionDescriptions/AddNamesToFollowingArgumentsIntention/description.html @@ -0,0 +1,6 @@ + + +This intention adds names to all positional arguments of a function call according to the named argument syntax, +starting with the current argument. + + \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/BooleanLiteralArgumentInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/BooleanLiteralArgumentInspection.kt index 2ecab46c77b..e2b4a164af7 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/BooleanLiteralArgumentInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/BooleanLiteralArgumentInspection.kt @@ -6,54 +6,71 @@ package org.jetbrains.kotlin.idea.inspections import com.intellij.codeInspection.IntentionWrapper -import com.intellij.codeInspection.LocalQuickFix -import com.intellij.codeInspection.ProblemDescriptor import com.intellij.codeInspection.ProblemHighlightType.GENERIC_ERROR_OR_WARNING import com.intellij.codeInspection.ProblemHighlightType.INFORMATION import com.intellij.codeInspection.ProblemsHolder import com.intellij.codeInspection.ui.MultipleCheckboxOptionsPanel -import com.intellij.openapi.project.Project import org.jetbrains.kotlin.KtNodeTypes import org.jetbrains.kotlin.diagnostics.Severity import org.jetbrains.kotlin.idea.caches.resolve.analyze +import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall import org.jetbrains.kotlin.idea.intentions.AddNameToArgumentIntention -import org.jetbrains.kotlin.psi.KtCallExpression -import org.jetbrains.kotlin.psi.KtConstantExpression -import org.jetbrains.kotlin.psi.KtValueArgument +import org.jetbrains.kotlin.idea.intentions.AddNamesToCallArgumentsIntention +import org.jetbrains.kotlin.idea.intentions.AddNamesToFollowingArgumentsIntention +import org.jetbrains.kotlin.idea.project.languageVersionSettings +import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType -import org.jetbrains.kotlin.psi.valueArgumentVisitor import javax.swing.JComponent class BooleanLiteralArgumentInspection( @JvmField var reportSingle: Boolean = false ) : AbstractKotlinInspection() { + private fun KtExpression.isBooleanLiteral(): Boolean = + this is KtConstantExpression && node.elementType == KtNodeTypes.BOOLEAN_CONSTANT + + private fun KtValueArgument.isUnnamedBooleanLiteral(): Boolean = + !isNamed() && getArgumentExpression()?.isBooleanLiteral() == true + override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean) = valueArgumentVisitor(fun(argument: KtValueArgument) { - if (argument.getArgumentName() != null) return - val argumentExpression = argument.getArgumentExpression() as? KtConstantExpression ?: return - if (argumentExpression.node.elementType != KtNodeTypes.BOOLEAN_CONSTANT) return + if (argument.isNamed()) return + val argumentExpression = argument.getArgumentExpression() ?: return + if (!argumentExpression.isBooleanLiteral()) return val call = argument.getStrictParentOfType() ?: return val valueArguments = call.valueArguments - if (valueArguments.takeLastWhile { it != argument }.any { !it.isNamed() }) return if (argumentExpression.analyze().diagnostics.forElement(argumentExpression).any { it.severity == Severity.ERROR }) return - if (AddNameToArgumentIntention.detectNameToAdd(argument) == null) return + if (AddNameToArgumentIntention.detectNameToAdd(argument, shouldBeLastUnnamed = false) == null) return - val hasPreviousUnnamedBoolean = valueArguments.asSequence().windowed(size = 2, step = 1).any { (prev, next) -> - next == argument && !prev.isNamed() && - (prev.getArgumentExpression() as? KtConstantExpression)?.node?.elementType == KtNodeTypes.BOOLEAN_CONSTANT + val resolvedCall = call.resolveToCall() ?: return + if (!resolvedCall.resultingDescriptor.hasStableParameterNames()) return + val languageVersionSettings = call.languageVersionSettings + if (valueArguments.any { + !AddNameToArgumentIntention.argumentMatchedAndCouldBeNamedInCall(it, resolvedCall, languageVersionSettings) + } + ) return + + val highlightType = if (reportSingle) { + GENERIC_ERROR_OR_WARNING + } else { + val hasNeighbourUnnamedBoolean = valueArguments.asSequence().windowed(size = 2, step = 1).any { (prev, next) -> + prev == argument && next.isUnnamedBooleanLiteral() || + next == argument && prev.isUnnamedBooleanLiteral() + } + if (hasNeighbourUnnamedBoolean) GENERIC_ERROR_OR_WARNING else INFORMATION } - val fixes = mutableListOf() - if (hasPreviousUnnamedBoolean) { - fixes += AddNamesToLastBooleanArgumentsFix() + val fix = if (argument != valueArguments.lastOrNull { !it.isNamed() }) { + if (argument == valueArguments.firstOrNull()) { + IntentionWrapper(AddNamesToCallArgumentsIntention(), argument.containingKtFile) + } else { + IntentionWrapper(AddNamesToFollowingArgumentsIntention(), argument.containingKtFile) + } + } else { + IntentionWrapper(AddNameToArgumentIntention(), argument.containingKtFile) } - fixes += IntentionWrapper(AddNameToArgumentIntention(), argument.containingKtFile) holder.registerProblemWithoutOfflineInformation( - argument, - "Boolean literal argument without parameter name", - isOnTheFly, - if (reportSingle || hasPreviousUnnamedBoolean) GENERIC_ERROR_OR_WARNING else INFORMATION, - *fixes.toTypedArray() + argument, "Boolean literal argument without parameter name", + isOnTheFly, highlightType, fix ) }) @@ -62,28 +79,4 @@ class BooleanLiteralArgumentInspection( panel.addCheckbox("Report also on call with single boolean literal argument", "reportSingle") return panel } - - private class AddNamesToLastBooleanArgumentsFix : LocalQuickFix { - override fun getFamilyName(): String = name - - override fun getName() = "Add names to boolean arguments" - - override fun applyFix(project: Project, descriptor: ProblemDescriptor) { - val argument = descriptor.psiElement as? KtValueArgument ?: return - val call = argument.getStrictParentOfType() ?: return - val valueArguments = call.valueArguments - - var problemArgumentFound = false - for (currentArgument in valueArguments.reversed()) { - if (currentArgument == argument) { - problemArgumentFound = true - } else if (!problemArgumentFound) continue - if (currentArgument.isNamed()) return - if ((currentArgument.getArgumentExpression() as? KtConstantExpression)?.node?.elementType != KtNodeTypes.BOOLEAN_CONSTANT) { - return - } - if (!AddNameToArgumentIntention.apply(currentArgument)) return - } - } - } } diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/AddNameToArgumentIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/AddNameToArgumentIntention.kt index c9acc8438bb..8c9b2a66f39 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/AddNameToArgumentIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/AddNameToArgumentIntention.kt @@ -40,7 +40,7 @@ class AddNameToArgumentIntention : SelfTargetingIntention( override fun isApplicableTo(element: KtValueArgument, caretOffset: Int): Boolean { val expression = element.getArgumentExpression() ?: return false - val name = detectNameToAdd(element) ?: return false + val name = detectNameToAdd(element, shouldBeLastUnnamed = true) ?: return false text = "Add '$name =' to argument" @@ -60,23 +60,23 @@ class AddNameToArgumentIntention : SelfTargetingIntention( } companion object { - fun apply(element: KtValueArgument): Boolean { - val name = detectNameToAdd(element) ?: return false + fun apply(element: KtValueArgument, givenResolvedCall: ResolvedCall<*>? = null): Boolean { + val name = detectNameToAdd(element, shouldBeLastUnnamed = false, givenResolvedCall = givenResolvedCall) ?: return false val argumentExpression = element.getArgumentExpression() ?: return false val newArgument = KtPsiFactory(element).createArgument(argumentExpression, name, element.getSpreadElement() != null) element.replace(newArgument) return true } - fun detectNameToAdd(argument: KtValueArgument): Name? { + fun detectNameToAdd(argument: KtValueArgument, shouldBeLastUnnamed: Boolean, givenResolvedCall: ResolvedCall<*>? = null): Name? { if (argument.isNamed()) return null if (argument is KtLambdaArgument) return null val argumentList = argument.parent as? KtValueArgumentList ?: return null - if (argument != argumentList.arguments.last { !it.isNamed() }) return null + if (shouldBeLastUnnamed && argument != argumentList.arguments.last { !it.isNamed() }) return null val callExpr = argumentList.parent as? KtCallElement ?: return null - val resolvedCall = callExpr.resolveToCall() ?: return null + val resolvedCall = givenResolvedCall ?: callExpr.resolveToCall() ?: return null if (!resolvedCall.resultingDescriptor.hasStableParameterNames()) return null if (!argumentMatchedAndCouldBeNamedInCall(argument, resolvedCall, callExpr.languageVersionSettings)) return null diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/AddNamesToCallArgumentsIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/AddNamesToCallArgumentsIntention.kt index 828a516ae89..1cbd4bddb37 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/AddNamesToCallArgumentsIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/AddNamesToCallArgumentsIntention.kt @@ -21,7 +21,8 @@ import com.intellij.openapi.util.TextRange import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall import org.jetbrains.kotlin.idea.project.languageVersionSettings import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.resolve.calls.model.ArgumentMatch +import org.jetbrains.kotlin.psi.psiUtil.endOffset +import org.jetbrains.kotlin.psi.psiUtil.startOffset class AddNamesToCallArgumentsIntention : SelfTargetingRangeIntention( KtCallElement::class.java, @@ -38,7 +39,10 @@ class AddNamesToCallArgumentsIntention : SelfTargetingRangeIntention( + KtValueArgument::class.java, "Add names to this argument and following arguments" +), LowPriorityAction { + override fun isApplicableTo(element: KtValueArgument, caretOffset: Int): Boolean { + val argumentList = element.parent as? KtValueArgumentList ?: return false + // Shadowed by AddNamesToCallArguments + if (argumentList.arguments.firstOrNull() == element) return false + // Shadowed by AddNameToArgument + if (argumentList.arguments.lastOrNull { !it.isNamed() } == element) return false + val expression = element.getArgumentExpression() ?: return false + AddNameToArgumentIntention.detectNameToAdd(element, shouldBeLastUnnamed = false) ?: return false + + if (expression is KtLambdaExpression) { + val range = expression.textRange + return caretOffset == range.start || caretOffset == range.end + } + + return true + } + + override fun applyTo(element: KtValueArgument, editor: Editor?) { + val argumentList = element.parent as? KtValueArgumentList ?: return + val callElement = argumentList.parent as? KtCallElement ?: return + val resolvedCall = callElement.resolveToCall() ?: return + for (argument in argumentList.arguments.dropWhile { it != element }) { + AddNameToArgumentIntention.apply(argument, resolvedCall) + } + } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/booleanLiteralArgument/booleanLiteralFixAll.kt b/idea/testData/inspectionsLocal/booleanLiteralArgument/booleanLiteralFixAll.kt index ee322533b24..b73742d2768 100644 --- a/idea/testData/inspectionsLocal/booleanLiteralArgument/booleanLiteralFixAll.kt +++ b/idea/testData/inspectionsLocal/booleanLiteralArgument/booleanLiteralFixAll.kt @@ -1,7 +1,7 @@ // HIGHLIGHT: GENERIC_ERROR_OR_WARNING -// FIX: Add names to boolean arguments +// FIX: Add names to call arguments fun foo(a: Boolean, b: Boolean, c: Boolean) {} fun test() { - foo(true, true, true) + foo(true, true, true) } \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/booleanLiteralArgument/booleanLiteralFixAll.kt.after b/idea/testData/inspectionsLocal/booleanLiteralArgument/booleanLiteralFixAll.kt.after index 14b502c7010..99251ab678b 100644 --- a/idea/testData/inspectionsLocal/booleanLiteralArgument/booleanLiteralFixAll.kt.after +++ b/idea/testData/inspectionsLocal/booleanLiteralArgument/booleanLiteralFixAll.kt.after @@ -1,5 +1,5 @@ // HIGHLIGHT: GENERIC_ERROR_OR_WARNING -// FIX: Add names to boolean arguments +// FIX: Add names to call arguments fun foo(a: Boolean, b: Boolean, c: Boolean) {} fun test() { diff --git a/idea/testData/inspectionsLocal/booleanLiteralArgument/booleanLiteralFixPart.kt b/idea/testData/inspectionsLocal/booleanLiteralArgument/booleanLiteralFixPart.kt index 774d64944c3..bc9033ae4a2 100644 --- a/idea/testData/inspectionsLocal/booleanLiteralArgument/booleanLiteralFixPart.kt +++ b/idea/testData/inspectionsLocal/booleanLiteralArgument/booleanLiteralFixPart.kt @@ -1,7 +1,7 @@ // HIGHLIGHT: GENERIC_ERROR_OR_WARNING -// FIX: Add names to boolean arguments +// FIX: Add names to call arguments fun foo(a: Boolean, b: Boolean, c: Boolean) {} fun test() { - foo(true, true, c = true) + foo(true, true, c = true) } \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/booleanLiteralArgument/booleanLiteralFixPart.kt.after b/idea/testData/inspectionsLocal/booleanLiteralArgument/booleanLiteralFixPart.kt.after index 14b502c7010..99251ab678b 100644 --- a/idea/testData/inspectionsLocal/booleanLiteralArgument/booleanLiteralFixPart.kt.after +++ b/idea/testData/inspectionsLocal/booleanLiteralArgument/booleanLiteralFixPart.kt.after @@ -1,5 +1,5 @@ // HIGHLIGHT: GENERIC_ERROR_OR_WARNING -// FIX: Add names to boolean arguments +// FIX: Add names to call arguments fun foo(a: Boolean, b: Boolean, c: Boolean) {} fun test() { diff --git a/idea/testData/intentions/addNamesToCallArguments/simple.kt b/idea/testData/intentions/addNamesToCallArguments/simple.kt index 1916303271f..391bfb95857 100644 --- a/idea/testData/intentions/addNamesToCallArguments/simple.kt +++ b/idea/testData/intentions/addNamesToCallArguments/simple.kt @@ -1,5 +1,5 @@ fun foo(s: String, b: Boolean){} fun bar() { - foo("", true) + foo("", true) } \ No newline at end of file diff --git a/idea/testData/intentions/addNamesToCallArguments/simple.kt.after b/idea/testData/intentions/addNamesToCallArguments/simple.kt.after index a1a10dd0c27..94250e8b380 100644 --- a/idea/testData/intentions/addNamesToCallArguments/simple.kt.after +++ b/idea/testData/intentions/addNamesToCallArguments/simple.kt.after @@ -1,5 +1,5 @@ fun foo(s: String, b: Boolean){} fun bar() { - foo(s = "", b = true) + foo(s = "", b = true) } \ No newline at end of file diff --git a/idea/testData/intentions/addNamesToCallArguments/notOnCallee.kt b/idea/testData/intentions/addNamesToCallArguments/singleArgument.kt similarity index 100% rename from idea/testData/intentions/addNamesToCallArguments/notOnCallee.kt rename to idea/testData/intentions/addNamesToCallArguments/singleArgument.kt diff --git a/idea/testData/intentions/addNamesToFollowingArguments/.intention b/idea/testData/intentions/addNamesToFollowingArguments/.intention new file mode 100644 index 00000000000..bfd9cae9d6b --- /dev/null +++ b/idea/testData/intentions/addNamesToFollowingArguments/.intention @@ -0,0 +1 @@ +org.jetbrains.kotlin.idea.intentions.AddNamesToFollowingArgumentsIntention diff --git a/idea/testData/intentions/addNamesToFollowingArguments/first.kt b/idea/testData/intentions/addNamesToFollowingArguments/first.kt new file mode 100644 index 00000000000..8d89424b0e8 --- /dev/null +++ b/idea/testData/intentions/addNamesToFollowingArguments/first.kt @@ -0,0 +1,6 @@ +// IS_APPLICABLE: false +fun foo(first: Int, second: Boolean, last: String) {} + +fun test() { + foo(1, true, "") +} \ No newline at end of file diff --git a/idea/testData/intentions/addNamesToFollowingArguments/last.kt b/idea/testData/intentions/addNamesToFollowingArguments/last.kt new file mode 100644 index 00000000000..4c0d558d9b5 --- /dev/null +++ b/idea/testData/intentions/addNamesToFollowingArguments/last.kt @@ -0,0 +1,6 @@ +// IS_APPLICABLE: false +fun foo(first: Int, second: Boolean, last: String) {} + +fun test() { + foo(1, true, "") +} \ No newline at end of file diff --git a/idea/testData/intentions/addNamesToFollowingArguments/simple.kt b/idea/testData/intentions/addNamesToFollowingArguments/simple.kt new file mode 100644 index 00000000000..f06636192da --- /dev/null +++ b/idea/testData/intentions/addNamesToFollowingArguments/simple.kt @@ -0,0 +1,5 @@ +fun foo(first: Int, second: Boolean, last: String) {} + +fun test() { + foo(1, true, "") +} \ No newline at end of file diff --git a/idea/testData/intentions/addNamesToFollowingArguments/simple.kt.after b/idea/testData/intentions/addNamesToFollowingArguments/simple.kt.after new file mode 100644 index 00000000000..299983ee564 --- /dev/null +++ b/idea/testData/intentions/addNamesToFollowingArguments/simple.kt.after @@ -0,0 +1,5 @@ +fun foo(first: Int, second: Boolean, last: String) {} + +fun test() { + foo(1, second = true, last = "") +} \ 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 a4119faf57e..d03dc2e7d96 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java @@ -1314,11 +1314,6 @@ public class IntentionTestGenerated extends AbstractIntentionTest { runTest("idea/testData/intentions/addNamesToCallArguments/javaMethod.kt"); } - @TestMetadata("notOnCallee.kt") - public void testNotOnCallee() throws Exception { - runTest("idea/testData/intentions/addNamesToCallArguments/notOnCallee.kt"); - } - @TestMetadata("notResolved.kt") public void testNotResolved() throws Exception { runTest("idea/testData/intentions/addNamesToCallArguments/notResolved.kt"); @@ -1329,6 +1324,11 @@ public class IntentionTestGenerated extends AbstractIntentionTest { runTest("idea/testData/intentions/addNamesToCallArguments/simple.kt"); } + @TestMetadata("singleArgument.kt") + public void testSingleArgument() throws Exception { + runTest("idea/testData/intentions/addNamesToCallArguments/singleArgument.kt"); + } + @TestMetadata("superClassConstructor.kt") public void testSuperClassConstructor() throws Exception { runTest("idea/testData/intentions/addNamesToCallArguments/superClassConstructor.kt"); @@ -1355,6 +1355,34 @@ public class IntentionTestGenerated extends AbstractIntentionTest { } } + @TestMetadata("idea/testData/intentions/addNamesToFollowingArguments") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class AddNamesToFollowingArguments extends AbstractIntentionTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + public void testAllFilesPresentInAddNamesToFollowingArguments() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/addNamesToFollowingArguments"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true); + } + + @TestMetadata("first.kt") + public void testFirst() throws Exception { + runTest("idea/testData/intentions/addNamesToFollowingArguments/first.kt"); + } + + @TestMetadata("last.kt") + public void testLast() throws Exception { + runTest("idea/testData/intentions/addNamesToFollowingArguments/last.kt"); + } + + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("idea/testData/intentions/addNamesToFollowingArguments/simple.kt"); + } + } + @TestMetadata("idea/testData/intentions/addOpenModifier") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)