Intentions: Move member of companion object to corresponding class
#KT-9697 Fixed
This commit is contained in:
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.idea.intentions.MoveMemberOutOfCompanionObjectIntention
|
||||
@@ -0,0 +1,11 @@
|
||||
class A {
|
||||
companion object {
|
||||
class <caret>B {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
A.Companion.B()
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class A {
|
||||
class B {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
A.B()
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
class A {
|
||||
companion object {
|
||||
class B {
|
||||
|
||||
}
|
||||
|
||||
fun <caret>foo() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
foo()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
class A {
|
||||
companion object {
|
||||
class B {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
foo()
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// WITH_RUNTIME
|
||||
// SHOULD_FAIL_WITH: Class instance required: foo, Class instance required: foo, Class instance required: foo, Class instance required: foo
|
||||
class A {
|
||||
companion object {
|
||||
class B {
|
||||
init {
|
||||
foo()
|
||||
}
|
||||
}
|
||||
|
||||
fun <caret>foo() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
foo()
|
||||
}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
A.foo()
|
||||
A.Companion.foo()
|
||||
with(A) {
|
||||
foo()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
class A {
|
||||
companion object {
|
||||
class B {
|
||||
|
||||
}
|
||||
|
||||
val <caret>foo: Int = 1
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
foo + 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
class A {
|
||||
companion object {
|
||||
class B {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
foo + 1
|
||||
}
|
||||
|
||||
val foo: Int = 1
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// WITH_RUNTIME
|
||||
// SHOULD_FAIL_WITH: Class instance required: foo, Class instance required: foo, Class instance required: foo, Class instance required: foo
|
||||
class A {
|
||||
companion object {
|
||||
class B {
|
||||
init {
|
||||
foo + 1
|
||||
}
|
||||
}
|
||||
|
||||
val <caret>foo: Int = 1
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
foo + 1
|
||||
}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
A.foo + 1
|
||||
A.Companion.foo + 1
|
||||
with(A) {
|
||||
foo + 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
class A {
|
||||
object O {
|
||||
class <caret>B {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
class A {
|
||||
class <caret>B {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user