Converting object literal to class allows to choose a name (KT-19254)

This commit is contained in:
Nicolay Mitropolsky
2019-01-08 14:33:32 +03:00
parent a9afee77d7
commit 41b6bcf8c3
8 changed files with 47 additions and 33 deletions
@@ -1,9 +1,9 @@
class Test { // TARGET_BLOCK:
fun foo() {
O()
Runnable1()
}
class O : Runnable {
class Runnable1 : Runnable {
override fun run() {
}
}
@@ -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,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()
}
}
@@ -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
}
@@ -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
}
@@ -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
}