Is this a compiler bug or a conscious design decision?
The compiler is smart enough when we inline the bar
function:
class Foo {
val c: String
init {
// bar()
println(c.length) // Compile-time error: Variable 'c' must be initialized
c = ""
}
fun bar() {
println(c.length)
}
}
So why doesn’t the compiler check for uninitialized variables inside bar()
? Would it be too time-consuming?