Move: Retain imports when moving top-level declaration

#KT-5049 Fixed
This commit is contained in:
Alexey Sedunov
2014-05-27 14:51:08 +04:00
parent df413c0b47
commit ab5e0c8c9c
21 changed files with 210 additions and 16 deletions
@@ -0,0 +1,15 @@
package first
import second.A
import third.B
import third.D
import fourth.X
class Test {
val a = A()
val b = B()
val d_ = D()
val c = B.C()
val x = X()
val y = X.Y()
}
@@ -0,0 +1,7 @@
package fourth
class X {
class Y {
}
}
@@ -0,0 +1,10 @@
package second
import third.B
import fourth.X.Y
import third.D as D_
import fourth.*
import third.B.*
class A
@@ -0,0 +1,11 @@
package third
public class B {
class C {
}
}
public class D {
}
@@ -0,0 +1,7 @@
package fourth
class X {
class Y {
}
}
@@ -0,0 +1,18 @@
package second
import third.B
import fourth.X.Y
import third.D as D_
import fourth.*
import third.B.*
class A
class <caret>Test {
val a = A()
val b = B()
val d_ = D_()
val c = C()
val x = X()
val y = Y()
}
@@ -0,0 +1,11 @@
package third
public class B {
class C {
}
}
public class D {
}
@@ -0,0 +1,5 @@
{
"mainFile": "second/A.kt",
"type": "MOVE_KOTLIN_TOP_LEVEL_DECLARATIONS",
"targetPackage": "first"
}
@@ -0,0 +1,15 @@
package first
import second.A
import third.B
import third.D
import fourth.X
fun test() {
val a = A()
val b = B()
val d_ = D()
val c = B.C()
val x = X()
val y = X.Y()
}
@@ -0,0 +1,7 @@
package fourth
class X {
class Y {
}
}
@@ -0,0 +1,10 @@
package second
import third.B
import fourth.X.Y
import third.D as D_
import fourth.*
import third.B.*
class A
@@ -0,0 +1,11 @@
package third
public class B {
class C {
}
}
public class D {
}
@@ -0,0 +1,7 @@
package fourth
class X {
class Y {
}
}
@@ -0,0 +1,18 @@
package second
import third.B
import fourth.X.Y
import third.D as D_
import fourth.*
import third.B.*
class A
fun <caret>test() {
val a = A()
val b = B()
val d_ = D_()
val c = C()
val x = X()
val y = Y()
}
@@ -0,0 +1,11 @@
package third
public class B {
class C {
}
}
public class D {
}
@@ -0,0 +1,5 @@
{
"mainFile": "second/A.kt",
"type": "MOVE_KOTLIN_TOP_LEVEL_DECLARATIONS",
"targetPackage": "first"
}