Added inline tests for jvm 8 target
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
// JVM_TARGET: 1.8
|
||||
//WITH_RUNTIME
|
||||
|
||||
// FILE: 1.kt
|
||||
package test
|
||||
|
||||
public inline fun <T, R> Iterable<T>.fold2(initial: R, operation: (R, T) -> R): R {
|
||||
var accumulator = initial
|
||||
for (element in this) accumulator = operation(accumulator, element)
|
||||
return accumulator
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
val list = listOf("O", "K")
|
||||
return list.fold2("") {a, b -> a +b}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// JVM_TARGET: 1.8
|
||||
//WITH_RUNTIME
|
||||
|
||||
fun box(): String {
|
||||
val list = listOf("O", "K")
|
||||
return list.fold("") {a, b -> a +b}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user