Use new sequence builders in tests
Coroutine tests will fail when LV=1.2 because there're no such builders in kotlin.coroutines.experimental. #KT-26678
This commit is contained in:
@@ -5,7 +5,6 @@
|
|||||||
// COMMON_COROUTINES_TEST
|
// COMMON_COROUTINES_TEST
|
||||||
import helpers.*
|
import helpers.*
|
||||||
import COROUTINES_PACKAGE.*
|
import COROUTINES_PACKAGE.*
|
||||||
import COROUTINES_PACKAGE.intrinsics.*
|
|
||||||
|
|
||||||
enum class Foo(vararg expected: String) {
|
enum class Foo(vararg expected: String) {
|
||||||
A("start", "A", "end"),
|
A("start", "A", "end"),
|
||||||
@@ -30,7 +29,7 @@ fun box(): String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getSequence(a: Foo) =
|
fun getSequence(a: Foo) =
|
||||||
buildSequence {
|
sequence {
|
||||||
yield("start")
|
yield("start")
|
||||||
when (a) {
|
when (a) {
|
||||||
Foo.A -> {
|
Foo.A -> {
|
||||||
|
|||||||
Vendored
+1
-2
@@ -5,10 +5,9 @@
|
|||||||
// COMMON_COROUTINES_TEST
|
// COMMON_COROUTINES_TEST
|
||||||
import helpers.*
|
import helpers.*
|
||||||
import COROUTINES_PACKAGE.*
|
import COROUTINES_PACKAGE.*
|
||||||
import COROUTINES_PACKAGE.intrinsics.*
|
|
||||||
|
|
||||||
val f = run {
|
val f = run {
|
||||||
buildSequence {
|
sequence {
|
||||||
if (true) {
|
if (true) {
|
||||||
yield("OK")
|
yield("OK")
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-4
@@ -1,10 +1,9 @@
|
|||||||
// LANGUAGE_VERSION: 1.3
|
// LANGUAGE_VERSION: 1.3
|
||||||
|
|
||||||
import kotlin.coroutines.*
|
|
||||||
import kotlin.sequences.*
|
import kotlin.sequences.*
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
val s = buildSequence {
|
val s = sequence {
|
||||||
yield(1)
|
yield(1)
|
||||||
val a = awaitSeq()
|
val a = awaitSeq()
|
||||||
println(a) // (1)
|
println(a) // (1)
|
||||||
@@ -12,7 +11,7 @@ fun main(args: Array<String>) {
|
|||||||
println(s.toList())
|
println(s.toList())
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun SequenceBuilder<Int>.awaitSeq(): Int = 42
|
suspend fun SequenceScope<Int>.awaitSeq(): Int = 42
|
||||||
|
|
||||||
// 1 LOCALVARIABLE a I L18 L22 3
|
// 1 LOCALVARIABLE a I L18 L22 3
|
||||||
// 1 LINENUMBER 10 L18
|
// 1 LINENUMBER 9 L18
|
||||||
Vendored
+3
-3
@@ -1,9 +1,9 @@
|
|||||||
package primitivesCoertion
|
package primitivesCoertion
|
||||||
|
|
||||||
import kotlin.coroutines.*
|
import kotlin.sequences.*
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
val a = buildSequence {
|
val a = sequence {
|
||||||
yield(1)
|
yield(1)
|
||||||
val a = awaitSeq()
|
val a = awaitSeq()
|
||||||
//Breakpoint!
|
//Breakpoint!
|
||||||
@@ -12,7 +12,7 @@ fun main(args: Array<String>) {
|
|||||||
println(a.toList())
|
println(a.toList())
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun SequenceBuilder<Int>.awaitSeq(): Int = 42
|
suspend fun SequenceScope<Int>.awaitSeq(): Int = 42
|
||||||
|
|
||||||
// EXPRESSION: a
|
// EXPRESSION: a
|
||||||
// RESULT: 42: I
|
// RESULT: 42: I
|
||||||
|
|||||||
Reference in New Issue
Block a user