JVM_IR: fix name of received field for suspend lambdas

$ at the start caused AnonymousObjectTransformer to skip the field.
This commit is contained in:
Georgy Bronnikov
2019-12-21 15:26:16 +03:00
committed by Ilmir Usmanov
parent 068d3f4beb
commit d4b0151f51
10 changed files with 58 additions and 3 deletions
@@ -1,8 +1,8 @@
@kotlin.coroutines.jvm.internal.DebugMetadata
@kotlin.Metadata
final class LambdaWithLongReceiverKt$box$1$1 {
private field $p: long
private field label: int
private field p$: long
inner class LambdaWithLongReceiverKt$box$1
inner class LambdaWithLongReceiverKt$box$1$1
public method <init>(p0: kotlin.coroutines.Continuation): void
+25
View File
@@ -0,0 +1,25 @@
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
/**
* _Example_
* The following will print `1`, `2` and `3` when executed:
* ```
* arrayOf(1, 2, 3, 4, 5)
* .iterator()
* .stopAfter { it == 3 }
* .forEach(::println)
* ```
* @return an iterator, which stops [this] Iterator after first element for which [predicate] returns `true`
*/
inline fun <T> Iterator<T>.stopAfter(crossinline predicate: (T) -> Boolean): Iterator<T> = iterator {
for (element in this@stopAfter) {
yield(element)
if (predicate(element)) {
break
}
}
}
fun box() =
listOf("OK", "fail").iterator().stopAfter { it == "OK" }.next()