Redundant async inspection: support case with explicit scope
#KT-28504 Fixed
This commit is contained in:
@@ -41,4 +41,7 @@ suspend fun <T> withContext(
|
||||
|
||||
suspend fun <R> coroutineScope(block: suspend CoroutineScope.() -> R): R = GlobalScope.block()
|
||||
|
||||
operator fun CoroutineContext.plus(other: CoroutineContext): CoroutineContext {
|
||||
TODO()
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
// PROBLEM: none
|
||||
|
||||
package kotlinx.coroutines
|
||||
|
||||
suspend fun test(ctx: CoroutineContext, scope: CoroutineScope) {
|
||||
// Does not work yet (1.3.11)
|
||||
scope.<caret>async(ctx) { 42 }.await()
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
package kotlinx.coroutines
|
||||
|
||||
suspend fun test(ctx: CoroutineContext, scope: CoroutineScope) {
|
||||
withContext(scope.coroutineContext + ctx) { 42 }
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
package kotlinx.coroutines
|
||||
|
||||
suspend fun test(ctx: CoroutineContext, scope: CoroutineScope) {
|
||||
scope.<caret>async(context = ctx) { 42 }.await()
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
package kotlinx.coroutines
|
||||
|
||||
suspend fun test(ctx: CoroutineContext, scope: CoroutineScope) {
|
||||
withContext(context = scope.coroutineContext + ctx) { 42 }
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
package kotlinx.coroutines
|
||||
|
||||
suspend fun test(scope: CoroutineScope) {
|
||||
scope.<caret>async() { 42 }.await()
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
package kotlinx.coroutines
|
||||
|
||||
suspend fun test(scope: CoroutineScope) {
|
||||
withContext(scope.coroutineContext) { 42 }
|
||||
}
|
||||
Reference in New Issue
Block a user