The Kotlin compiler is smart. By performing static analysis on your code, the compiler identifies mistakes in your code as you type it.
One of the most notable features of the Kotlin compiler is smart casting. The compiler has the ability to perform a cast based on the type checks done by the developer.
The compiler tracks the is-checks, null-checks, and explicit casts for immutable values. Using the acquired information, the compiler casts variables when needed.
Report Story