Add when branches: include auto-import

Before this commit, enum / sealed class to add was not imported so
user had to import them himself. Now everything is auto-imported.
Separate "add with import" is kept but * import is now in mind there.
#KT-22330 Fixed
#KT-22354 Fixed
EA-108090 Fixed
This commit is contained in:
Mikhail Glukhikh
2018-08-15 17:42:36 +03:00
parent f3972bfdfe
commit b031e34f8d
8 changed files with 83 additions and 3 deletions
@@ -0,0 +1,15 @@
// "Add remaining branches" "true"
package u
import e.OwnEnum
import e.getOwnEnum
fun mainContext() {
val ownLocal = getOwnEnum()
when (ownLocal) {
OwnEnum.RED -> TODO()
OwnEnum.GREEN -> TODO()
OwnEnum.BLUE -> TODO()
}
}
@@ -0,0 +1,5 @@
package e
enum class OwnEnum { RED, GREEN, BLUE }
fun getOwnEnum(): OwnEnum = OwnEnum.RED
@@ -0,0 +1,10 @@
// "Add remaining branches" "true"
package u
import e.getOwnEnum
fun mainContext() {
val ownLocal = getOwnEnum()
<caret>when (ownLocal) {}
}
@@ -0,0 +1,16 @@
// "Add remaining branches with import" "true"
package u
import e.OwnEnum
import e.OwnEnum.*
import e.getOwnEnum
fun mainContext() {
val ownLocal = getOwnEnum()
when (ownLocal) {
RED -> TODO()
GREEN -> TODO()
BLUE -> TODO()
}
}
@@ -0,0 +1,5 @@
package e
enum class OwnEnum { RED, GREEN, BLUE }
fun getOwnEnum(): OwnEnum = OwnEnum.RED
@@ -0,0 +1,10 @@
// "Add remaining branches with import" "true"
package u
import e.getOwnEnum
fun mainContext() {
val ownLocal = getOwnEnum()
<caret>when (ownLocal) {}
}