Skip to content

Commit 9a6b17d

Browse files
committed
Kotlin: Add async-await dataflow test case
1 parent 85d883c commit 9a6b17d

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import kotlinx.coroutines.*
2+
3+
suspend fun fn() {
4+
GlobalScope.launch {
5+
val x: Deferred<String> = async { Helper.taint() }
6+
Helper.sink(x.await()) // TODO: not found
7+
}
8+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Stubs for `kotlinx.coroutines`
3+
*/
4+
5+
@file:JvmName("BuildersKt") // Required for `async`
6+
7+
package kotlinx.coroutines
8+
9+
public interface CoroutineScope
10+
public interface CoroutineContext
11+
public enum class CoroutineStart { DEFAULT }
12+
public interface Job
13+
public interface Deferred<out T> : Job {
14+
public suspend fun await(): T
15+
}
16+
17+
public object GlobalScope : CoroutineScope
18+
19+
public fun CoroutineScope.launch(
20+
context: CoroutineContext = null!!,
21+
start: CoroutineStart = CoroutineStart.DEFAULT,
22+
block: suspend CoroutineScope.() -> Unit
23+
): Job {
24+
return null!!
25+
}
26+
27+
public fun <T> CoroutineScope.async(
28+
context: CoroutineContext = null!!,
29+
start: CoroutineStart = CoroutineStart.DEFAULT,
30+
block: suspend CoroutineScope.() -> T
31+
): Deferred<T> {
32+
return null!!
33+
}

0 commit comments

Comments
 (0)