Smart cast means the compiler treats a variable as a more specific type after a check like `is` or `!= null`. It works when the value is stable (e.g., a local `val`). It often does not work for mutable `var`, open properties, or values that can change via custom getters or concurrency. Fix: assign to a local `val` or use an explicit cast when safe.
Expanding on the short answer — what usually matters in practice:
A tiny example (an explanation template):
// Example: discuss trade-offs for "kotlin-smart-casts:-when-do-they-work-and-when-d"
function explain() {
// Start from the core idea:
// Smart cast means the compiler treats a variable as a more specific type after a check like
}