TwoClocks
10/21/2021, 7:59 PMif( myThing == null ) { myThing = ... }
I always get an error if I try to reference myThing
after this block, because the compiler can't tell if it's null or not. I assume this is because threads exist. Is there a option I can give to the compiler to tell it I'm single threaded, and it can ensure the type is correct?@OptIn
for a file/class/block ?Paul Griffith
10/21/2021, 8:37 PMmyThing?.let {}
, since it will capture the definitely-not-null myThing
into a variableTwoClocks
10/21/2021, 11:17 PMthanksforallthefish
10/22/2021, 5:55 AMvar myThing: Any? = null
myThing = myThing ?: something
myThing.doThing() //at least for me compiler is ok with this