mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-12 00:21:32 +00:00
13 lines
380 B
Kotlin
13 lines
380 B
Kotlin
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
|
|
|
tailRecursive fun test(x : Int, a : Any) : Int =
|
|
if (x == 1) {
|
|
<!NON_TAIL_RECURSIVE_CALL!>test<!>(x - 1, "no tail")
|
|
1 + <!NON_TAIL_RECURSIVE_CALL!>test<!>(x - 1, "no tail")
|
|
} else if (x > 0) {
|
|
test(x - 1, "tail")
|
|
} else {
|
|
0
|
|
}
|
|
|
|
fun box() : String = if (test(1000000, "test") == 1) "OK" else "FAIL" |