I’m hitting a strange type checking recursive problem when using expression bodies.
// This is ok:
fun Int.recursive() {
init {
if (this > 0)
(this - 1).recursive()
}
}
// But this is not:
fun Int.recursive() = init {
if (this > 0)
(this - 1).recursive() // Type checking has run into a recursive problem
}
fun init(inner: () -> Unit) {
return inner()
}
I suspect this is intentional, but I don’t quite understand why the recursion doesn’t work with an expression body here.