Rename: Fix parameter rename when new name matches call selector
#KT-13476 Fixed
This commit is contained in:
@@ -274,6 +274,7 @@ Using 'this' as function argument in constructor of non-final class
|
||||
- [`KT-13124`](https://youtrack.jetbrains.com/issue/KT-13124) Pull Up: Skip super members without explicit declarations
|
||||
- [`KT-13032`](https://youtrack.jetbrains.com/issue/KT-13032) Rename: Support accessors with non-conventional names
|
||||
- [`KT-13463`](https://youtrack.jetbrains.com/issue/KT-13463) Rename: Quote parameter name when necessary
|
||||
- [`KT-13476`](https://youtrack.jetbrains.com/issue/KT-13476) Rename: Fix parameter rename when new name matches call selector
|
||||
|
||||
##### New features
|
||||
|
||||
|
||||
@@ -171,6 +171,7 @@ fun reportShadowing(
|
||||
result += BasicUnresolvableCollisionUsageInfo(refElement, elementToBindUsageInfoTo, message)
|
||||
}
|
||||
|
||||
// todo: break into smaller functions
|
||||
private fun checkUsagesRetargeting(
|
||||
elementToBindUsageInfosTo: PsiElement,
|
||||
declaration: PsiNamedElement,
|
||||
@@ -287,7 +288,9 @@ private fun checkUsagesRetargeting(
|
||||
continue
|
||||
}
|
||||
|
||||
usageIterator.set(UsageInfoWithReplacement(fullCallExpression, declaration, qualifiedExpression))
|
||||
if (fullCallExpression !is KtQualifiedExpression) {
|
||||
usageIterator.set(UsageInfoWithReplacement(fullCallExpression, declaration, qualifiedExpression))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
interface I {
|
||||
fun some()
|
||||
}
|
||||
|
||||
fun f(some: I) {
|
||||
println(some)
|
||||
some.some()
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
interface I {
|
||||
fun some()
|
||||
}
|
||||
|
||||
fun f(/*rename*/o: I) {
|
||||
println(o)
|
||||
o.some()
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"type": "MARKED_ELEMENT",
|
||||
"mainFile": "test/test.kt",
|
||||
"newName": "some",
|
||||
"withRuntime": "true"
|
||||
}
|
||||
@@ -239,6 +239,12 @@ public class RenameTestGenerated extends AbstractRenameTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("paramererAsReceiverWithNewNameAsSelector/parameterAsReceiverWithNewNameAsSelector.test")
|
||||
public void testParamererAsReceiverWithNewNameAsSelector_ParameterAsReceiverWithNewNameAsSelector() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/rename/paramererAsReceiverWithNewNameAsSelector/parameterAsReceiverWithNewNameAsSelector.test");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("parameterRedeclaration/parameterRedeclaration.test")
|
||||
public void testParameterRedeclaration_ParameterRedeclaration() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/rename/parameterRedeclaration/parameterRedeclaration.test");
|
||||
|
||||
Reference in New Issue
Block a user