There should be other ways to tell compiler about nullability


It is pretty handy that the compiler automatically detects null-Checks like these

val x : String? = getX()
if(x == null) return
x.trim()            // <-- works

On the other hand the more useful functions doesn’t have this feature:

val x : String? = getX()
if(x.isNullOrBlank()) return
x.trim()           // <-- will not compile since x is still potential null

Wouldn’t it be possible to mark such methods (like isNullOrBlank) somehow so that the compiler knows that they are performing null-Checks?


This DOES work in Kotlin 1.3. :wink:


Shame on me that I didn’t read to news carefully enough :sweat_smile: Great works guys :+1: