Move: Nested classes support
#KT-9027 In Progress
This commit is contained in:
Vendored
+26
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+42
@@ -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
|
||||
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package test2;
|
||||
|
||||
import test.A;
|
||||
import test.C;
|
||||
|
||||
class Test {
|
||||
C foo() {
|
||||
return new C(new A().new B());
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package test2;
|
||||
|
||||
import test.A;
|
||||
import test.C;
|
||||
|
||||
class Test {
|
||||
C foo() {
|
||||
return new C(new A().new B());
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package test2;
|
||||
|
||||
import test.A;
|
||||
import test.C;
|
||||
|
||||
class Test {
|
||||
C foo() {
|
||||
return new C(new A().new B());
|
||||
}
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
package test2
|
||||
|
||||
import test.A
|
||||
import test.C
|
||||
|
||||
fun foo(): C {
|
||||
return C(A().B())
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
package test2
|
||||
|
||||
import test.A
|
||||
import test.C
|
||||
|
||||
fun foo2(): C {
|
||||
return C(A().B())
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
package test2
|
||||
|
||||
import test.A
|
||||
import test.A.B
|
||||
import test.C
|
||||
|
||||
fun foo2(): C {
|
||||
return C(A().B())
|
||||
}
|
||||
Vendored
+66
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package test2;
|
||||
|
||||
import test.A;
|
||||
|
||||
class Test {
|
||||
A.B.C foo() {
|
||||
return new A().new B().new C();
|
||||
}
|
||||
}
|
||||
+10
@@ -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();
|
||||
}
|
||||
}
|
||||
+10
@@ -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();
|
||||
}
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
package test2
|
||||
|
||||
import test.A
|
||||
|
||||
fun foo(): A.B.C {
|
||||
return A().B().C()
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
package test2
|
||||
|
||||
import test.A
|
||||
import test.A.B.C
|
||||
|
||||
fun foo2(): C {
|
||||
return A().B().C()
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
package test2
|
||||
|
||||
import test.A
|
||||
import test.A.B
|
||||
|
||||
fun foo2(): B.C {
|
||||
return A().B().C()
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"mainFile": "test.kt",
|
||||
"type": "MOVE_KOTLIN_NESTED_CLASS",
|
||||
"outerInstanceParameter": "b",
|
||||
"withRuntime": "true"
|
||||
}
|
||||
Reference in New Issue
Block a user