Converting object literal to class allows to choose a name (KT-19254)
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
class Test { // TARGET_BLOCK:
|
||||
fun foo() {
|
||||
O()
|
||||
Runnable1()
|
||||
}
|
||||
|
||||
class O : Runnable {
|
||||
class Runnable1 : Runnable {
|
||||
override fun run() {
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -2,10 +2,10 @@ class Test { // TARGET_BLOCK:
|
||||
fun method() = 1
|
||||
|
||||
fun foo() {
|
||||
O()
|
||||
Runnable1()
|
||||
}
|
||||
|
||||
inner class O : Runnable {
|
||||
inner class Runnable1 : Runnable {
|
||||
override fun run() {
|
||||
method()
|
||||
}
|
||||
|
||||
+2
-2
@@ -2,10 +2,10 @@ class Test { // TARGET_BLOCK:
|
||||
var field = 1
|
||||
|
||||
fun foo() {
|
||||
O()
|
||||
Runnable1()
|
||||
}
|
||||
|
||||
inner class O : Runnable {
|
||||
inner class Runnable1 : Runnable {
|
||||
override fun run() {
|
||||
field = 2
|
||||
}
|
||||
|
||||
@@ -2,12 +2,12 @@ class Test {
|
||||
var field = 1
|
||||
|
||||
fun foo() { // TARGET_BLOCK:
|
||||
class O : Runnable {
|
||||
class Runnable1 : Runnable {
|
||||
override fun run() {
|
||||
field = 2
|
||||
}
|
||||
}
|
||||
|
||||
O()
|
||||
Runnable1()
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
open class K
|
||||
|
||||
fun foo(n: Int) {
|
||||
val x = <caret>O()
|
||||
val x = K1()
|
||||
}
|
||||
|
||||
class O : K() {
|
||||
class K1<caret> : K() {
|
||||
fun bar() = 1
|
||||
}
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
fun foo(n: Int) {
|
||||
val x = <caret>O(n)
|
||||
val x = O(n)
|
||||
}
|
||||
|
||||
class O(private val n: Int) {
|
||||
class O<caret>(private val n: Int) {
|
||||
fun bar() = n
|
||||
}
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
open class K
|
||||
|
||||
fun foo(n: Int) {
|
||||
val x = <caret>O(n)
|
||||
val x = K1(n)
|
||||
}
|
||||
|
||||
class O(private val n: Int) : K() {
|
||||
class K1<caret>(private val n: Int) : K() {
|
||||
fun bar() = n
|
||||
}
|
||||
Reference in New Issue
Block a user