Convert to lambda: report at INFORMATION level if anonymous object super type does not match function parameter type exactly

#KT-28081 Fixed
This commit is contained in:
Toshiaki Kameyama
2019-01-23 14:20:48 +09:00
committed by Mikhail Glukhikh
parent 3649e61c2f
commit 0075e90042
7 changed files with 68 additions and 5 deletions
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.intentions.ObjectLiteralToLambdaInspection
@@ -0,0 +1,11 @@
@FunctionalInterface
public interface Foo {
void foo();
}
public interface Bar {
}
@FunctionalInterface
public interface FooBar extends Foo, Bar {
}
@@ -0,0 +1,11 @@
@FunctionalInterface
public interface Foo {
void foo();
}
public interface Bar {
}
@FunctionalInterface
public interface FooBar extends Foo, Bar {
}
@@ -0,0 +1,9 @@
// HIGHLIGHT: INFORMATION
fun main() {
test("", <caret>object : FooBar {
override fun foo() {
}
}, 1)
}
fun test(s: String, foo: Foo, i: Int) {}
@@ -0,0 +1,6 @@
// HIGHLIGHT: INFORMATION
fun main() {
test("", FooBar { }, 1)
}
fun test(s: String, foo: Foo, i: Int) {}