"Convert to anonymous object" quickfix: false negative when interface has concrete members
#KT-37908 Fixed
This commit is contained in:
committed by
Yan Zhulanow
parent
5b927d798c
commit
111b2945e1
@@ -0,0 +1,11 @@
|
||||
// "Convert to anonymous object" "true"
|
||||
interface I {
|
||||
fun a()
|
||||
fun b() {}
|
||||
}
|
||||
|
||||
fun foo(i: I) {}
|
||||
|
||||
fun test() {
|
||||
foo(<caret>I {})
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// "Convert to anonymous object" "true"
|
||||
interface I {
|
||||
fun a()
|
||||
fun b() {}
|
||||
}
|
||||
|
||||
fun foo(i: I) {}
|
||||
|
||||
fun test() {
|
||||
foo(object : I {
|
||||
override fun a() {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// "Convert to anonymous object" "true"
|
||||
interface I {
|
||||
fun a()
|
||||
val b: Int
|
||||
get() = 1
|
||||
}
|
||||
|
||||
fun foo(i: I) {}
|
||||
|
||||
fun test() {
|
||||
foo(<caret>I {})
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// "Convert to anonymous object" "true"
|
||||
interface I {
|
||||
fun a()
|
||||
val b: Int
|
||||
get() = 1
|
||||
}
|
||||
|
||||
fun foo(i: I) {}
|
||||
|
||||
fun test() {
|
||||
foo(object : I {
|
||||
override fun a() {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Convert to anonymous object" "false"
|
||||
// ERROR: Interface I does not have constructors
|
||||
// ACTION: Introduce import alias
|
||||
// ACTION: Split property declaration
|
||||
interface I {
|
||||
fun <T> foo(): String
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val i = <caret>I { "" }
|
||||
}
|
||||
Reference in New Issue
Block a user