Redundant async: do not suggest for calls with 'start'

The reason with 'withContext' does not have such parameter anymore
This commit is contained in:
Mikhail Glukhikh
2018-11-30 15:13:26 +03:00
parent 3d15cbcced
commit a7ad1113b2
4 changed files with 2 additions and 11 deletions
@@ -39,7 +39,7 @@ class RedundantAsyncInspection : AbstractCallChainChecker() {
} ?: return null
defaultContext ?: return null
defaultStart ?: return null
if (defaultContext!! && !defaultStart!!) return null
if (!defaultStart!!) return null
val receiverExpression = expression.receiverExpression
val scopeExpression = (receiverExpression as? KtQualifiedExpression)?.receiverExpression
@@ -33,7 +33,6 @@ fun <T> CoroutineScope.async(
suspend fun <T> withContext(
context: CoroutineContext,
start: CoroutineStart = CoroutineStart.DEFAULT,
block: suspend CoroutineScope.() -> T
) {
TODO()
@@ -1,4 +1,5 @@
// WITH_RUNTIME
// PROBLEM: none
package kotlinx.coroutines
@@ -1,9 +0,0 @@
// WITH_RUNTIME
package kotlinx.coroutines
suspend fun test(ctx: CoroutineContext) {
coroutineScope {
withContext(ctx, CoroutineStart.LAZY) { 42 }
}
}