Skip to content

Commit

Permalink
Add TC for extension method for RedundantSuspendModifierSpec (#7225)
Browse files Browse the repository at this point in the history
  • Loading branch information
atulgpt committed Apr 27, 2024
1 parent 3b6634a commit a06562d
Showing 1 changed file with 13 additions and 0 deletions.
Expand Up @@ -139,4 +139,17 @@ class RedundantSuspendModifierSpec(val env: KotlinCoreEnvironment) {
""".trimIndent()
assertThat(subject.compileAndLintWithContext(env, code)).isEmpty()
}

@Test
fun `does not report when suspend function is called in extension method`() {
val code = """
import kotlinx.coroutines.delay
suspend fun foo() { delay(1000) }
suspend fun String.bar() {
foo()
}
suspend fun String.baz() = foo()
""".trimIndent()
assertThat(subject.compileAndLintWithContext(env, code)).isEmpty()
}
}

0 comments on commit a06562d

Please sign in to comment.