Add compatibility warning for suspend conversions

This commit is contained in:
Mikhail Zarechenskiy
2020-06-01 00:46:18 +03:00
parent 47e6805186
commit eaeaf3c8a3
7 changed files with 110 additions and 0 deletions
@@ -0,0 +1,28 @@
// !LANGUAGE: +SuspendConversion
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
object Test1 {
fun foo(f: () -> Unit) {}
object Scope {
fun foo(f: suspend () -> Unit) {}
fun test(g: () -> Unit) {
<!COMPATIBILITY_WARNING, DEBUG_INFO_CALL("fqName: Test1.foo; typeCall: function")!>foo(g)<!>
}
}
}
object Test2 {
fun <T> foo(f: suspend () -> T): T = TODO()
suspend fun bar(): Int = 0
object Scope {
fun bar(): String = ""
fun test() {
val result = foo(<!COMPATIBILITY_WARNING!>::bar<!>)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>result<!>
}
}
}