Add quickfix for "Interface doesn't have constructors" #KT-17687 Fixed
This commit is contained in:
committed by
Alexey Sedunov
parent
b5ba475696
commit
e2945b1d12
@@ -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 ""
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user