[TESTS] Remove jvm specific annotations from coroutine helpers

This commit is contained in:
Ivan Kylchik
2021-09-07 19:36:07 +03:00
parent 410a6e7ef8
commit 596cbdfb71
5 changed files with 23 additions and 28 deletions
@@ -1,11 +1,7 @@
@file:JvmMultifileClass
@file:JvmName("CoroutineUtilKt")
package helpers
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
import kotlin.coroutines.jvm.internal.*
fun <T> handleResultContinuation(x: (T) -> Unit): Continuation<T> = object: Continuation<T> {
override val context = EmptyCoroutineContext
@@ -0,0 +1,21 @@
package helpers
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
val StateMachineChecker = StateMachineCheckerClass()
object CheckStateMachineContinuation: ContinuationAdapter<Unit>() {
override val context: CoroutineContext
get() = EmptyCoroutineContext
override fun resume(value: Unit) {
StateMachineChecker.proceed = {
StateMachineChecker.finished = true
}
}
override fun resumeWithException(exception: Throwable) {
throw exception
}
}
@@ -1,11 +1,7 @@
@file:JvmMultifileClass
@file:JvmName("CoroutineUtilKt")
package helpers
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
import kotlin.coroutines.jvm.internal.*
class StateMachineCheckerClass {
private var counter = 0
@@ -36,20 +32,3 @@ class StateMachineCheckerClass {
if (checkFinished && !finished) error("Wrong state-machine generated: it is not finished yet")
}
}
val StateMachineChecker = StateMachineCheckerClass()
object CheckStateMachineContinuation: ContinuationAdapter<Unit>() {
override val context: CoroutineContext
get() = EmptyCoroutineContext
override fun resume(value: Unit) {
StateMachineChecker.proceed = {
StateMachineChecker.finished = true
}
}
override fun resumeWithException(exception: Throwable) {
throw exception
}
}
@@ -1,6 +1,3 @@
@file:JvmMultifileClass
@file:JvmName("CoroutineUtilKt")
package helpers
import kotlin.coroutines.*
@@ -21,6 +21,7 @@ class CoroutineHelpersSourceFilesProvider(testServices: TestServices, testDataPa
private val helpersPath = "$testDataPath/compiler/testData/diagnostics/helpers/coroutines"
private val coroutineHelpersPath = "$helpersPath/CoroutineHelpers.kt"
private val coroutineUtilPath = "$helpersPath/CoroutineUtil.kt"
private val stateMachineCheckerPath = "$helpersPath/StateMachineChecker.kt"
private val tailCallOptimizationCheckerPath = "$helpersPath/TailCallOptimizationChecker.kt"
@@ -33,6 +34,7 @@ class CoroutineHelpersSourceFilesProvider(testServices: TestServices, testDataPa
return buildList {
add(File(coroutineHelpersPath).toTestFile())
if (CHECK_STATE_MACHINE in module.directives) {
add(File(coroutineUtilPath).toTestFile())
add(File(stateMachineCheckerPath).toTestFile())
}
if (CHECK_TAIL_CALL_OPTIMIZATION in module.directives) {