Search for KtTypeAlias in safe delete processor
Related to KT-16046
This commit is contained in:
@@ -237,6 +237,10 @@ class KotlinSafeDeleteProcessor : JavaSafeDeleteProcessor() {
|
||||
is KtParameter ->
|
||||
findUsagesByJavaProcessor(element)
|
||||
|
||||
is KtTypeAlias -> {
|
||||
findKotlinDeclarationUsages(element)
|
||||
}
|
||||
|
||||
else -> null
|
||||
} ?: getSearchInfo(element)
|
||||
}
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
typealias <caret>MyString = String
|
||||
@@ -0,0 +1,7 @@
|
||||
typealias <caret>MyString = String
|
||||
|
||||
val ms: MyString = ""
|
||||
|
||||
class My {
|
||||
val mms: MyString = ""
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
type alias MyString has 1 usage that is not safe to delete.
|
||||
+4
@@ -91,6 +91,10 @@ public abstract class AbstractSafeDeleteTest extends KotlinLightCodeInsightFixtu
|
||||
doTest(path, PsiMethod.class, true);
|
||||
}
|
||||
|
||||
public void doTypeAliasTest(@NotNull String path) throws Exception {
|
||||
doTest(path, KtTypeAlias.class, false);
|
||||
}
|
||||
|
||||
public void doTypeParameterTest(@NotNull String path) throws Exception {
|
||||
doTest(path, KtTypeParameter.class, false);
|
||||
}
|
||||
|
||||
+21
@@ -720,6 +720,27 @@ public class SafeDeleteTestGenerated extends AbstractSafeDeleteTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/refactoring/safeDelete/deleteTypeAlias/kotlinTypeAlias")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class KotlinTypeAlias extends AbstractSafeDeleteTest {
|
||||
public void testAllFilesPresentInKotlinTypeAlias() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/refactoring/safeDelete/deleteTypeAlias/kotlinTypeAlias"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/safeDelete/deleteTypeAlias/kotlinTypeAlias/simple.kt");
|
||||
doTypeAliasTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("used.kt")
|
||||
public void testUsed() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/safeDelete/deleteTypeAlias/kotlinTypeAlias/used.kt");
|
||||
doTypeAliasTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameter")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user