let's say you have the following classes in your source folders:
kotlin
|
|---- CoolWithATwist
| |
| |--- function.kt which contains your own println() function
| |
| |--- test1.kt (no imports)
| |
| |--- test2.kt (import kotlin.io.println)
| |
| |--- test.kt (import kotlin.io.*)
| |
| |___ NestedPackage
| |
| |___ test3.kt (no imports)
|
|____ main.kt
main.kt, test2.ktand test3.ktwill be directly used kotlin.io.println.
test1.ktwill use the top-level function of the package println.
test.ktwill use the top-level function of the package println, since the priority of the star import operator is lower than the top-level area of the package.
, , . : local > enclosing > function > class > script > import statement > package top-level > star import statement > kotlin top-level.
CTRL+B/CTRL+ALT+B/F4 , , , :
fun foo(){
println("bar");
// ^--- move the cursor here and press `CTRL+B`/`CTRL+ALT+B`/`F4`
}