diff --git a/plugins/kotlin/base/util/src/org/jetbrains/kotlin/util/CollectionUtils.kt b/plugins/kotlin/base/util/src/org/jetbrains/kotlin/util/CollectionUtils.kt index b4ddfbacf440..6dbc14087762 100644 --- a/plugins/kotlin/base/util/src/org/jetbrains/kotlin/util/CollectionUtils.kt +++ b/plugins/kotlin/base/util/src/org/jetbrains/kotlin/util/CollectionUtils.kt @@ -19,4 +19,7 @@ fun merge(vararg maps: Map?): Map { } } return result -} \ No newline at end of file +} + +@Suppress("UNCHECKED_CAST") +inline fun Sequence<*>.takeWhileIsInstance(): Sequence = takeWhile { it is T } as Sequence diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/codeInsight/unwrap/KotlinFunctionParameterUnwrapper.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/codeInsight/unwrap/KotlinFunctionParameterUnwrapper.kt index cff70c00dd6f..795f4b466714 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/codeInsight/unwrap/KotlinFunctionParameterUnwrapper.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/codeInsight/unwrap/KotlinFunctionParameterUnwrapper.kt @@ -2,26 +2,190 @@ package org.jetbrains.kotlin.idea.codeInsight.unwrap +import com.intellij.psi.PsiComment import com.intellij.psi.PsiElement -import org.jetbrains.kotlin.psi.KtCallExpression -import org.jetbrains.kotlin.psi.KtValueArgument +import com.intellij.psi.PsiWhiteSpace +import com.intellij.psi.util.elementType +import org.jetbrains.kotlin.idea.base.resources.KotlinBundle +import org.jetbrains.kotlin.idea.refactoring.getExpressionShortText +import org.jetbrains.kotlin.idea.util.isComma +import org.jetbrains.kotlin.lexer.KtTokens +import org.jetbrains.kotlin.psi.* +import org.jetbrains.kotlin.psi.psiUtil.getNextSiblingIgnoringWhitespaceAndComments +import org.jetbrains.kotlin.psi.psiUtil.getPrevSiblingIgnoringWhitespaceAndComments import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType +import org.jetbrains.kotlin.psi.psiUtil.parentsWithSelf +import org.jetbrains.kotlin.util.takeWhileIsInstance +import org.jetbrains.kotlin.utils.addToStdlib.ifTrue +import org.jetbrains.kotlin.utils.addToStdlib.safeAs -class KotlinFunctionParameterUnwrapper(key: String) : KotlinUnwrapRemoveBase(key) { +class KotlinFunctionParameterUnwrapper(val key: String) : KotlinUnwrapRemoveBase(key) { override fun isApplicableTo(element: PsiElement): Boolean { - if (element !is KtCallExpression) return false - if (element.valueArguments.size != 1) return false - val argument = element.parent as? KtValueArgument ?: return false - if (argument.getStrictParentOfType() == null) return false + val argumentToUnwrap = argumentToUnwrap(element) ?: return false + deletionTarget(argumentToUnwrap) ?: return false + + return true + } + + private fun argumentToUnwrap(element: PsiElement?): KtValueArgument? { + if (element == null) return null + + nearbySingleArg(element)?.let { + return it + } + when (element) { + is KtValueArgument -> return element + else -> { + if (element.parent !is KtValueArgumentList) return null + + if (element.isComma || element.elementType == KtTokens.RPAR || element is PsiWhiteSpace || element is PsiComment) { + return findAdjacentValueArgumentInsideParen(element) + } else return null + } + } + } + + /** + * When outside a function call's parenthesized arguments but the function has a single argument, choose that + * ``` + * ┌ LPAR + * │ + * v + * methodCall(arguments) + * ^^^^^^^^^^ + * │ + * └ Identifier + * ``` + * + */ + private fun nearbySingleArg(element: PsiElement): KtValueArgument? { + // a.b.c.d(123) + // ^^^^^^^ + // walk up chained dot expressions until we find the one that has a call as rhs + // we use this complicated rather than just have isApplicableTo apply to a KtQualifiedExpression to get priority over + // "Remove" unwrap item + fun caretOnQualifier(qualifiedExpression: KtQualifiedExpression): KtCallExpression? = + qualifiedExpression.parentsWithSelf.takeWhileIsInstance().last().selectorExpression as? KtCallExpression + + val callExpression: KtCallExpression = when (element.elementType) { + KtTokens.LPAR -> { + element.parent?.safeAs() + ?.parent?.safeAs() ?: return null + } + KtTokens.DOT, KtTokens.SAFE_ACCESS -> { + element.parent?.safeAs() + ?.let { caretOnQualifier(it) } ?: return null + } + KtTokens.IDENTIFIER -> { + val referenceExpression = element.parent?.safeAs() + when (val parent = referenceExpression?.parent) { + is KtCallExpression -> parent + is KtQualifiedExpression -> { + caretOnQualifier(parent) + } + else -> null + } ?: return null + // we could just handle this on + } + else -> return null + } + + val ktValueArgumentList = callExpression.valueArgumentList + if (ktValueArgumentList?.arguments.isNullOrEmpty()) { + // if there's no parenthesized arguments, unwrap trailing lambda if any + return callExpression.lambdaArguments.singleOrNull() + } + + // there are parenthesized arguments, only consider if there's exactly one + return ktValueArgumentList?.arguments?.singleOrNull() + } + + /** + * When inside a function call's parenthesized arguments. + * + * * for Comma and RPAR, we scan towards the left + * * for whitespace, we scan leftwards and rightwards + * + * ``` + * ┌ COMMA + * │ ┌ RPAR + * │ │ + * v v + * methodCall(1, 2 , 3 ) + * ^ ^ ^ + * │ │ │ + * Whitespace ┴───┴─┘ + * ``` + * + */ + private fun findAdjacentValueArgumentInsideParen(element: PsiElement): KtValueArgument? { + if (element.parent !is KtValueArgumentList) { + return null + } + + return when { + element.elementType == KtTokens.RPAR -> { + // caret after last argument before closing paren, argument is the last element + val valueArgumentList = element.parent as? KtValueArgumentList ?: return null + if (valueArgumentList.parent !is KtCallExpression) return null + return valueArgumentList.arguments.lastOrNull() + } + element.isComma -> { + // caret before comma, choose previous argument + val previous = element.getPrevSiblingIgnoringWhitespaceAndComments() + isCallArgument(previous).ifTrue { previous as KtValueArgument } + } + element is PsiWhiteSpace || element is PsiComment -> { + // caret before blank or in comment, argument could be towards the left or the right + val previous = element.getPrevSiblingIgnoringWhitespaceAndComments() + if (isCallArgument(previous)) return previous as KtValueArgument + + val next = element.getNextSiblingIgnoringWhitespaceAndComments() + if (isCallArgument(next)) return next as KtValueArgument + + null + } + else -> null + } + } + + private fun isCallArgument(element: PsiElement?): Boolean { + if (element is KtLambdaArgument) return false + if (element !is KtValueArgument) return false + val argumentList = element.parent as KtValueArgumentList + if (argumentList.parent !is KtCallExpression) return false + return true } override fun doUnwrap(element: PsiElement?, context: Context?) { - val function = element as? KtCallExpression ?: return - val argument = element.valueArguments.firstOrNull()?.getArgumentExpression() ?: return - context?.extractFromExpression(argument, function) - context?.delete(function) + val valueArgument = argumentToUnwrap(element) ?: return + val deletionTarget = deletionTarget(valueArgument) ?: return + val argument = valueArgument.getArgumentExpression() ?: return + context?.extractFromExpression(argument, deletionTarget) + context?.delete(deletionTarget) } + private fun deletionTarget(valueArgument: KtValueArgument): KtElement? { + var function: KtElement = valueArgument.getStrictParentOfType() ?: return null + val parent = function.parent + if (parent is KtQualifiedExpression) { + function = parent + } + return function + } + + override fun collectAffectedElements(e: PsiElement, toExtract: MutableList): PsiElement { + super.collectAffectedElements(e, toExtract) + return argumentToUnwrap(e)?.let { deletionTarget(it) } ?: e + } + + override fun getDescription(e: PsiElement): String { + // necessary because the base implementation expects to be called for KtElement + // but because we support the caret to be on LPAR/COMMA and other tokens this doesn't work + + val target = argumentToUnwrap(e) ?: error("Description asked for a non applicable unwrapper") + return KotlinBundle.message(key, getExpressionShortText(target)) + } } diff --git a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/codeInsight/unwrap/UnwrapRemoveTestGenerated.java b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/codeInsight/unwrap/UnwrapRemoveTestGenerated.java index c49df19b0b40..aa3ac246ee12 100644 --- a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/codeInsight/unwrap/UnwrapRemoveTestGenerated.java +++ b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/codeInsight/unwrap/UnwrapRemoveTestGenerated.java @@ -303,19 +303,129 @@ public abstract class UnwrapRemoveTestGenerated extends AbstractUnwrapRemoveTest KotlinTestUtils.runTest(this::doTestFunctionParameterUnwrapper, this, testDataFilePath); } + @TestMetadata("caretBeforeComma.kt") + public void testCaretBeforeComma() throws Exception { + runTest("testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretBeforeComma.kt"); + } + + @TestMetadata("caretInComment1.kt") + public void testCaretInComment1() throws Exception { + runTest("testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInComment1.kt"); + } + + @TestMetadata("caretInComment2.kt") + public void testCaretInComment2() throws Exception { + runTest("testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInComment2.kt"); + } + + @TestMetadata("caretInLambda.kt") + public void testCaretInLambda() throws Exception { + runTest("testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInLambda.kt"); + } + + @TestMetadata("caretInLambda2.kt") + public void testCaretInLambda2() throws Exception { + runTest("testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInLambda2.kt"); + } + + @TestMetadata("caretInLambda3.kt") + public void testCaretInLambda3() throws Exception { + runTest("testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInLambda3.kt"); + } + + @TestMetadata("caretInQualifier1.kt") + public void testCaretInQualifier1() throws Exception { + runTest("testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier1.kt"); + } + + @TestMetadata("caretInQualifier2.kt") + public void testCaretInQualifier2() throws Exception { + runTest("testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier2.kt"); + } + + @TestMetadata("caretInQualifier3.kt") + public void testCaretInQualifier3() throws Exception { + runTest("testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier3.kt"); + } + + @TestMetadata("caretInQualifier4.kt") + public void testCaretInQualifier4() throws Exception { + runTest("testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier4.kt"); + } + + @TestMetadata("caretInQualifier5.kt") + public void testCaretInQualifier5() throws Exception { + runTest("testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier5.kt"); + } + + @TestMetadata("caretInQualifier6.kt") + public void testCaretInQualifier6() throws Exception { + runTest("testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier6.kt"); + } + + @TestMetadata("caretInQualifier7.kt") + public void testCaretInQualifier7() throws Exception { + runTest("testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier7.kt"); + } + @TestMetadata("functionHasMultiParam.kt") public void testFunctionHasMultiParam() throws Exception { runTest("testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/functionHasMultiParam.kt"); } + @TestMetadata("functionHasMultiParam1.kt") + public void testFunctionHasMultiParam1() throws Exception { + runTest("testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/functionHasMultiParam1.kt"); + } + + @TestMetadata("functionHasMultiParam2.kt") + public void testFunctionHasMultiParam2() throws Exception { + runTest("testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/functionHasMultiParam2.kt"); + } + @TestMetadata("functionHasSingleParam.kt") public void testFunctionHasSingleParam() throws Exception { runTest("testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/functionHasSingleParam.kt"); } - @TestMetadata("functionWithReceiver.kt") - public void testFunctionWithReceiver() throws Exception { - runTest("testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/functionWithReceiver.kt"); + @TestMetadata("nestedFunctionWithReceiver.kt") + public void testNestedFunctionWithReceiver() throws Exception { + runTest("testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/nestedFunctionWithReceiver.kt"); + } + + @TestMetadata("nestedSingleParamCall.kt") + public void testNestedSingleParamCall() throws Exception { + runTest("testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/nestedSingleParamCall.kt"); + } + + @TestMetadata("nestedSingleParamCall.option1.kt") + public void testNestedSingleParamCall_option1() throws Exception { + runTest("testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/nestedSingleParamCall.option1.kt"); + } + + @TestMetadata("topLevelMultiParamCall_beforeIdentifier.kt") + public void testTopLevelMultiParamCall_beforeIdentifier() throws Exception { + runTest("testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/topLevelMultiParamCall_beforeIdentifier.kt"); + } + + @TestMetadata("topLevelMultiParamCall_beforeLeftParen.kt") + public void testTopLevelMultiParamCall_beforeLeftParen() throws Exception { + runTest("testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/topLevelMultiParamCall_beforeLeftParen.kt"); + } + + @TestMetadata("topLevelMultiParamCall_beforeRightParen.kt") + public void testTopLevelMultiParamCall_beforeRightParen() throws Exception { + runTest("testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/topLevelMultiParamCall_beforeRightParen.kt"); + } + + @TestMetadata("topLevelMultiParamCall_onIdentifier.kt") + public void testTopLevelMultiParamCall_onIdentifier() throws Exception { + runTest("testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/topLevelMultiParamCall_onIdentifier.kt"); + } + + @TestMetadata("topLevelSingleParamCall_onIdentifier.kt") + public void testTopLevelSingleParamCall_onIdentifier() throws Exception { + runTest("testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/topLevelSingleParamCall_onIdentifier.kt"); } } } diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretBeforeComma.kt b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretBeforeComma.kt new file mode 100644 index 000000000000..5affed75db0f --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretBeforeComma.kt @@ -0,0 +1,7 @@ +// OPTION: 0 +fun test() { + val i = 1 + foo(1 , 2) +} + +fun foo(i: Int, i2: Int) {} diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretBeforeComma.kt.after b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretBeforeComma.kt.after new file mode 100644 index 000000000000..b8951fde5121 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretBeforeComma.kt.after @@ -0,0 +1,7 @@ +// OPTION: 0 +fun test() { + val i = 1 + 1 +} + +fun foo(i: Int, i2: Int) {} diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInComment1.kt b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInComment1.kt new file mode 100644 index 000000000000..2a38115a0bbb --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInComment1.kt @@ -0,0 +1,7 @@ +// OPTION: 0 +fun test() { + val i = 1 + foo(/* */ 1, 2) +} + +fun foo(i: Int, i2: Int) {} diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInComment1.kt.after b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInComment1.kt.after new file mode 100644 index 000000000000..e6b756bde1ea --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInComment1.kt.after @@ -0,0 +1,7 @@ +// OPTION: 0 +fun test() { + val i = 1 + 1 +} + +fun foo(i: Int, i2: Int) {} diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInComment2.kt b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInComment2.kt new file mode 100644 index 000000000000..40e58bf32dee --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInComment2.kt @@ -0,0 +1,7 @@ +// OPTION: 0 +fun test() { + val i = 1 + foo(1 /* */, 2) +} + +fun foo(i: Int, i2: Int) {} diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInComment2.kt.after b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInComment2.kt.after new file mode 100644 index 000000000000..e6b756bde1ea --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInComment2.kt.after @@ -0,0 +1,7 @@ +// OPTION: 0 +fun test() { + val i = 1 + 1 +} + +fun foo(i: Int, i2: Int) {} diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInLambda.kt b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInLambda.kt new file mode 100644 index 000000000000..9e56f11b94c9 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInLambda.kt @@ -0,0 +1,8 @@ +// OPTION: 2 +fun test() { + foo { + val x = 1 + } +} + +fun foo(body: () -> Unit) {} \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInLambda.kt.after b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInLambda.kt.after new file mode 100644 index 000000000000..b3e14a2382c3 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInLambda.kt.after @@ -0,0 +1,8 @@ +// OPTION: 2 +fun test() { + { + val x = 1 + } +} + +fun foo(body: () -> Unit) {} \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInLambda2.kt b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInLambda2.kt new file mode 100644 index 000000000000..be52b83120d8 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInLambda2.kt @@ -0,0 +1,8 @@ +// OPTION: 2 +fun test() { + foo(1) { + val x = 1 + } +} + +fun foo(a: Int, body: () -> Unit) {} \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInLambda2.kt.after b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInLambda2.kt.after new file mode 100644 index 000000000000..c037093b6cd7 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInLambda2.kt.after @@ -0,0 +1,8 @@ +// OPTION: 2 +fun test() { + { + val x = 1 + } +} + +fun foo(a: Int, body: () -> Unit) {} \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInLambda3.kt b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInLambda3.kt new file mode 100644 index 000000000000..e022107b6ed6 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInLambda3.kt @@ -0,0 +1,8 @@ +// OPTION: 2 +fun test() { + foo(1, body = { + val x = 1 + }) +} + +fun foo(a: Int, body: () -> Unit) {} \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInLambda3.kt.after b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInLambda3.kt.after new file mode 100644 index 000000000000..c037093b6cd7 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInLambda3.kt.after @@ -0,0 +1,8 @@ +// OPTION: 2 +fun test() { + { + val x = 1 + } +} + +fun foo(a: Int, body: () -> Unit) {} \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier1.kt b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier1.kt new file mode 100644 index 000000000000..58a04449d18d --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier1.kt @@ -0,0 +1,10 @@ +// OPTION: 0 +fun test() { + val i = 1 + val test = Test() + test.qux(i) +} + +class Test { + fun qux(i: Int) = 1 +} diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier1.kt.after b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier1.kt.after new file mode 100644 index 000000000000..348796217ae2 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier1.kt.after @@ -0,0 +1,10 @@ +// OPTION: 0 +fun test() { + val i = 1 + val test = Test() + i +} + +class Test { + fun qux(i: Int) = 1 +} diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier2.kt b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier2.kt new file mode 100644 index 000000000000..79c1bc9593a9 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier2.kt @@ -0,0 +1,12 @@ +// OPTION: 0 +fun test() { + val i = 1 + val test = Test() + test.test.qux(i) +} + +class Test { + val test: Test + get() = Test() + fun qux(i: Int) = 1 +} diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier2.kt.after b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier2.kt.after new file mode 100644 index 000000000000..1a8be42c396b --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier2.kt.after @@ -0,0 +1,12 @@ +// OPTION: 0 +fun test() { + val i = 1 + val test = Test() + i +} + +class Test { + val test: Test + get() = Test() + fun qux(i: Int) = 1 +} diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier3.kt b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier3.kt new file mode 100644 index 000000000000..465233ce61bf --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier3.kt @@ -0,0 +1,12 @@ +// OPTION: 0 +fun test() { + val i = 1 + val test = Test() + test.test.qux(i) +} + +class Test { + val test: Test + get() = Test() + fun qux(i: Int) = 1 +} diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier3.kt.after b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier3.kt.after new file mode 100644 index 000000000000..1a8be42c396b --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier3.kt.after @@ -0,0 +1,12 @@ +// OPTION: 0 +fun test() { + val i = 1 + val test = Test() + i +} + +class Test { + val test: Test + get() = Test() + fun qux(i: Int) = 1 +} diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier4.kt b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier4.kt new file mode 100644 index 000000000000..924dd0561ed7 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier4.kt @@ -0,0 +1,12 @@ +// OPTION: 0 +fun test() { + val i = 1 + val test = Test() + test.test.qux(i) +} + +class Test { + val test: Test + get() = Test() + fun qux(i: Int) = 1 +} diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier4.kt.after b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier4.kt.after new file mode 100644 index 000000000000..1a8be42c396b --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier4.kt.after @@ -0,0 +1,12 @@ +// OPTION: 0 +fun test() { + val i = 1 + val test = Test() + i +} + +class Test { + val test: Test + get() = Test() + fun qux(i: Int) = 1 +} diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier5.kt b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier5.kt new file mode 100644 index 000000000000..8519305dffa6 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier5.kt @@ -0,0 +1,12 @@ +// OPTION: 0 +fun test() { + val i = 1 + val test = Test() + test?.test.qux(i) +} + +class Test { + val test: Test + get() = Test() + fun qux(i: Int) = 1 +} diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier5.kt.after b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier5.kt.after new file mode 100644 index 000000000000..1a8be42c396b --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier5.kt.after @@ -0,0 +1,12 @@ +// OPTION: 0 +fun test() { + val i = 1 + val test = Test() + i +} + +class Test { + val test: Test + get() = Test() + fun qux(i: Int) = 1 +} diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier6.kt b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier6.kt new file mode 100644 index 000000000000..50249924b044 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier6.kt @@ -0,0 +1,12 @@ +// OPTION: 0 +fun test() { + val i = 1 + val test = Test() + test.test.test.qux(i) +} + +class Test { + val test: Test + get() = Test() + fun qux(i: Int) = 1 +} diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier6.kt.after b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier6.kt.after new file mode 100644 index 000000000000..1a8be42c396b --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier6.kt.after @@ -0,0 +1,12 @@ +// OPTION: 0 +fun test() { + val i = 1 + val test = Test() + i +} + +class Test { + val test: Test + get() = Test() + fun qux(i: Int) = 1 +} diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier7.kt b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier7.kt new file mode 100644 index 000000000000..d0ad30566541 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier7.kt @@ -0,0 +1,11 @@ +// OPTION: 0 +fun test() { + val test = Test() + test.test.test.qux { val i = 1 } +} + +class Test { + val test: Test + get() = Test() + fun qux(body: () -> Unit) = 1 +} \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier7.kt.after b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier7.kt.after new file mode 100644 index 000000000000..0120be0c3f05 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/caretInQualifier7.kt.after @@ -0,0 +1,11 @@ +// OPTION: 0 +fun test() { + val test = Test() + { val i = 1 } +} + +class Test { + val test: Test + get() = Test() + fun qux(body: () -> Unit) = 1 +} \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/functionHasMultiParam.kt b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/functionHasMultiParam.kt index 3b95f3d5f50f..4119660d4de7 100644 --- a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/functionHasMultiParam.kt +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/functionHasMultiParam.kt @@ -1,4 +1,4 @@ -// IS_APPLICABLE: false +// OPTION: 0 fun test() { val i = 1 foo(baz(i, 2)) diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/functionHasMultiParam.kt.after b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/functionHasMultiParam.kt.after new file mode 100644 index 000000000000..c29b9ce8d5dc --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/functionHasMultiParam.kt.after @@ -0,0 +1,9 @@ +// OPTION: 0 +fun test() { + val i = 1 + baz(i, 2) +} + +fun foo(i: Int) {} + +fun baz(i: Int, j: Int) = 1 diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/functionHasMultiParam1.kt b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/functionHasMultiParam1.kt new file mode 100644 index 000000000000..21dbd5d7eb0e --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/functionHasMultiParam1.kt @@ -0,0 +1,9 @@ +// OPTION: 0 +fun test() { + val i = 1 + foo(baz(i, 2)) +} + +fun foo(i: Int) {} + +fun baz(i: Int, j: Int) = 1 diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/functionHasMultiParam1.kt.after b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/functionHasMultiParam1.kt.after new file mode 100644 index 000000000000..ee736b0df7e6 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/functionHasMultiParam1.kt.after @@ -0,0 +1,9 @@ +// OPTION: 0 +fun test() { + val i = 1 + foo(i) +} + +fun foo(i: Int) {} + +fun baz(i: Int, j: Int) = 1 diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/functionHasMultiParam2.kt b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/functionHasMultiParam2.kt new file mode 100644 index 000000000000..289bf3e750db --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/functionHasMultiParam2.kt @@ -0,0 +1,9 @@ +// OPTION: 0 +fun test() { + val i = 1 + foo(123, 456) +} + +fun foo(i: Int) {} + +fun baz(i: Int, j: Int) = 1 diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/functionHasMultiParam2.kt.after b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/functionHasMultiParam2.kt.after new file mode 100644 index 000000000000..05dcf55577c8 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/functionHasMultiParam2.kt.after @@ -0,0 +1,9 @@ +// OPTION: 0 +fun test() { + val i = 1 + 456 +} + +fun foo(i: Int) {} + +fun baz(i: Int, j: Int) = 1 diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/functionHasSingleParam.kt b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/functionHasSingleParam.kt index e6b3435007a4..ff74f69e3b39 100644 --- a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/functionHasSingleParam.kt +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/functionHasSingleParam.kt @@ -1,7 +1,7 @@ // OPTION: 0 fun test() { val i = 1 - foo(bar(1)) + foo(bar(1)) } fun foo(i: Int) {} diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/functionWithReceiver.kt b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/nestedFunctionWithReceiver.kt similarity index 85% rename from plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/functionWithReceiver.kt rename to plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/nestedFunctionWithReceiver.kt index dc76e5031ac2..fa792e703966 100644 --- a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/functionWithReceiver.kt +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/nestedFunctionWithReceiver.kt @@ -1,4 +1,4 @@ -// IS_APPLICABLE: false +// OPTION: 0 fun test() { val i = 1 val test = Test() diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/nestedFunctionWithReceiver.kt.after b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/nestedFunctionWithReceiver.kt.after new file mode 100644 index 000000000000..dc60cadb3379 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/nestedFunctionWithReceiver.kt.after @@ -0,0 +1,12 @@ +// OPTION: 0 +fun test() { + val i = 1 + val test = Test() + foo(i) +} + +fun foo(i: Int) {} + +class Test { + fun qux(i: Int) = 1 +} diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/nestedSingleParamCall.kt b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/nestedSingleParamCall.kt new file mode 100644 index 000000000000..e6b3435007a4 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/nestedSingleParamCall.kt @@ -0,0 +1,9 @@ +// OPTION: 0 +fun test() { + val i = 1 + foo(bar(1)) +} + +fun foo(i: Int) {} + +fun bar(i: Int) = 1 diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/nestedSingleParamCall.kt.after b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/nestedSingleParamCall.kt.after new file mode 100644 index 000000000000..06a34719a931 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/nestedSingleParamCall.kt.after @@ -0,0 +1,9 @@ +// OPTION: 0 +fun test() { + val i = 1 + foo(1) +} + +fun foo(i: Int) {} + +fun bar(i: Int) = 1 diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/nestedSingleParamCall.option1.kt b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/nestedSingleParamCall.option1.kt new file mode 100644 index 000000000000..4e209881edd5 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/nestedSingleParamCall.option1.kt @@ -0,0 +1,9 @@ +// OPTION: 1 +fun test() { + val i = 1 + foo(bar(1)) +} + +fun foo(i: Int) {} + +fun bar(i: Int) = 1 diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/nestedSingleParamCall.option1.kt.after b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/nestedSingleParamCall.option1.kt.after new file mode 100644 index 000000000000..4814224d059d --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/nestedSingleParamCall.option1.kt.after @@ -0,0 +1,9 @@ +// OPTION: 1 +fun test() { + val i = 1 + bar(1) +} + +fun foo(i: Int) {} + +fun bar(i: Int) = 1 diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/topLevelMultiParamCall_beforeIdentifier.kt b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/topLevelMultiParamCall_beforeIdentifier.kt new file mode 100644 index 000000000000..5b85842e01a6 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/topLevelMultiParamCall_beforeIdentifier.kt @@ -0,0 +1,8 @@ +// IS_APPLICABLE: false +fun test() { + val i = 1 + foo(123, 456) +} + +fun foo(i: Int) {} + diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/topLevelMultiParamCall_beforeLeftParen.kt b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/topLevelMultiParamCall_beforeLeftParen.kt new file mode 100644 index 000000000000..c4f149383108 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/topLevelMultiParamCall_beforeLeftParen.kt @@ -0,0 +1,8 @@ +// IS_APPLICABLE: false +fun test() { + val i = 1 + foo(123, 456) +} + +fun foo(i: Int, j: Int) {} + diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/topLevelMultiParamCall_beforeRightParen.kt b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/topLevelMultiParamCall_beforeRightParen.kt new file mode 100644 index 000000000000..073d0c5957fe --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/topLevelMultiParamCall_beforeRightParen.kt @@ -0,0 +1,8 @@ +// OPTION: 0 +fun test() { + val i = 1 + foo(123, 456) +} + +fun foo(i: Int, j: Int) {} + diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/topLevelMultiParamCall_beforeRightParen.kt.after b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/topLevelMultiParamCall_beforeRightParen.kt.after new file mode 100644 index 000000000000..adb718271e25 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/topLevelMultiParamCall_beforeRightParen.kt.after @@ -0,0 +1,8 @@ +// OPTION: 0 +fun test() { + val i = 1 + 456 +} + +fun foo(i: Int, j: Int) {} + diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/topLevelMultiParamCall_onIdentifier.kt b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/topLevelMultiParamCall_onIdentifier.kt new file mode 100644 index 000000000000..281088bce4b1 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/topLevelMultiParamCall_onIdentifier.kt @@ -0,0 +1,9 @@ +// IS_APPLICABLE: false +fun test() { + val i = 1 + foo(123, 456) +} + +fun foo(i: Int) {} + +fun baz(i: Int, j: Int) = 1 diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/topLevelSingleParamCall_onIdentifier.kt b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/topLevelSingleParamCall_onIdentifier.kt new file mode 100644 index 000000000000..8c8d574a8480 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/topLevelSingleParamCall_onIdentifier.kt @@ -0,0 +1,7 @@ +// OPTION: 0 +fun test() { + val i = 1 + foo(123) +} + +fun foo(i: Int) {} diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/topLevelSingleParamCall_onIdentifier.kt.after b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/topLevelSingleParamCall_onIdentifier.kt.after new file mode 100644 index 000000000000..d3436a5e098d --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/codeInsight/unwrapAndRemove/unwrapFunctionParameter/topLevelSingleParamCall_onIdentifier.kt.after @@ -0,0 +1,7 @@ +// OPTION: 0 +fun test() { + val i = 1 + 123 +} + +fun foo(i: Int) {}