Missing setter implementation not detected by compiler

The following compiles successfully but throws an AbstractMethodError at runtime (1.8.10).

interface Interface {
    var a: String

open class Open {
    val a: String = "default"

class Impl : Open(), Interface

fun main() {
    val x = Impl()
    x.a = ""

Why does the compiler allow this? Is this a known problem or am I missing something?

Edit: Created issue https://youtrack.jetbrains.com/issue/KT-56779

1 Like

It definitely looks like a compiler bug.

The reason why the code compiles successfully is because the Impl class is implementing the Interface interface, which declares a property a without a setter. Since Impl extends the Open class and inherits the a property from it, the a property in Impl is initialized with the value from the Open class and is effectively a read-only property.