blyn
10/29/2018, 8:49 PMprivate fun foo(value: String?) {
var myString: String = ""
if (!value.isNullOrEmpty()) {
myString = value
}
}
IDE complains that there’s a type mismatch between myString
and value
, but the compile builds no problem (and warns if i explicitly !!
). Is there anyway around this?orangy
10/29/2018, 8:53 PMskennedy
10/29/2018, 8:57 PMblyn
10/29/2018, 8:57 PM3.2.1
and 3.3.0-beta01
1.3.0
mattinger
10/30/2018, 2:52 AM@kotlin.internal.InlineOnly
public inline fun CharSequence?.isNullOrEmpty(): Boolean {
contract {
returns(false) implies (this@isNullOrEmpty != null)
}
return this == null || this.length == 0
}
marstran
10/30/2018, 8:47 AM