Files
kotlin-fork/compiler/testData/codegen/boxInline/signature/byteIteratorWithForLoop.kt
T
Dmitriy Novozhilov 3b6ad36af1 [Test] Update/unmute tests after previous fixes
It's hard to tell which exact commit fixed each test
2023-10-17 12:46:28 +00:00

30 lines
801 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// ALLOW_KOTLIN_PACKAGE
// Note: order of files is important
// MODULE: kotlin_stdlib
// FILE: _Arrays.kt
package kotlin.collections
public inline fun ByteArray.customFirst(predicate: (Byte) -> Boolean): Byte {
for (element in this) if (predicate(element)) return element
throw NoSuchElementException("Array contains no element matching the predicate.")
}
// FILE: PrimitiveIterators.kt
package kotlin.collections
public abstract class ByteIterator : Iterator<Byte> {
override final fun next() = nextByte()
/** Returns the next value in the sequence without boxing. */
public abstract fun nextByte(): Byte
}
// Module: main(kotlin_stdlib)
// FILE: main.kt
fun box(): String {
byteArrayOf(1, 2, 3).customFirst { it == 1.toByte() }
return "OK"
}