Redundant async inspection: support case with GlobalScope
Partial implementation of KT-28504
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
// PROBLEM: none
|
||||
|
||||
package kotlinx.coroutines
|
||||
|
||||
suspend fun test(ctx: CoroutineContext) {
|
||||
// Does not work yet (1.3.11)
|
||||
GlobalScope.<caret>async(ctx) { 42 }.await()
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
package kotlinx.coroutines
|
||||
|
||||
suspend fun test(ctx: CoroutineContext) {
|
||||
withContext(ctx) { 42 }
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
package kotlinx.coroutines
|
||||
|
||||
suspend fun test() {
|
||||
GlobalScope.<caret>async() { 42 }.await()
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
package kotlinx.coroutines
|
||||
|
||||
suspend fun test() {
|
||||
withContext(Dispatchers.Default) { 42 }
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.async
|
||||
|
||||
suspend fun test() {
|
||||
GlobalScope.<caret>async() { 42 }.await()
|
||||
}
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
suspend fun test() {
|
||||
withContext(Dispatchers.Default) { 42 }
|
||||
}
|
||||
Reference in New Issue
Block a user