Add quickfix for "Interface doesn't have constructors" #KT-17687 Fixed

This commit is contained in:
Toshiaki Kameyama
2018-07-17 11:50:50 +09:00
committed by Alexey Sedunov
parent b5ba475696
commit e2945b1d12
13 changed files with 232 additions and 0 deletions
@@ -0,0 +1,10 @@
// "Convert to anonymous object" "true"
interface I {
fun foo(): String
}
fun test() {
<caret>I {
return@I ""
}
}
@@ -0,0 +1,12 @@
// "Convert to anonymous object" "true"
interface I {
fun foo(): String
}
fun test() {
object : I {
override fun foo(): String {
return ""
}
}
}
@@ -0,0 +1,11 @@
// "Convert to anonymous object" "false"
// ERROR: Interface I does not have constructors
interface I {
fun foo(): String
fun bar(): Unit
}
fun test() {
<caret>I {
}
}
@@ -0,0 +1,10 @@
// "Convert to anonymous object" "true"
interface I {
fun foo(a: String, b: Int): Int
}
fun test() {
<caret>I {
1
}
}
@@ -0,0 +1,12 @@
// "Convert to anonymous object" "true"
interface I {
fun foo(a: String, b: Int): Int
}
fun test() {
object : I {
override fun foo(a: String, b: Int): Int {
return 1
}
}
}
@@ -0,0 +1,8 @@
// "Convert to anonymous object" "true"
interface I {
fun foo(): String
}
fun test() {
val i = <caret>I { "" }
}
@@ -0,0 +1,12 @@
// "Convert to anonymous object" "true"
interface I {
fun foo(): String
}
fun test() {
val i = object : I {
override fun foo(): String {
return ""
}
}
}
+13
View File
@@ -0,0 +1,13 @@
// "Convert to anonymous object" "true"
interface I {
fun bar(): Unit
}
fun foo() {
}
fun test() {
<caret>I {
foo()
}
}
@@ -0,0 +1,15 @@
// "Convert to anonymous object" "true"
interface I {
fun bar(): Unit
}
fun foo() {
}
fun test() {
object : I {
override fun bar() {
return foo()
}
}
}