I mean at the call site. I usually write the code like this inside a module where smart cast works:
if (data.id != null) handle(data.id)
and outside the module where smart cast doesn’t work:
val id: Int? = data.id
if (id != null) handle(id)
Could the compiler generate the second code when consuming Kotlin immutable properties, and then break (like other code would) if the API changes runtime to something that is not an immutable property?