diff --git a/idea/src/org/jetbrains/kotlin/idea/codeInliner/CodeInliner.kt b/idea/src/org/jetbrains/kotlin/idea/codeInliner/CodeInliner.kt index 93fbca185ce..7e48db187b3 100644 --- a/idea/src/org/jetbrains/kotlin/idea/codeInliner/CodeInliner.kt +++ b/idea/src/org/jetbrains/kotlin/idea/codeInliner/CodeInliner.kt @@ -621,7 +621,6 @@ class CodeInliner( val argument = expr.parent as? KtValueArgument ?: return if (argument is KtLambdaArgument) return - if (argument.isNamed()) return val argumentList = argument.parent as? KtValueArgumentList ?: return if (argument != argumentList.arguments.last()) return val callExpression = argumentList.parent as? KtCallExpression ?: return diff --git a/idea/testData/quickfix/deprecatedSymbolUsage/functionLiteralArguments/keepOutsideWithNamedArgument.kt b/idea/testData/quickfix/deprecatedSymbolUsage/functionLiteralArguments/keepOutsideWithNamedArgument.kt new file mode 100644 index 00000000000..18aab648d88 --- /dev/null +++ b/idea/testData/quickfix/deprecatedSymbolUsage/functionLiteralArguments/keepOutsideWithNamedArgument.kt @@ -0,0 +1,12 @@ +// "Replace with 'newFun(p1, null, p2)'" "true" + +interface I { + @Deprecated("", ReplaceWith("newFun(p1, null, p2)")) + fun oldFun(p1: String, p2: () -> Boolean) + + fun newFun(p1: String, p2: String?, p3: () -> Boolean) +} + +fun foo(i: I) { + i.oldFun(p1 = "a") { true } +} diff --git a/idea/testData/quickfix/deprecatedSymbolUsage/functionLiteralArguments/keepOutsideWithNamedArgument.kt.after b/idea/testData/quickfix/deprecatedSymbolUsage/functionLiteralArguments/keepOutsideWithNamedArgument.kt.after new file mode 100644 index 00000000000..e131676d3f3 --- /dev/null +++ b/idea/testData/quickfix/deprecatedSymbolUsage/functionLiteralArguments/keepOutsideWithNamedArgument.kt.after @@ -0,0 +1,12 @@ +// "Replace with 'newFun(p1, null, p2)'" "true" + +interface I { + @Deprecated("", ReplaceWith("newFun(p1, null, p2)")) + fun oldFun(p1: String, p2: () -> Boolean) + + fun newFun(p1: String, p2: String?, p3: () -> Boolean) +} + +fun foo(i: I) { + i.newFun(p1 = "a", p2 = null) { true } +} diff --git a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java index 359e6751ad5..c75773fc393 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java @@ -6923,6 +6923,11 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest { public void testKeepOutside() throws Exception { runTest("idea/testData/quickfix/deprecatedSymbolUsage/functionLiteralArguments/keepOutside.kt"); } + + @TestMetadata("keepOutsideWithNamedArgument.kt") + public void testKeepOutsideWithNamedArgument() throws Exception { + runTest("idea/testData/quickfix/deprecatedSymbolUsage/functionLiteralArguments/keepOutsideWithNamedArgument.kt"); + } } @TestMetadata("idea/testData/quickfix/deprecatedSymbolUsage/imports")