Rename: Quote parameter name when necessary
#KT-13463 Fixed
This commit is contained in:
@@ -273,6 +273,7 @@ Using 'this' as function argument in constructor of non-final class
|
||||
- [`KT-12971`](https://youtrack.jetbrains.com/issue/KT-12971) Push Down: Do not specifiy visibility on generated overriding members
|
||||
- [`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
|
||||
|
||||
##### New features
|
||||
|
||||
|
||||
+2
-1
@@ -28,6 +28,7 @@ import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.VariableDescriptor
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptor
|
||||
import org.jetbrains.kotlin.idea.core.getDeepestSuperDeclarations
|
||||
import org.jetbrains.kotlin.idea.core.quoteIfNeeded
|
||||
import org.jetbrains.kotlin.idea.refactoring.canRefactor
|
||||
import org.jetbrains.kotlin.idea.refactoring.getAffectedCallables
|
||||
import org.jetbrains.kotlin.psi.KtCallableDeclaration
|
||||
@@ -84,7 +85,7 @@ class RenameKotlinParameterProcessor : RenameKotlinPsiProcessor() {
|
||||
else -> null
|
||||
}
|
||||
if (parameter == null) continue
|
||||
allRenames[parameter] = newName
|
||||
allRenames[parameter] = newName.quoteIfNeeded()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ class `A B` {}
|
||||
val THAT_A_B: `A B` = `A B`()
|
||||
val A_B: `A B` = `A B`()
|
||||
|
||||
fun localize(anA: `A B`, aPrefixedA: `A B`) {
|
||||
fun localize(`anA BPar`: `A B`, `aPrefixedA BPar`: `A B`) {
|
||||
val `a BVal`: `A B` = `A B`()
|
||||
val `prefixedA BVal`: `A B` = `A B`()
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package test
|
||||
|
||||
fun foo(`22`: Int) {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package test
|
||||
|
||||
fun foo(/*rename*/a: Int) {
|
||||
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"type": "MARKED_ELEMENT",
|
||||
"mainFile": "test/test.kt",
|
||||
"newName": "22",
|
||||
"withRuntime": "true"
|
||||
}
|
||||
@@ -245,6 +245,12 @@ public class RenameTestGenerated extends AbstractRenameTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("parameterWithQuotation/parameterWithQuotation.test")
|
||||
public void testParameterWithQuotation_ParameterWithQuotation() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/rename/parameterWithQuotation/parameterWithQuotation.test");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("primaryConstructorParameterRedeclaration/primaryConstructorParameterRedeclaration.test")
|
||||
public void testPrimaryConstructorParameterRedeclaration_PrimaryConstructorParameterRedeclaration() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/rename/primaryConstructorParameterRedeclaration/primaryConstructorParameterRedeclaration.test");
|
||||
|
||||
Reference in New Issue
Block a user