Files
kotlin-fork/backend.native/tests/external/codegen/blackbox/ranges/forNullableIntInRangeWithImplicitReceiver.kt
T
Ilya Matveev 1b553ebfaf backend/tests: Add blackbox tests from Kotlin JVM
Added tests from testData/codegen/box directory. There are blackbox tests
in other directories and they are to be added.
2017-01-20 14:04:04 +03:00

21 lines
351 B
Kotlin

// WITH_RUNTIME
import kotlin.test.assertEquals
fun suppressBoxingOptimization(ni: Int?) {}
fun Int.digitsUpto(end: Int): Int {
var sum = 0
for (i: Int? in rangeTo(end)) {
suppressBoxingOptimization(i)
sum = sum*10 + i!!
}
return sum
}
fun box(): String {
assertEquals(1234, 1.digitsUpto(4))
return "OK"
}