Tests for basic SuspendFunction-related restrictions (already implemented within type system)
This commit is contained in:
committed by
Stanislav Erokhin
parent
bc069cd686
commit
bf987cff5f
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
fun useSuspendFn(sfn: suspend () -> Unit) = sfn
|
||||
fun useFn(fn: () -> Unit) = fn
|
||||
|
||||
fun ambiguous(sfn: suspend () -> Unit) = sfn
|
||||
fun ambiguous(fn: () -> Unit) = fn
|
||||
|
||||
fun test1(sfn: suspend () -> Unit) = useFn(<!TYPE_MISMATCH!>sfn<!>)
|
||||
fun test2(fn: () -> Unit) = useSuspendFn(<!TYPE_MISMATCH!>fn<!>)
|
||||
|
||||
fun test3(sfn: suspend () -> Unit) = useSuspendFn(sfn)
|
||||
fun test4(): suspend () -> Unit = useSuspendFn {}
|
||||
|
||||
fun test5(sfn: suspend () -> Unit) = ambiguous(sfn)
|
||||
fun test6(fn: () -> Unit) = ambiguous(fn)
|
||||
fun test7(): () -> Unit = ambiguous {}
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
package
|
||||
|
||||
public fun ambiguous(/*0*/ fn: () -> kotlin.Unit): () -> kotlin.Unit
|
||||
public fun ambiguous(/*0*/ sfn: suspend () -> kotlin.Unit): suspend () -> kotlin.Unit
|
||||
public fun test1(/*0*/ sfn: suspend () -> kotlin.Unit): () -> kotlin.Unit
|
||||
public fun test2(/*0*/ fn: () -> kotlin.Unit): suspend () -> kotlin.Unit
|
||||
public fun test3(/*0*/ sfn: suspend () -> kotlin.Unit): suspend () -> kotlin.Unit
|
||||
public fun test4(): suspend () -> kotlin.Unit
|
||||
public fun test5(/*0*/ sfn: suspend () -> kotlin.Unit): suspend () -> kotlin.Unit
|
||||
public fun test6(/*0*/ fn: () -> kotlin.Unit): () -> kotlin.Unit
|
||||
public fun test7(): () -> kotlin.Unit
|
||||
public fun useFn(/*0*/ fn: () -> kotlin.Unit): () -> kotlin.Unit
|
||||
public fun useSuspendFn(/*0*/ sfn: suspend () -> kotlin.Unit): suspend () -> kotlin.Unit
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
fun test1(sfn: suspend () -> Unit) = <!FUNCTION_EXPECTED!>sfn<!>()
|
||||
fun test2(sfn: suspend () -> Unit) = sfn.<!UNRESOLVED_REFERENCE!>invoke<!>()
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
package
|
||||
|
||||
public fun test1(/*0*/ sfn: suspend () -> kotlin.Unit): [ERROR : Error function type]
|
||||
public fun test2(/*0*/ sfn: suspend () -> kotlin.Unit): [ERROR : Error function type]
|
||||
Reference in New Issue
Block a user