Files
kotlin-fork/compiler/testData/codegen/boxInline/special/ifBranches.2.kt
T
2014-07-07 10:51:46 +04:00

25 lines
543 B
Kotlin

package test
inline fun <T> runIf(f: (T) -> T, start: T, stop: T, secondStart: T) : T {
if (f(start) == stop) {
return f(start)
}
return f(secondStart)
}
inline fun <T> runIf2(f: (T) -> T, start: T, stop: T, secondStart: T) : T {
val result = f(start)
if (result == stop) {
return result
}
return f(secondStart)
}
inline fun <T> runIfElse(f: (T) -> T, start: T, stop: T, secondStart: T) : T {
if (f(start) == stop) {
return f(start)
} else {
return f(secondStart)
}
}