Benoit Duffez
11/03/2018, 9:15 PMfun foo(bar: Long) { ... }
//elsewhere:
fun whatever(baz: Long?) = return when {
baz ?: 0 > 0 -> foo(baz) // here
else -> null
}
why is there no smart cast for baz being non null here?karelpeeters
11/03/2018, 9:21 PMBenoit Duffez
11/03/2018, 9:26 PM!!
operator but I guess it is safe here.karelpeeters
11/03/2018, 9:27 PMbaz != null && baz > 0
or something?hudsonb
11/03/2018, 9:46 PMBenoit Duffez
11/04/2018, 12:45 PMkingsley
11/04/2018, 5:35 PMbaz
was null
, it still continues to be null
karelpeeters
11/04/2018, 5:36 PMbaz ?: 0 > 0
then baz
is certainly not null.kingsley
11/04/2018, 5:37 PM