Remove some remaining tests on old coroutines
This commit is contained in:
-24
@@ -32369,18 +32369,6 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
|||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutineContext.kt");
|
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutineContext.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("coroutinesDisabled.kt")
|
|
||||||
public void testCoroutinesDisabled() throws Exception {
|
|
||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutinesDisabled.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("coroutinesEnabledWithWarning.kt")
|
|
||||||
public void testCoroutinesEnabledWithWarning() throws Exception {
|
|
||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutinesEnabledWithWarning.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("illegalSuspendCalls.kt")
|
@TestMetadata("illegalSuspendCalls.kt")
|
||||||
public void testIllegalSuspendCalls() throws Exception {
|
public void testIllegalSuspendCalls() throws Exception {
|
||||||
@@ -32519,12 +32507,6 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
|||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCoroutineOrReturn.kt");
|
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCoroutineOrReturn.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("suspendCoroutineOrReturn_1_2.kt")
|
|
||||||
public void testSuspendCoroutineOrReturn_1_2() throws Exception {
|
|
||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCoroutineOrReturn_1_2.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("suspendCovarianJavaOverride.kt")
|
@TestMetadata("suspendCovarianJavaOverride.kt")
|
||||||
public void testSuspendCovarianJavaOverride() throws Exception {
|
public void testSuspendCovarianJavaOverride() throws Exception {
|
||||||
@@ -32609,12 +32591,6 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
|||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/tryCatchLambda.kt");
|
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/tryCatchLambda.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("unsupported.kt")
|
|
||||||
public void testUnsupported() throws Exception {
|
|
||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/unsupported.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("usageOfResultTypeInReturnType.kt")
|
@TestMetadata("usageOfResultTypeInReturnType.kt")
|
||||||
public void testUsageOfResultTypeInReturnType() throws Exception {
|
public void testUsageOfResultTypeInReturnType() throws Exception {
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
// !LANGUAGE: -ExtendedMainConvention -ReleaseCoroutines
|
|
||||||
// Does not run on JVM_IR since it uses experimental coroutines
|
|
||||||
// IGNORE_BACKEND: JVM_IR
|
|
||||||
// WITH_RUNTIME
|
|
||||||
|
|
||||||
// uses kotlin.coroutines.experimental classes under the hood
|
|
||||||
|
|
||||||
suspend fun main(args: Array<String>) {}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
@kotlin.Metadata
|
|
||||||
public final class SuspendMain_beforeKt {
|
|
||||||
// source: 'suspendMain_before.kt'
|
|
||||||
public final static @org.jetbrains.annotations.Nullable method main(@org.jetbrains.annotations.NotNull p0: java.lang.String[], @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
// !LANGUAGE: -ReleaseCoroutines
|
|
||||||
// IGNORE_BACKEND: JVM_IR
|
|
||||||
// WITH_COROUTINES
|
|
||||||
// TREAT_AS_ONE_FILE
|
|
||||||
|
|
||||||
import helpers.*
|
|
||||||
import kotlin.coroutines.experimental.*
|
|
||||||
import kotlin.coroutines.experimental.intrinsics.*
|
|
||||||
|
|
||||||
suspend fun suspendHere() = ""
|
|
||||||
|
|
||||||
fun builder(c: suspend () -> Unit) {
|
|
||||||
c.startCoroutine(EmptyContinuation)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun box(): String {
|
|
||||||
|
|
||||||
for (i in 1..3) {
|
|
||||||
builder {
|
|
||||||
if (suspendHere() != "OK") throw java.lang.RuntimeException("fail 1")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return "OK"
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2 GETSTATIC kotlin/Unit.INSTANCE
|
|
||||||
// 1 GETSTATIC helpers/EmptyContinuation.Companion
|
|
||||||
// 3 GETSTATIC
|
|
||||||
-34
@@ -1,34 +0,0 @@
|
|||||||
// !LANGUAGE: -ReleaseCoroutines
|
|
||||||
// IGNORE_BACKEND: JVM_IR
|
|
||||||
// WITH_COROUTINES
|
|
||||||
|
|
||||||
import helpers.*
|
|
||||||
import kotlin.coroutines.experimental.*
|
|
||||||
import kotlin.coroutines.experimental.intrinsics.*
|
|
||||||
|
|
||||||
suspend fun dummy() {}
|
|
||||||
|
|
||||||
fun builder(c: suspend () -> Unit) {
|
|
||||||
c.startCoroutine(EmptyContinuation)
|
|
||||||
}
|
|
||||||
|
|
||||||
interface SuspendRunnable {
|
|
||||||
suspend fun run(): String
|
|
||||||
}
|
|
||||||
|
|
||||||
inline fun inlineMe(crossinline c: suspend () -> String) = object : SuspendRunnable {
|
|
||||||
override suspend fun run() = c()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun box(): String {
|
|
||||||
var res = "FAIL"
|
|
||||||
builder {
|
|
||||||
res = inlineMe { dummy(); "OK" }.run()
|
|
||||||
}
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
|
|
||||||
// Test for continuation of 'run' transformation.
|
|
||||||
// Since continuation is not suspend lambda, it should not have state-machine.
|
|
||||||
// @CrossinlineSuspendContinuation_1_2Kt$box$1$doResume$$inlined$inlineMe$1$1.class:
|
|
||||||
// 0 TABLESWITCH
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
// !LANGUAGE: -ReleaseCoroutines
|
|
||||||
// IGNORE_BACKEND: JVM_IR
|
|
||||||
// WITH_COROUTINES
|
|
||||||
|
|
||||||
import helpers.*
|
|
||||||
// TREAT_AS_ONE_FILE
|
|
||||||
import kotlin.coroutines.experimental.*
|
|
||||||
import kotlin.coroutines.experimental.intrinsics.*
|
|
||||||
suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x ->
|
|
||||||
x.resume("OK")
|
|
||||||
}
|
|
||||||
|
|
||||||
suspend fun suspendThere(param: Int, param2: String, param3: Long): String {
|
|
||||||
val a = suspendHere()
|
|
||||||
val b = suspendHere()
|
|
||||||
return a + b
|
|
||||||
}
|
|
||||||
|
|
||||||
// 0 ASTORE 4
|
|
||||||
-51
@@ -1,51 +0,0 @@
|
|||||||
// !LANGUAGE: -ReleaseCoroutines
|
|
||||||
// IGNORE_BACKEND: JVM_IR
|
|
||||||
// WITH_COROUTINES
|
|
||||||
|
|
||||||
import helpers.*
|
|
||||||
// TREAT_AS_ONE_FILE
|
|
||||||
import kotlin.coroutines.experimental.*
|
|
||||||
import kotlin.coroutines.experimental.intrinsics.*
|
|
||||||
suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x ->
|
|
||||||
x.resume("OK")
|
|
||||||
}
|
|
||||||
|
|
||||||
fun builder(c: suspend () -> Unit) {
|
|
||||||
c.startCoroutine(EmptyContinuation)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun box(): String {
|
|
||||||
var result = "fail 1"
|
|
||||||
|
|
||||||
builder {
|
|
||||||
// Initialize var with Int value
|
|
||||||
try {
|
|
||||||
var i: String = "abc"
|
|
||||||
i = "123"
|
|
||||||
println(i)
|
|
||||||
} finally { }
|
|
||||||
|
|
||||||
// This variable should take the same slot as 'i' had
|
|
||||||
var s: String
|
|
||||||
|
|
||||||
// We shout not spill 's' to continuation field because it's not effectively initialized
|
|
||||||
if (suspendHere() == "OK") {
|
|
||||||
s = "OK"
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
s = "fail 2"
|
|
||||||
}
|
|
||||||
|
|
||||||
result = s
|
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
// 1 LOCALVARIABLE i Ljava/lang/String; L.* 3
|
|
||||||
// 1 LOCALVARIABLE s Ljava/lang/String; L.* 3
|
|
||||||
// 0 PUTFIELD VarValueConflictsWithTableSameSort_1_2Kt\$box\$1.L\$0 : Ljava/lang/Object;
|
|
||||||
/* 1 load in try/finally */
|
|
||||||
/* 1 load in result = s */
|
|
||||||
/* 1 load in println */
|
|
||||||
// 3 ALOAD 3
|
|
||||||
-50
@@ -1,50 +0,0 @@
|
|||||||
// !LANGUAGE: -ReleaseCoroutines
|
|
||||||
// IGNORE_BACKEND: JVM_IR
|
|
||||||
// WITH_COROUTINES
|
|
||||||
|
|
||||||
import helpers.*
|
|
||||||
// TREAT_AS_ONE_FILE
|
|
||||||
import kotlin.coroutines.experimental.*
|
|
||||||
import kotlin.coroutines.experimental.intrinsics.*
|
|
||||||
suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x ->
|
|
||||||
x.resume("OK")
|
|
||||||
}
|
|
||||||
|
|
||||||
fun builder(c: suspend () -> Unit) {
|
|
||||||
c.startCoroutine(EmptyContinuation)
|
|
||||||
}
|
|
||||||
|
|
||||||
val nonConstOne = 1
|
|
||||||
|
|
||||||
fun box(): String {
|
|
||||||
var result = "fail 1"
|
|
||||||
builder {
|
|
||||||
// Initialize var with Int value
|
|
||||||
for (i in 1..nonConstOne) {
|
|
||||||
if ("".length > 0) continue
|
|
||||||
}
|
|
||||||
|
|
||||||
// This variable should take the same slot as 'i' had
|
|
||||||
var s: String
|
|
||||||
|
|
||||||
// We should not spill 's' to continuation field because it's not initialized
|
|
||||||
// More precisely it contains a value of wrong type (it conflicts with contents of local var table),
|
|
||||||
// so an attempt of spilling may lead to problems on Android
|
|
||||||
if (suspendHere() == "OK") {
|
|
||||||
s = "OK"
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
s = "fail 2"
|
|
||||||
}
|
|
||||||
|
|
||||||
result = s
|
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
// 1 LOCALVARIABLE i I L.* 3
|
|
||||||
// 1 LOCALVARIABLE s Ljava/lang/String; L.* 3
|
|
||||||
// 0 PUTFIELD VarValueConflictsWithTableKt\$box\$1.I\$0 : I
|
|
||||||
/* 2 loads in cycle */
|
|
||||||
// 2 ILOAD 3
|
|
||||||
-18
@@ -1,18 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
|
||||||
// !LANGUAGE: -Coroutines -ReleaseCoroutines
|
|
||||||
|
|
||||||
suspend fun suspendHere(): String = "OK"
|
|
||||||
|
|
||||||
fun builder(c: suspend () -> Unit) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fun box(): String {
|
|
||||||
var result = ""
|
|
||||||
|
|
||||||
builder {
|
|
||||||
suspendHere()
|
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
-18
@@ -1,18 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
|
||||||
// !LANGUAGE: -Coroutines -ReleaseCoroutines
|
|
||||||
|
|
||||||
<!UNSUPPORTED_FEATURE!>suspend<!> fun suspendHere(): String = "OK"
|
|
||||||
|
|
||||||
fun builder(c: <!UNSUPPORTED_FEATURE!>suspend<!> () -> Unit) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fun box(): String {
|
|
||||||
var result = ""
|
|
||||||
|
|
||||||
<!UNSUPPORTED_FEATURE!>builder<!> {
|
|
||||||
suspendHere()
|
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
package
|
|
||||||
|
|
||||||
public fun box(): kotlin.String
|
|
||||||
public fun builder(/*0*/ c: suspend () -> kotlin.Unit): kotlin.Unit
|
|
||||||
public suspend fun suspendHere(): kotlin.String
|
|
||||||
Vendored
-18
@@ -1,18 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
|
||||||
// !LANGUAGE: warn:Coroutines -ReleaseCoroutines
|
|
||||||
|
|
||||||
suspend fun suspendHere(): String = "OK"
|
|
||||||
|
|
||||||
fun builder(c: suspend () -> Unit) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fun box(): String {
|
|
||||||
var result = ""
|
|
||||||
|
|
||||||
builder {
|
|
||||||
suspendHere()
|
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
-18
@@ -1,18 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
|
||||||
// !LANGUAGE: warn:Coroutines -ReleaseCoroutines
|
|
||||||
|
|
||||||
<!EXPERIMENTAL_FEATURE_WARNING!>suspend<!> fun suspendHere(): String = "OK"
|
|
||||||
|
|
||||||
fun builder(c: <!EXPERIMENTAL_FEATURE_WARNING!>suspend<!> () -> Unit) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fun box(): String {
|
|
||||||
var result = ""
|
|
||||||
|
|
||||||
<!EXPERIMENTAL_FEATURE_WARNING!>builder<!> {
|
|
||||||
suspendHere()
|
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
package
|
|
||||||
|
|
||||||
public fun box(): kotlin.String
|
|
||||||
public fun builder(/*0*/ c: suspend () -> kotlin.Unit): kotlin.Unit
|
|
||||||
public suspend fun suspendHere(): kotlin.String
|
|
||||||
Vendored
-38
@@ -1,38 +0,0 @@
|
|||||||
// !LANGUAGE: -ReleaseCoroutines
|
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -EXPERIMENTAL_FEATURE_WARNING
|
|
||||||
// !CHECK_TYPE
|
|
||||||
// !WITH_NEW_INFERENCE
|
|
||||||
// SKIP_TXT
|
|
||||||
|
|
||||||
import kotlin.coroutines.*
|
|
||||||
import kotlin.coroutines.intrinsics.*
|
|
||||||
|
|
||||||
class Controller {
|
|
||||||
suspend fun noParams(): Unit = suspendCoroutineUninterceptedOrReturn {
|
|
||||||
if (hashCode() % 2 == 0) {
|
|
||||||
it.resume(Unit)
|
|
||||||
COROUTINE_SUSPENDED
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Unit
|
|
||||||
}
|
|
||||||
}
|
|
||||||
suspend fun yieldString(value: String) = suspendCoroutineUninterceptedOrReturn<Int> {
|
|
||||||
it.resume(1)
|
|
||||||
it checkType { _<Continuation<Int>>() }
|
|
||||||
it.<!INAPPLICABLE_CANDIDATE!>resume<!>("")
|
|
||||||
|
|
||||||
// We can return anything here, 'suspendCoroutineUninterceptedOrReturn' is not very type-safe
|
|
||||||
// Also we can call resume and then return the value too, but it's still just our problem
|
|
||||||
"Not-int"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun builder(c: suspend Controller.() -> Unit) {}
|
|
||||||
|
|
||||||
fun test() {
|
|
||||||
builder {
|
|
||||||
noParams() checkType { _<Unit>() }
|
|
||||||
yieldString("abc") checkType { _<Int>() }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-38
@@ -1,38 +0,0 @@
|
|||||||
// !LANGUAGE: -ReleaseCoroutines
|
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -EXPERIMENTAL_FEATURE_WARNING
|
|
||||||
// !CHECK_TYPE
|
|
||||||
// !WITH_NEW_INFERENCE
|
|
||||||
// SKIP_TXT
|
|
||||||
|
|
||||||
import kotlin.coroutines.*
|
|
||||||
import kotlin.coroutines.intrinsics.*
|
|
||||||
|
|
||||||
class Controller {
|
|
||||||
suspend fun noParams(): Unit = suspendCoroutineUninterceptedOrReturn {
|
|
||||||
if (hashCode() % 2 == 0) {
|
|
||||||
it.resume(Unit)
|
|
||||||
COROUTINE_SUSPENDED
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Unit
|
|
||||||
}
|
|
||||||
}
|
|
||||||
suspend fun yieldString(value: String) = suspendCoroutineUninterceptedOrReturn<Int> {
|
|
||||||
it.resume(1)
|
|
||||||
it checkType { _<Continuation<Int>>() }
|
|
||||||
it.<!TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS{OI}!>resume<!>(<!TYPE_MISMATCH{NI}!>""<!>)
|
|
||||||
|
|
||||||
// We can return anything here, 'suspendCoroutineUninterceptedOrReturn' is not very type-safe
|
|
||||||
// Also we can call resume and then return the value too, but it's still just our problem
|
|
||||||
"Not-int"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun builder(c: suspend Controller.() -> Unit) {}
|
|
||||||
|
|
||||||
fun test() {
|
|
||||||
builder {
|
|
||||||
noParams() checkType { _<Unit>() }
|
|
||||||
yieldString("abc") checkType { _<Int>() }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
|
||||||
// !LANGUAGE: -Coroutines -ReleaseCoroutines
|
|
||||||
|
|
||||||
suspend fun suspendHere(): String = "OK"
|
|
||||||
|
|
||||||
fun builder(c: suspend () -> Unit) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fun box(): String {
|
|
||||||
var result = ""
|
|
||||||
|
|
||||||
builder {
|
|
||||||
suspendHere()
|
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
|
||||||
// !LANGUAGE: -Coroutines -ReleaseCoroutines
|
|
||||||
|
|
||||||
<!UNSUPPORTED_FEATURE!>suspend<!> fun suspendHere(): String = "OK"
|
|
||||||
|
|
||||||
fun builder(c: <!UNSUPPORTED_FEATURE!>suspend<!> () -> Unit) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fun box(): String {
|
|
||||||
var result = ""
|
|
||||||
|
|
||||||
<!UNSUPPORTED_FEATURE!>builder<!> {
|
|
||||||
suspendHere()
|
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package
|
|
||||||
|
|
||||||
public fun box(): kotlin.String
|
|
||||||
public fun builder(/*0*/ c: suspend () -> kotlin.Unit): kotlin.Unit
|
|
||||||
public suspend fun suspendHere(): kotlin.String
|
|
||||||
Generated
-24
@@ -32465,18 +32465,6 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutineContext.kt");
|
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutineContext.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("coroutinesDisabled.kt")
|
|
||||||
public void testCoroutinesDisabled() throws Exception {
|
|
||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutinesDisabled.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("coroutinesEnabledWithWarning.kt")
|
|
||||||
public void testCoroutinesEnabledWithWarning() throws Exception {
|
|
||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/coroutinesEnabledWithWarning.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("illegalSuspendCalls.kt")
|
@TestMetadata("illegalSuspendCalls.kt")
|
||||||
public void testIllegalSuspendCalls() throws Exception {
|
public void testIllegalSuspendCalls() throws Exception {
|
||||||
@@ -32615,12 +32603,6 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCoroutineOrReturn.kt");
|
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCoroutineOrReturn.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("suspendCoroutineOrReturn_1_2.kt")
|
|
||||||
public void testSuspendCoroutineOrReturn_1_2() throws Exception {
|
|
||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendCoroutineOrReturn_1_2.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("suspendCovarianJavaOverride.kt")
|
@TestMetadata("suspendCovarianJavaOverride.kt")
|
||||||
public void testSuspendCovarianJavaOverride() throws Exception {
|
public void testSuspendCovarianJavaOverride() throws Exception {
|
||||||
@@ -32705,12 +32687,6 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/tryCatchLambda.kt");
|
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/tryCatchLambda.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("unsupported.kt")
|
|
||||||
public void testUnsupported() throws Exception {
|
|
||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/unsupported.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("usageOfResultTypeInReturnType.kt")
|
@TestMetadata("usageOfResultTypeInReturnType.kt")
|
||||||
public void testUsageOfResultTypeInReturnType() throws Exception {
|
public void testUsageOfResultTypeInReturnType() throws Exception {
|
||||||
|
|||||||
@@ -5,62 +5,37 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin
|
package org.jetbrains.kotlin
|
||||||
|
|
||||||
import org.jetbrains.kotlin.builtins.StandardNames
|
|
||||||
import org.jetbrains.kotlin.test.TargetBackend
|
import org.jetbrains.kotlin.test.TargetBackend
|
||||||
|
|
||||||
// Add the directive `// WITH_COROUTINES` to use these helpers in codegen tests (see TestFiles.java).
|
// Add the directive `// WITH_COROUTINES` to use these helpers in codegen tests (see TestFiles.java).
|
||||||
fun createTextForCoroutineHelpers(isReleaseCoroutines: Boolean, checkStateMachine: Boolean, checkTailCallOptimization: Boolean): String {
|
fun createTextForCoroutineHelpers(checkStateMachine: Boolean, checkTailCallOptimization: Boolean): String {
|
||||||
val coroutinesPackage =
|
|
||||||
if (isReleaseCoroutines)
|
|
||||||
StandardNames.COROUTINES_PACKAGE_FQ_NAME_RELEASE.asString()
|
|
||||||
else
|
|
||||||
StandardNames.COROUTINES_PACKAGE_FQ_NAME_EXPERIMENTAL.asString()
|
|
||||||
|
|
||||||
fun continuationBody(t: String, useResult: (String) -> String) =
|
fun continuationBody(t: String, useResult: (String) -> String) =
|
||||||
if (isReleaseCoroutines)
|
"""
|
||||||
"""
|
|override fun resumeWith(result: Result<$t>) {
|
||||||
|override fun resumeWith(result: Result<$t>) {
|
| ${useResult("result.getOrThrow()")}
|
||||||
| ${useResult("result.getOrThrow()")}
|
|}
|
||||||
|}
|
""".trimMargin()
|
||||||
""".trimMargin()
|
|
||||||
else
|
|
||||||
"""
|
|
||||||
|override fun resume(data: $t) { ${useResult("data")} }
|
|
||||||
|override fun resumeWithException(exception: Throwable) { throw exception }
|
|
||||||
""".trimMargin()
|
|
||||||
|
|
||||||
val handleExceptionContinuationBody =
|
val handleExceptionContinuationBody =
|
||||||
if (isReleaseCoroutines)
|
"""
|
||||||
"""
|
|override fun resumeWith(result: Result<Any?>) {
|
||||||
|override fun resumeWith(result: Result<Any?>) {
|
| result.exceptionOrNull()?.let(x)
|
||||||
| result.exceptionOrNull()?.let(x)
|
|}
|
||||||
|}
|
""".trimMargin()
|
||||||
""".trimMargin()
|
|
||||||
else
|
|
||||||
"""
|
|
||||||
|override fun resumeWithException(exception: Throwable) {
|
|
||||||
| x(exception)
|
|
||||||
|}
|
|
||||||
|
|
|
||||||
|override fun resume(data: Any?) {}
|
|
||||||
""".trimMargin()
|
|
||||||
|
|
||||||
val continuationAdapterBody =
|
val continuationAdapterBody =
|
||||||
if (isReleaseCoroutines)
|
"""
|
||||||
"""
|
|override fun resumeWith(result: Result<T>) {
|
||||||
|override fun resumeWith(result: Result<T>) {
|
| if (result.isSuccess) {
|
||||||
| if (result.isSuccess) {
|
| resume(result.getOrThrow())
|
||||||
| resume(result.getOrThrow())
|
| } else {
|
||||||
| } else {
|
| resumeWithException(result.exceptionOrNull()!!)
|
||||||
| resumeWithException(result.exceptionOrNull()!!)
|
| }
|
||||||
| }
|
|}
|
||||||
|}
|
|
|
||||||
|
|
|abstract fun resumeWithException(exception: Throwable)
|
||||||
|abstract fun resumeWithException(exception: Throwable)
|
|abstract fun resume(value: T)
|
||||||
|abstract fun resume(value: T)
|
""".trimMargin()
|
||||||
""".trimMargin()
|
|
||||||
else
|
|
||||||
""
|
|
||||||
|
|
||||||
val checkStateMachineString = """
|
val checkStateMachineString = """
|
||||||
class StateMachineCheckerClass {
|
class StateMachineCheckerClass {
|
||||||
@@ -145,9 +120,9 @@ fun createTextForCoroutineHelpers(isReleaseCoroutines: Boolean, checkStateMachin
|
|||||||
|
|
||||||
return """
|
return """
|
||||||
|package helpers
|
|package helpers
|
||||||
|import $coroutinesPackage.*
|
|import kotlin.coroutines.*
|
||||||
|import $coroutinesPackage.intrinsics.*
|
|import kotlin.coroutines.intrinsics.*
|
||||||
|${if (checkTailCallOptimization) "import $coroutinesPackage.jvm.internal.*" else ""}
|
|${if (checkTailCallOptimization) "import kotlin.coroutines.jvm.internal.*" else ""}
|
||||||
|
|
|
|
||||||
|fun <T> handleResultContinuation(x: (T) -> Unit): Continuation<T> = object: Continuation<T> {
|
|fun <T> handleResultContinuation(x: (T) -> Unit): Continuation<T> = object: Continuation<T> {
|
||||||
| override val context = EmptyCoroutineContext
|
| override val context = EmptyCoroutineContext
|
||||||
|
|||||||
@@ -122,8 +122,6 @@ public class TestFiles {
|
|||||||
assert oldValue == null : "Module with name " + supportModule.name + " already present in file";
|
assert oldValue == null : "Module with name " + supportModule.name + " already present in file";
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isReleaseCoroutines = !isDirectiveDefined(expectedText, "!LANGUAGE: -ReleaseCoroutines");
|
|
||||||
|
|
||||||
boolean checkStateMachine = isDirectiveDefined(expectedText, "CHECK_STATE_MACHINE");
|
boolean checkStateMachine = isDirectiveDefined(expectedText, "CHECK_STATE_MACHINE");
|
||||||
boolean checkTailCallOptimization = isDirectiveDefined(expectedText, "CHECK_TAIL_CALL_OPTIMIZATION");
|
boolean checkTailCallOptimization = isDirectiveDefined(expectedText, "CHECK_TAIL_CALL_OPTIMIZATION");
|
||||||
|
|
||||||
@@ -131,8 +129,7 @@ public class TestFiles {
|
|||||||
factory.createFile(
|
factory.createFile(
|
||||||
supportModule,
|
supportModule,
|
||||||
"CoroutineUtil.kt",
|
"CoroutineUtil.kt",
|
||||||
TestHelperGeneratorKt.createTextForCoroutineHelpers(
|
TestHelperGeneratorKt.createTextForCoroutineHelpers(checkStateMachine, checkTailCallOptimization),
|
||||||
isReleaseCoroutines, checkStateMachine, checkTailCallOptimization),
|
|
||||||
parseDirectives(commonPrefixOrWholeFile)
|
parseDirectives(commonPrefixOrWholeFile)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|||||||
-5
@@ -1478,11 +1478,6 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest {
|
|||||||
public void testSuspendMain() throws Exception {
|
public void testSuspendMain() throws Exception {
|
||||||
runTest("compiler/testData/codegen/bytecodeListing/main/suspendMain.kt");
|
runTest("compiler/testData/codegen/bytecodeListing/main/suspendMain.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("suspendMain_before.kt")
|
|
||||||
public void testSuspendMain_before() throws Exception {
|
|
||||||
runTest("compiler/testData/codegen/bytecodeListing/main/suspendMain_before.kt");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/bytecodeListing/multiplatform")
|
@TestMetadata("compiler/testData/codegen/bytecodeListing/multiplatform")
|
||||||
|
|||||||
-38
@@ -4047,11 +4047,6 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
|||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/oldLanguageVersions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/oldLanguageVersions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("constCoroutine.kt")
|
|
||||||
public void testConstCoroutine() throws Exception {
|
|
||||||
runTest("compiler/testData/codegen/bytecodeText/oldLanguageVersions/constCoroutine.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("noInlineJavaProtectedConstants.kt")
|
@TestMetadata("noInlineJavaProtectedConstants.kt")
|
||||||
public void testNoInlineJavaProtectedConstants() throws Exception {
|
public void testNoInlineJavaProtectedConstants() throws Exception {
|
||||||
runTest("compiler/testData/codegen/bytecodeText/oldLanguageVersions/noInlineJavaProtectedConstants.kt");
|
runTest("compiler/testData/codegen/bytecodeText/oldLanguageVersions/noInlineJavaProtectedConstants.kt");
|
||||||
@@ -4075,39 +4070,6 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/bytecodeText/oldLanguageVersions/coroutines")
|
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
|
||||||
public static class Coroutines extends AbstractBytecodeTextTest {
|
|
||||||
private void runTest(String testDataFilePath) throws Exception {
|
|
||||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testAllFilesPresentInCoroutines() throws Exception {
|
|
||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/oldLanguageVersions/coroutines"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("crossinlineSuspendContinuation_1_2.kt")
|
|
||||||
public void testCrossinlineSuspendContinuation_1_2() throws Exception {
|
|
||||||
runTest("compiler/testData/codegen/bytecodeText/oldLanguageVersions/coroutines/crossinlineSuspendContinuation_1_2.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("doNotReassignContinuation_1_2.kt")
|
|
||||||
public void testDoNotReassignContinuation_1_2() throws Exception {
|
|
||||||
runTest("compiler/testData/codegen/bytecodeText/oldLanguageVersions/coroutines/doNotReassignContinuation_1_2.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("varValueConflictsWithTableSameSort_1_2.kt")
|
|
||||||
public void testVarValueConflictsWithTableSameSort_1_2() throws Exception {
|
|
||||||
runTest("compiler/testData/codegen/bytecodeText/oldLanguageVersions/coroutines/varValueConflictsWithTableSameSort_1_2.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("varValueConflictsWithTable_1_2.kt")
|
|
||||||
public void testVarValueConflictsWithTable_1_2() throws Exception {
|
|
||||||
runTest("compiler/testData/codegen/bytecodeText/oldLanguageVersions/coroutines/varValueConflictsWithTable_1_2.kt");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/bytecodeText/oldLanguageVersions/ieee754")
|
@TestMetadata("compiler/testData/codegen/bytecodeText/oldLanguageVersions/ieee754")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
|||||||
-5
@@ -1478,11 +1478,6 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes
|
|||||||
public void testSuspendMain() throws Exception {
|
public void testSuspendMain() throws Exception {
|
||||||
runTest("compiler/testData/codegen/bytecodeListing/main/suspendMain.kt");
|
runTest("compiler/testData/codegen/bytecodeListing/main/suspendMain.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("suspendMain_before.kt")
|
|
||||||
public void testSuspendMain_before() throws Exception {
|
|
||||||
runTest("compiler/testData/codegen/bytecodeListing/main/suspendMain_before.kt");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/bytecodeListing/multiplatform")
|
@TestMetadata("compiler/testData/codegen/bytecodeListing/multiplatform")
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import com.intellij.openapi.util.text.StringUtil
|
|||||||
import com.intellij.openapi.vfs.StandardFileSystems
|
import com.intellij.openapi.vfs.StandardFileSystems
|
||||||
import com.intellij.openapi.vfs.VirtualFileManager
|
import com.intellij.openapi.vfs.VirtualFileManager
|
||||||
import com.intellij.psi.PsiManager
|
import com.intellij.psi.PsiManager
|
||||||
import com.intellij.testFramework.assertEqualsToFile
|
|
||||||
import junit.framework.TestCase
|
import junit.framework.TestCase
|
||||||
import org.jetbrains.kotlin.checkers.CompilerTestLanguageVersionSettings
|
import org.jetbrains.kotlin.checkers.CompilerTestLanguageVersionSettings
|
||||||
import org.jetbrains.kotlin.checkers.parseLanguageVersionSettings
|
import org.jetbrains.kotlin.checkers.parseLanguageVersionSettings
|
||||||
@@ -996,16 +995,6 @@ abstract class BasicBoxTest(
|
|||||||
InTextDirectivesUtils.findStringWithPrefixes(text, "// LANGUAGE_VERSION:")?.let {
|
InTextDirectivesUtils.findStringWithPrefixes(text, "// LANGUAGE_VERSION:")?.let {
|
||||||
LanguageVersion.fromVersionString(it)?.toSettings()?.trySet()
|
LanguageVersion.fromVersionString(it)?.toSettings()?.trySet()
|
||||||
}
|
}
|
||||||
if (!InTextDirectivesUtils.findLinesWithPrefixesRemoved(text, "// COMMON_COROUTINES_TEST").isEmpty()) {
|
|
||||||
assert(!text.contains("COROUTINES_PACKAGE")) { "Must replace COROUTINES_PACKAGE prior to tests compilation" }
|
|
||||||
if (!coroutinesPackage.isEmpty()) {
|
|
||||||
if (coroutinesPackage == "kotlin.coroutines.experimental") {
|
|
||||||
LanguageVersion.KOTLIN_1_2.toSettings().trySet()
|
|
||||||
} else {
|
|
||||||
LanguageVersion.KOTLIN_1_3.toSettings().trySet()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
parseLanguageVersionSettings(directives)?.trySet()
|
parseLanguageVersionSettings(directives)?.trySet()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user