Add compatibility warning for chained sam->suspend-conversion

This commit is contained in:
Mikhail Zarechenskiy
2020-06-01 02:45:29 +03:00
parent a5203428a4
commit 599f520fd8
8 changed files with 126 additions and 9 deletions
@@ -0,0 +1,30 @@
// !LANGUAGE: -SuspendConversion
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
fun interface SuspendRunnable {
suspend fun run()
}
object Test1 {
fun call(r: () -> Unit) {}
object Scope {
fun call(r: SuspendRunnable) {}
fun bar(f: () -> Unit) {
<!COMPATIBILITY_WARNING, DEBUG_INFO_CALL("fqName: Test1.call; typeCall: function")!>call(f)<!>
}
}
}
object Test2 {
fun call(r: Runnable) {}
object Scope {
fun call(r: SuspendRunnable) {}
fun bar(f: () -> Unit) {
<!DEBUG_INFO_CALL("fqName: Test2.Scope.call; typeCall: function")!>call(<!UNSUPPORTED_FEATURE!>f<!>)<!>
}
}
}