Move: Nested classes support

#KT-9027 In Progress
This commit is contained in:
Alexey Sedunov
2016-01-12 20:41:02 +03:00
parent 0304bd1dc1
commit d662b02e95
159 changed files with 2588 additions and 197 deletions
@@ -0,0 +1,26 @@
package test
class C(private val b: A.B) {
fun test() {
A.X()
A.Companion.Y()
A.foo(A.bar)
//1.extFoo(1.extBar) // conflict
b.OuterY()
b.outerFoo(b.outerBar)
b.OuterY()
b.outerFoo(b.outerBar)
A.O.Y()
A.O.foo(A.O.bar)
with (A.O) {
A.Companion.Y()
foo(bar)
1.extFoo(1.extBar)
}
}
}
@@ -0,0 +1,42 @@
package test
inline fun <T, R> with(receiver: T, block: T.() -> R): R = receiver.block()
class A {
class X {
}
companion object {
class Y
fun foo(n: Int) {}
val bar = 1
fun Int.extFoo(n: Int) {}
val Int.extBar: Int get() = 1
}
object O {
class Y
fun foo(n: Int) {}
val bar = 1
fun Int.extFoo(n: Int) {}
val Int.extBar: Int get() = 1
}
inner class B {
inner class OuterY
fun outerFoo(n: Int) {}
val outerBar = 1
}
}
@@ -0,0 +1,10 @@
package test2;
import test.A;
import test.C;
class Test {
C foo() {
return new C(new A().new B());
}
}
@@ -0,0 +1,10 @@
package test2;
import test.A;
import test.C;
class Test {
C foo() {
return new C(new A().new B());
}
}
@@ -0,0 +1,10 @@
package test2;
import test.A;
import test.C;
class Test {
C foo() {
return new C(new A().new B());
}
}
@@ -0,0 +1,8 @@
package test2
import test.A
import test.C
fun foo(): C {
return C(A().B())
}
@@ -0,0 +1,8 @@
package test2
import test.A
import test.C
fun foo2(): C {
return C(A().B())
}
@@ -0,0 +1,9 @@
package test2
import test.A
import test.A.B
import test.C
fun foo2(): C {
return C(A().B())
}
@@ -0,0 +1,66 @@
package test
inline fun <T, R> with(receiver: T, block: T.() -> R): R = receiver.block()
class A {
class X {
}
companion object {
class Y
fun foo(n: Int) {}
val bar = 1
fun Int.extFoo(n: Int) {}
val Int.extBar: Int get() = 1
}
object O {
class Y
fun foo(n: Int) {}
val bar = 1
fun Int.extFoo(n: Int) {}
val Int.extBar: Int get() = 1
}
inner class B {
inner class OuterY
fun outerFoo(n: Int) {}
val outerBar = 1
inner class <caret>C {
fun test() {
X()
Y()
foo(bar)
//1.extFoo(1.extBar) // conflict
OuterY()
outerFoo(outerBar)
this@B.OuterY()
this@B.outerFoo(this@B.outerBar)
O.Y()
O.foo(O.bar)
with (O) {
Y()
foo(bar)
1.extFoo(1.extBar)
}
}
}
}
}
@@ -0,0 +1,9 @@
package test2;
import test.A;
class Test {
A.B.C foo() {
return new A().new B().new C();
}
}
@@ -0,0 +1,10 @@
package test2;
import test.A;
import test.A.B.C;
class Test {
C foo() {
return new A().new B().new C();
}
}
@@ -0,0 +1,10 @@
package test2;
import test.A;
import test.A.B;
class Test {
B.C foo() {
return new A().new B().new C();
}
}
@@ -0,0 +1,7 @@
package test2
import test.A
fun foo(): A.B.C {
return A().B().C()
}
@@ -0,0 +1,8 @@
package test2
import test.A
import test.A.B.C
fun foo2(): C {
return A().B().C()
}
@@ -0,0 +1,8 @@
package test2
import test.A
import test.A.B
fun foo2(): B.C {
return A().B().C()
}
@@ -0,0 +1,6 @@
{
"mainFile": "test.kt",
"type": "MOVE_KOTLIN_NESTED_CLASS",
"outerInstanceParameter": "b",
"withRuntime": "true"
}