Add compatibility warning for SAM conversions on Kotlin functions
This commit is contained in:
Vendored
+65
@@ -0,0 +1,65 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
|
||||
|
||||
fun interface KRunnable {
|
||||
fun invoke()
|
||||
}
|
||||
|
||||
object Test1 {
|
||||
fun foo(x: Any) {}
|
||||
fun foo(f: () -> Unit) {}
|
||||
|
||||
object Scope {
|
||||
fun foo(r: KRunnable) {}
|
||||
|
||||
fun test(f: () -> Unit) {
|
||||
<!DEBUG_INFO_CALL("fqName: Test1.Scope.foo; typeCall: function")!>foo(f)<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object Test2 {
|
||||
fun foo(f: () -> String) {}
|
||||
|
||||
object Scope {
|
||||
fun foo(r: KRunnable) {}
|
||||
|
||||
fun test(f: () -> Unit) {
|
||||
<!DEBUG_INFO_CALL("fqName: Test2.Scope.foo; typeCall: function")!>foo(f)<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object Test3 {
|
||||
fun foo(i: Int, r: KRunnable): Int = 0
|
||||
fun foo(n: Number, f: () -> Unit): String = ""
|
||||
|
||||
fun test(f: () -> Unit) {
|
||||
val result = foo(1, f)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>result<!>
|
||||
}
|
||||
}
|
||||
|
||||
object Test4 {
|
||||
fun foo(i: Int, r: KRunnable): Int = 0
|
||||
fun foo(n: Number, f: () -> Unit): String = ""
|
||||
|
||||
fun bar() {}
|
||||
|
||||
fun test() {
|
||||
val result = foo(1, ::bar)
|
||||
result
|
||||
}
|
||||
}
|
||||
|
||||
object Test5 {
|
||||
fun foo(x: Any) {}
|
||||
fun foo(f: () -> Unit) {}
|
||||
|
||||
object Scope {
|
||||
fun foo(r: KRunnable) {}
|
||||
|
||||
fun test() {
|
||||
foo { }
|
||||
}
|
||||
}
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
|
||||
|
||||
fun interface KRunnable {
|
||||
fun invoke()
|
||||
}
|
||||
|
||||
object Test1 {
|
||||
fun foo(x: Any) {}
|
||||
fun foo(f: () -> Unit) {}
|
||||
|
||||
object Scope {
|
||||
fun foo(r: KRunnable) {}
|
||||
|
||||
fun test(f: () -> Unit) {
|
||||
<!DEBUG_INFO_CALL("fqName: Test1.Scope.foo; typeCall: function")!>foo(f)<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object Test2 {
|
||||
fun foo(f: () -> String) {}
|
||||
|
||||
object Scope {
|
||||
fun foo(r: KRunnable) {}
|
||||
|
||||
fun test(f: () -> Unit) {
|
||||
<!DEBUG_INFO_CALL("fqName: Test2.Scope.foo; typeCall: function")!>foo(f)<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object Test3 {
|
||||
fun foo(i: Int, r: KRunnable): Int = 0
|
||||
fun foo(n: Number, f: () -> Unit): String = ""
|
||||
|
||||
fun test(f: () -> Unit) {
|
||||
val result = foo(1, f)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>result<!>
|
||||
}
|
||||
}
|
||||
|
||||
object Test4 {
|
||||
fun foo(i: Int, r: KRunnable): Int = 0
|
||||
fun foo(n: Number, f: () -> Unit): String = ""
|
||||
|
||||
fun bar() {}
|
||||
|
||||
fun test() {
|
||||
val result = foo(1, ::bar)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>result<!>
|
||||
}
|
||||
}
|
||||
|
||||
object Test5 {
|
||||
fun foo(x: Any) {}
|
||||
fun foo(f: () -> Unit) {}
|
||||
|
||||
object Scope {
|
||||
fun foo(r: KRunnable) {}
|
||||
|
||||
fun test() {
|
||||
<!DEBUG_INFO_CALL("fqName: Test5.Scope.foo; typeCall: function")!>foo { }<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+82
@@ -0,0 +1,82 @@
|
||||
package
|
||||
|
||||
public fun interface KRunnable {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public abstract fun invoke(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public object Test1 {
|
||||
private constructor Test1()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun foo(/*0*/ f: () -> kotlin.Unit): kotlin.Unit
|
||||
public final fun foo(/*0*/ x: kotlin.Any): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public object Scope {
|
||||
private constructor Scope()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun foo(/*0*/ r: KRunnable): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun test(/*0*/ f: () -> kotlin.Unit): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
public object Test2 {
|
||||
private constructor Test2()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun foo(/*0*/ f: () -> kotlin.String): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public object Scope {
|
||||
private constructor Scope()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun foo(/*0*/ r: KRunnable): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun test(/*0*/ f: () -> kotlin.Unit): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
public object Test3 {
|
||||
private constructor Test3()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun foo(/*0*/ i: kotlin.Int, /*1*/ r: KRunnable): kotlin.Int
|
||||
public final fun foo(/*0*/ n: kotlin.Number, /*1*/ f: () -> kotlin.Unit): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun test(/*0*/ f: () -> kotlin.Unit): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public object Test4 {
|
||||
private constructor Test4()
|
||||
public final fun bar(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun foo(/*0*/ i: kotlin.Int, /*1*/ r: KRunnable): kotlin.Int
|
||||
public final fun foo(/*0*/ n: kotlin.Number, /*1*/ f: () -> kotlin.Unit): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun test(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public object Test5 {
|
||||
private constructor Test5()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun foo(/*0*/ f: () -> kotlin.Unit): kotlin.Unit
|
||||
public final fun foo(/*0*/ x: kotlin.Any): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public object Scope {
|
||||
private constructor Scope()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun foo(/*0*/ r: KRunnable): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun test(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user