KTIJ-26959 [AA] Do not ignore underscore named properties in KtFirImportOptimizer
After the fix for the KT-60904 issue (c963eadb),
there are unnamed declarations created even for
the unused variables in destructuring declarations
Because of this, we can actually align testData
for K1 and K2. It seems like KT-59504 is no
longer relevant and can be marked as obsolete
because of the KT-60904 fix
^KTIJ-26959 Fixed
This commit is contained in:
+12
@@ -136,6 +136,18 @@ public class Fe10IdeNormalAnalysisSourceModuleAnalysisApiImportOptimizerTestGene
|
||||
runTest("analysis/analysis-api/testData/components/importOptimizer/analyseImports/unusedTypeAsVarargType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unusedType_underscoreNameInCatchSection.kt")
|
||||
public void testUnusedType_underscoreNameInCatchSection() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/importOptimizer/analyseImports/unusedType_underscoreNameInCatchSection.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unusedType_underscoreVariableInDestructuringDeclaration.kt")
|
||||
public void testUnusedType_underscoreVariableInDestructuringDeclaration() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/importOptimizer/analyseImports/unusedType_underscoreVariableInDestructuringDeclaration.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("usedAliasedAndRegularImportsFromSamePackage.kt")
|
||||
public void testUsedAliasedAndRegularImportsFromSamePackage() throws Exception {
|
||||
|
||||
-5
@@ -132,11 +132,6 @@ internal class KtFirImportOptimizer(
|
||||
super.visitImplicitInvokeCall(implicitInvokeCall)
|
||||
}
|
||||
|
||||
override fun visitProperty(property: FirProperty) {
|
||||
if (property.name == SpecialNames.UNDERSCORE_FOR_UNUSED_VAR) return
|
||||
super.visitProperty(property)
|
||||
}
|
||||
|
||||
override fun visitComponentCall(componentCall: FirComponentCall) {
|
||||
processFunctionCall(componentCall)
|
||||
super.visitComponentCall(componentCall)
|
||||
|
||||
+12
@@ -136,6 +136,18 @@ public class FirIdeNormalAnalysisSourceModuleAnalysisApiImportOptimizerTestGener
|
||||
runTest("analysis/analysis-api/testData/components/importOptimizer/analyseImports/unusedTypeAsVarargType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unusedType_underscoreNameInCatchSection.kt")
|
||||
public void testUnusedType_underscoreNameInCatchSection() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/importOptimizer/analyseImports/unusedType_underscoreNameInCatchSection.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unusedType_underscoreVariableInDestructuringDeclaration.kt")
|
||||
public void testUnusedType_underscoreVariableInDestructuringDeclaration() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/importOptimizer/analyseImports/unusedType_underscoreVariableInDestructuringDeclaration.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("usedAliasedAndRegularImportsFromSamePackage.kt")
|
||||
public void testUsedAliasedAndRegularImportsFromSamePackage() throws Exception {
|
||||
|
||||
+12
@@ -136,6 +136,18 @@ public class FirStandaloneNormalAnalysisSourceModuleAnalysisApiImportOptimizerTe
|
||||
runTest("analysis/analysis-api/testData/components/importOptimizer/analyseImports/unusedTypeAsVarargType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unusedType_underscoreNameInCatchSection.kt")
|
||||
public void testUnusedType_underscoreNameInCatchSection() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/importOptimizer/analyseImports/unusedType_underscoreNameInCatchSection.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unusedType_underscoreVariableInDestructuringDeclaration.kt")
|
||||
public void testUnusedType_underscoreVariableInDestructuringDeclaration() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/importOptimizer/analyseImports/unusedType_underscoreVariableInDestructuringDeclaration.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("usedAliasedAndRegularImportsFromSamePackage.kt")
|
||||
public void testUsedAliasedAndRegularImportsFromSamePackage() throws Exception {
|
||||
|
||||
-1
@@ -1 +0,0 @@
|
||||
dependency.component3
|
||||
+1
-2
@@ -1,2 +1 @@
|
||||
dependency.component2
|
||||
dependency.component3
|
||||
dependency.component3
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// FILE: main.kt
|
||||
package test
|
||||
|
||||
import dependency.MyException
|
||||
|
||||
fun usage() {
|
||||
try {} catch (_: MyException) {}
|
||||
}
|
||||
|
||||
// FILE: dependency.kt
|
||||
package dependency
|
||||
|
||||
class MyException : RuntimeException()
|
||||
+1
@@ -0,0 +1 @@
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// FILE: main.kt
|
||||
package test
|
||||
|
||||
import dependency.MyClass
|
||||
import dependency.Holder
|
||||
|
||||
fun usage(holder: Holder) {
|
||||
val (one, _: MyClass) = holder
|
||||
}
|
||||
|
||||
// FILE: dependency.kt
|
||||
package dependency
|
||||
|
||||
class MyClass
|
||||
|
||||
data class Holder(val one: MyClass, val two: MyClass)
|
||||
Reference in New Issue
Block a user