Convert receiver to parameter: place value argument list after type argument list
#KT-41499 Fixed
This commit is contained in:
committed by
Dmitry Gridin
parent
b1629cc5f4
commit
f9f8fd055b
+3
-2
@@ -77,8 +77,9 @@ class KotlinFunctionCallUsage(
|
||||
changeNameIfNeeded(changeInfo, element)
|
||||
|
||||
if (element.valueArgumentList == null && changeInfo.isParameterSetOrOrderChanged && element.lambdaArguments.isNotEmpty()) {
|
||||
element.calleeExpression?.let {
|
||||
element.addAfter(KtPsiFactory(element).createCallArguments("()"), it)
|
||||
val anchor = element.typeArgumentList ?: element.calleeExpression
|
||||
if (anchor != null) {
|
||||
element.addAfter(KtPsiFactory(element).createCallArguments("()"), anchor)
|
||||
}
|
||||
}
|
||||
if (element.valueArgumentList != null) {
|
||||
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
fun <T> <caret>Any.foo(callback: () -> Unit) {}
|
||||
|
||||
fun bar() {
|
||||
"".foo<Int> {}
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
fun <T> foo(any: Any, callback: () -> Unit) {}
|
||||
|
||||
fun bar() {
|
||||
foo<Int>("") {}
|
||||
}
|
||||
@@ -6472,6 +6472,11 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
|
||||
runTest("idea/testData/intentions/convertReceiverToParameter/usedInAnonymousObject.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("usedWithTypeArgumentAndLambdaArgument.kt")
|
||||
public void testUsedWithTypeArgumentAndLambdaArgument() throws Exception {
|
||||
runTest("idea/testData/intentions/convertReceiverToParameter/usedWithTypeArgumentAndLambdaArgument.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("validOverload.kt")
|
||||
public void testValidOverload() throws Exception {
|
||||
runTest("idea/testData/intentions/convertReceiverToParameter/validOverload.kt");
|
||||
|
||||
Reference in New Issue
Block a user