rrva
05/19/2020, 12:17 PMif (it.playables != null && it.playables.isNotEmpty())
Why does the compiler force me to write
if (it.playables != null && it.playables!!.isNotEmpty())
Due to the fact that
Smart cast to 'List<IdString>' is impossible, because 'it.playables' is a public API property declared in different moduleDesmond Teo
05/19/2020, 12:23 PMit.playables?.isNotEmpty() == truestreetsofboston
05/19/2020, 12:28 PMit may have changed `it`’s nullable property playbable to the value null just after the it.playables != null check but before the it.playables.isNotEmpty() call.rrva
05/19/2020, 12:30 PMrrva
05/19/2020, 12:30 PMstreetsofboston
05/19/2020, 12:31 PMrrva
05/19/2020, 12:33 PMstreetsofboston
05/19/2020, 12:35 PMit.playables?.let { … } will do the trickMichael de Kaste
05/19/2020, 12:59 PMKroppeb
05/19/2020, 1:52 PMplayables to be a var instead of a val, or a inconsistent custom getter, this piece of code would still work, as there is still a getter available. However now the guarantee that it.playables is not null is no longer true.kqr
05/20/2020, 9:56 AM