[AA] Shortener: allow import if requested import kind has high priority

This commit is contained in:
aleksandrina-streltsova
2023-06-12 17:58:04 +03:00
committed by teamcity
parent a96e2f37e7
commit 57cbab7d8e
10 changed files with 94 additions and 7 deletions
@@ -0,0 +1,4 @@
// WITH_STDLIB
// FILE: main.kt
fun test() = <expr>kotlin.text.charset("")</expr>
@@ -0,0 +1,8 @@
Before shortening: kotlin.text.charset("")
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
[qualifier] kotlin.text.charset("")
with SHORTEN_AND_IMPORT:
[qualifier] kotlin.text.charset("")
with SHORTEN_AND_STAR_IMPORT:
[qualifier] kotlin.text.charset("")
@@ -0,0 +1,7 @@
// WITH_STDLIB
// FILE: main.kt
import java.nio.charset.Charset
fun charset(charsetName: String): Charset = Charset.forName(charsetName)
fun test() = <expr>kotlin.text.charset("")</expr>
@@ -0,0 +1,5 @@
Before shortening: kotlin.text.charset("")
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
with SHORTEN_AND_IMPORT:
with SHORTEN_AND_STAR_IMPORT:
@@ -0,0 +1,13 @@
// FILE: main.kt
package a.b.c
fun foo() {}
fun test() {
<expr>dependency.foo()</expr>
}
// FILE: dependency.kt
package dependency
fun foo() {}
@@ -0,0 +1,6 @@
Before shortening: dependency.foo()
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
with SHORTEN_AND_IMPORT:
[qualifier] dependency.foo()
with SHORTEN_AND_STAR_IMPORT:
@@ -3,6 +3,6 @@ with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
[qualifier] a.b.c.MyClass
with SHORTEN_AND_IMPORT:
[qualifier] a.b.c.MyClass.Companion
[qualifier] a.b.c.MyClass.Companion.foo()
with SHORTEN_AND_STAR_IMPORT:
[qualifier] a.b.c.MyClass.Companion