Rename: Rename do-while loop variables in the loop condition

#KT-14157 Fixed
This commit is contained in:
Alexey Sedunov
2016-10-04 14:22:13 +03:00
parent 140d0b61f1
commit fe711da594
9 changed files with 53 additions and 1 deletions
@@ -0,0 +1,8 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtProperty
// OPTIONS: usages
fun test() {
do {
val <caret>message = "test"
println(message)
} while (message.isEmpty())
}
@@ -0,0 +1,2 @@
Receiver 7 } while (message.isEmpty())
Value read 6 println(message)
@@ -0,0 +1,6 @@
fun test() {
do {
val message2 = "test"
println(message2)
} while (message2.isEmpty())
}
@@ -0,0 +1,6 @@
fun test() {
do {
val /*rename*/message = "test"
println(message)
} while (message.isEmpty())
}
@@ -0,0 +1,6 @@
{
"type": "MARKED_ELEMENT",
"mainFile": "test.kt",
"newName": "message2",
"withRuntime": "true"
}
@@ -1347,6 +1347,12 @@ public class FindUsagesTestGenerated extends AbstractFindUsagesTest {
doTest(fileName);
}
@TestMetadata("varInDoWhile.0.kt")
public void testVarInDoWhile() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/findUsages/kotlin/variable/varInDoWhile.0.kt");
doTest(fileName);
}
@TestMetadata("writeAccess.0.kt")
public void testWriteAccess() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/findUsages/kotlin/variable/writeAccess.0.kt");
@@ -1102,4 +1102,10 @@ public class RenameTestGenerated extends AbstractRenameTest {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/rename/topLevelPropertyRedeclaration/topLevelPropertyRedeclaration.test");
doTest(fileName);
}
@TestMetadata("varInDoWhile/varInDoWhile.test")
public void testVarInDoWhile_VarInDoWhile() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/rename/varInDoWhile/varInDoWhile.test");
doTest(fileName);
}
}