I was very surprised Today to notice that a local ...
# announcements
b
I was very surprised Today to notice that a local variable takes precedence over a receiver property inside the body of a lambda with receiver:
Copy code
data class Data(var value: Int = 0)

fun main(args: Array<String>) {
    val value = 33
    println(Data().apply {
        this.value = 42
        value = 42 // ERROR: Val cannot be reassigned
    })
}
Is this behaviour described somewhere? And is it as intended?