karelpeeters
11/21/2017, 4:56 PMtailrec
on a function that doesn't actually have any tail recursion is always a mistake, so it deserves a warning. Consider this code though:
fun foo(list: List<Int>) {
list.forEach {
if(it == 0) return
println(it)
}
println("done")
}
The return
here isn't wrong, so it shouldn't get a warning. How do you separate them?