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:
+2
@@ -0,0 +1,2 @@
|
||||
test.SamePackage as Aliased
|
||||
test.samePackage as aliased
|
||||
+12
@@ -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()
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
test.SamePackage
|
||||
test.samePackage
|
||||
+17
@@ -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() {}
|
||||
+20
@@ -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() {}
|
||||
+16
@@ -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() {}
|
||||
Reference in New Issue
Block a user