Editors' Pick

Popular Post

Recent Posts

post-thumb

Kotlin contracts

Kotlin logo

Motivation

The Kotlin smartcast feature allows to write cleaner code and reduce boilerplate. However, it does not handle all possible situations properly. For example, suppose that we define a function that returns a distinct value if its parameter is not null. When we execute that function under the condition that the distinct value has been returned, then the Kotlin compiler does not automatically cast the parameter to a non-nullable type.

Read more Details