Files
kotlin-fork/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/functionWithNonTailRecursions.kt
T
Ivan Kylchik 0d02b1d51c [TESTS] Remove ignore js backend directive from some tailRecursion tests
These tests were falling due to inserted diagnostics. New test
infrastructure can remove them before running test.
2021-10-25 00:14:19 +03:00

26 lines
630 B
Kotlin
Vendored

// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: IGNORED_IN_JS
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
// IGNORE_FIR_DIAGNOSTICS_DIFF
tailrec fun badTails(x : Int) : Int {
if (x < 50 && x != 10 && x > 0) {
return 1 + <!NON_TAIL_RECURSIVE_CALL!>badTails<!>(x - 1)
}
else if (x == 10) {
@Suppress("NON_TAIL_RECURSIVE_CALL")
return 1 + badTails(x - 1)
} else if (x >= 50) {
return badTails(x - 1)
}
return 0
}
fun box(): String {
badTails(1000000)
return "OK"
}