KTIJ-26276 [Analysis API] Do not consider single aliased import from the same package as unused

Even when the aliased import comes from the same package, it cannot be
removed, because it will break the code

Also, add more tests for the imports coming from the same package

^KTIJ-26276 Fixed
This commit is contained in:
Roman Golyshev
2023-07-19 11:21:42 +02:00
committed by teamcity
parent 8acf6b1bd0
commit 5e30adec06
12 changed files with 145 additions and 2 deletions
@@ -0,0 +1,2 @@
test.SamePackage as Aliased
test.samePackage as aliased
@@ -0,0 +1,12 @@
package test
import test.SamePackage as Aliased
import test.samePackage as aliased
class SamePackage
fun samePackage() {}
fun usage(a: SamePackage) {
samePackage()
}
@@ -0,0 +1,2 @@
test.SamePackage
test.samePackage
@@ -0,0 +1,17 @@
// FILE: main.kt
package test
import test.SamePackage
import test.samePackage
fun usage(a: SamePackage) {
samePackage()
}
// FILE: dependency.kt
package test
class SamePackage
fun samePackage() {}
@@ -0,0 +1,20 @@
// FILE: main.kt
package test
import test.SamePackage
import test.SamePackage as Aliased
import test.samePackage
import test.samePackage as aliased
fun usage(a: Aliased, b: SamePackage) {
aliased()
samePackage()
}
// FILE: dependency.kt
package test
class SamePackage
fun samePackage() {}
@@ -0,0 +1,16 @@
// FILE: main.kt
package test
import test.SamePackage as Aliased
import test.samePackage as aliased
fun usage(a: Aliased) {
aliased()
}
// FILE: dependency.kt
package test
class SamePackage
fun samePackage() {}