Add tests for converting expressions of function types to suspending functional types

This commit is contained in:
Victor Petukhov
2021-07-13 15:34:37 +03:00
committed by teamcityserver
parent 780b9a032b
commit 0cc6fbbc6e
30 changed files with 1065 additions and 0 deletions
@@ -0,0 +1,19 @@
// !LANGUAGE: +SuspendConversion
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun foo(x: () -> Int) {}
fun foo(x: suspend () -> Int) {}
fun usualCall(): Int = 42
suspend fun suspendCall(): Int = 42
// candidate without suspend conversions is more specific
fun test2(f: () -> Int, g: suspend () -> Int) {
foo(f)
foo(g)
}
fun box(): String {
test2({ 1 }, { 2 })
return "OK"
}