Files
kotlin/compiler/testData/codegen/box/coroutines/suspendCovariantJavaOverrides.kt
Alexander Udalov ec2dd58165 Remove LANGUAGE_VERSION from codegen tests on coroutines
Use `// !LANGUAGE: -ReleaseCoroutines` instead in tests which require
old (1.2) coroutines, and nothing in tests which require new coroutines
because master is already 1.3. Also remove superfluous API_VERSION and
other directives which have no effect anymore. Do not include runtime
automatically with `WITH_COROUTINES`/`COMMON_COROUTINES_TEST` in box
tests; require `WITH_RUNTIME` for that (majority of tests already had it
anyway), but remove it from bytecode text tests where runtime is always
added automatically. Fix the coroutine package selection code in
KotlinTestUtils and update the bunch files correspondingly.

Disable tests in `box/coroutines/noStdLib` on JVM: despite the name,
these tests were launched with stdlib because of the code in
CodegenTestCase, and they do not work without it because at least
CoroutineUtil.kt requires stdlib to compile correctly
2018-12-20 12:53:23 +01:00

50 lines
1.0 KiB
Kotlin
Vendored

// TARGET_BACKEND: JVM
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
// FILE: I.kt
interface I {
suspend fun foo(x: Int): String
suspend fun bar(x: Int): String
}
// FILE: JavaClass.java
public class JavaClass implements I {
@Override
public String foo(int x, kotlin.coroutines.Continuation<? super String> continuation) {
return "O";
}
@Override
public Object bar(int x, kotlin.coroutines.Continuation<? super String> continuation) {
return foo(x, continuation);
}
}
// FILE: main.kt
import helpers.*
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
class K : JavaClass() {
override suspend fun foo(x: Int): String = super.foo(x) + suspendCoroutine { it.resume("K") }
}
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
fun box(): String {
var result = "fail"
builder {
// Changing the call to 'K().bar(1)' doesn't work because of KT-25036
result = K().foo(1)
}
return result
}