Add tests for converting expressions of function types to suspending functional types
This commit is contained in:
committed by
teamcityserver
parent
780b9a032b
commit
0cc6fbbc6e
+19
@@ -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"
|
||||
}
|
||||
Reference in New Issue
Block a user