Change Signature: Substitute new function name into generated this-expressions
#KT-7920 Fixed
This commit is contained in:
+1
-1
@@ -56,7 +56,7 @@ public class JetParameterUsage(
|
||||
override fun getReplacementText(changeInfo: JetChangeInfo): String =
|
||||
if (changeInfo.receiverParameterInfo != parameterInfo) {
|
||||
parameterInfo.getInheritedName(containingFunction)
|
||||
} else "this@${containingFunction.getOriginalFunctionDescriptor().getName().asString()}"
|
||||
} else "this@${changeInfo.getNewName()}"
|
||||
}
|
||||
|
||||
public class JetNonQualifiedOuterThisUsage(
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class C {
|
||||
fun String.foo1() {
|
||||
print(this)
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class C {
|
||||
fun <caret>foo(p: String) {
|
||||
print(p)
|
||||
}
|
||||
}
|
||||
+9
-1
@@ -772,7 +772,8 @@ public class JetChangeSignatureTest extends KotlinCodeInsightTestCase {
|
||||
JetPsiFactory psiFactory = new JetPsiFactory(getProject());
|
||||
changeInfo.addParameter(
|
||||
new JetParameterInfo(changeInfo.getMethodDescriptor().getBaseDescriptor(),
|
||||
-1, "s", KotlinBuiltIns.getInstance().getStringType(), null, psiFactory.createExpression("\"foo\""), JetValVar.None, null));
|
||||
-1, "s", KotlinBuiltIns.getInstance().getStringType(), null, psiFactory.createExpression("\"foo\""),
|
||||
JetValVar.None, null));
|
||||
doTest(changeInfo);
|
||||
}
|
||||
|
||||
@@ -910,6 +911,13 @@ public class JetChangeSignatureTest extends KotlinCodeInsightTestCase {
|
||||
doTest(changeInfo);
|
||||
}
|
||||
|
||||
public void testConvertToExtensionAndRename() throws Exception {
|
||||
JetChangeInfo changeInfo = getChangeInfo();
|
||||
changeInfo.setReceiverParameterInfo(changeInfo.getNewParameters()[0]);
|
||||
changeInfo.setNewName("foo1");
|
||||
doTest(changeInfo);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
|
||||
Reference in New Issue
Block a user