Add intention to convert top level val with object expression to object declaration (#974)

* Add intention to convert top level val with object expression to object
Fixes #KT-14137

* fix intention description
This commit is contained in:
Kirill Rakhman
2017-05-08 15:35:03 +02:00
committed by Dmitry Jemerov
parent 93b5eec71e
commit 8e00af5642
16 changed files with 216 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.intentions.ValToObjectIntention
+10
View File
@@ -0,0 +1,10 @@
// IS_APPLICABLE: false
interface B {
}
annotation class Ann
@Ann
val <caret>a = object : B {
}
@@ -0,0 +1,11 @@
// IS_APPLICABLE: false
interface B {
}
val <caret>a = object : B {
}
fun foo() {
val ref = ::a
}
+8
View File
@@ -0,0 +1,8 @@
// IS_APPLICABLE: false
interface B {
}
val <caret>a = object : B {
}
get() = field
+9
View File
@@ -0,0 +1,9 @@
// IS_APPLICABLE: false
interface B {
}
class Foo {
val <caret>a = object : B {
}
}
+7
View File
@@ -0,0 +1,7 @@
interface B {
}
val <caret>a = object : B {
}
val c = a
+7
View File
@@ -0,0 +1,7 @@
interface B {
}
object a<caret> : B {
}
val c = a
+7
View File
@@ -0,0 +1,7 @@
// IS_APPLICABLE: false
interface B {
}
var <caret>a = object : B {
}
@@ -0,0 +1,9 @@
// IS_APPLICABLE: false
import test.WithJavaUsageKt
class A {
void b() {
WithJavaUsageKt.getA();
}
}
+9
View File
@@ -0,0 +1,9 @@
// IS_APPLICABLE: false
package test
interface B {
}
val <caret>a = object : B {
}