KT-13689 Typealias constructor usage counts as original type usage for optimize imports
#KT-13689 Fixed (cherry picked from commit bde7e2b)
This commit is contained in:
committed by
Dmitry Petrov
parent
9d373fba67
commit
7d214c6e58
+1
-1
@@ -114,7 +114,7 @@ class ConvertAssertToIfWithThrowIntention : SelfTargetingIntention<KtCallExpress
|
||||
}
|
||||
|
||||
private fun replaceWithIfThenThrowExpression(original: KtCallExpression): KtIfExpression {
|
||||
val replacement = KtPsiFactory(original).createExpression("if (!true) { throw java.lang.AssertionError(\"\") }") as KtIfExpression
|
||||
val replacement = KtPsiFactory(original).createExpression("if (!true) { throw kotlin.AssertionError(\"\") }") as KtIfExpression
|
||||
val parent = original.parent
|
||||
return if (parent is KtDotQualifiedExpression)
|
||||
parent.replaced(replacement)
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
import kotlin.Any
|
||||
|
||||
fun foo(): Any {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun foo(): Any {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
@@ -245,6 +245,12 @@ public class OptimizeImportsTestGenerated extends AbstractOptimizeImportsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("TypeAliasUsage.kt")
|
||||
public void testTypeAliasUsage() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/editor/optimizeImports/TypeAliasUsage.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("UnusedImports.kt")
|
||||
public void testUnusedImports() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/editor/optimizeImports/UnusedImports.kt");
|
||||
|
||||
Reference in New Issue
Block a user