Replace deprecated symbol usage: move named lambda argument outside parentheses
#KT-31523 Fixed
This commit is contained in:
committed by
klunnii
parent
d9cf4ee732
commit
c09c0468d4
@@ -621,7 +621,6 @@ class CodeInliner<TCallElement : KtElement>(
|
|||||||
|
|
||||||
val argument = expr.parent as? KtValueArgument ?: return
|
val argument = expr.parent as? KtValueArgument ?: return
|
||||||
if (argument is KtLambdaArgument) return
|
if (argument is KtLambdaArgument) return
|
||||||
if (argument.isNamed()) return
|
|
||||||
val argumentList = argument.parent as? KtValueArgumentList ?: return
|
val argumentList = argument.parent as? KtValueArgumentList ?: return
|
||||||
if (argument != argumentList.arguments.last()) return
|
if (argument != argumentList.arguments.last()) return
|
||||||
val callExpression = argumentList.parent as? KtCallExpression ?: return
|
val callExpression = argumentList.parent as? KtCallExpression ?: return
|
||||||
|
|||||||
+12
@@ -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.<caret>oldFun(p1 = "a") { true }
|
||||||
|
}
|
||||||
+12
@@ -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.<caret>newFun(p1 = "a", p2 = null) { true }
|
||||||
|
}
|
||||||
@@ -6923,6 +6923,11 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
|||||||
public void testKeepOutside() throws Exception {
|
public void testKeepOutside() throws Exception {
|
||||||
runTest("idea/testData/quickfix/deprecatedSymbolUsage/functionLiteralArguments/keepOutside.kt");
|
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")
|
@TestMetadata("idea/testData/quickfix/deprecatedSymbolUsage/imports")
|
||||||
|
|||||||
Reference in New Issue
Block a user