lua-language-server icon indicating copy to clipboard operation
lua-language-server copied to clipboard

`repeat…until val ~= nil` should satisfy the need for nil checks

Open dljsjr opened this issue 1 year ago • 0 comments

I have some code where I have to wait for a forked process to create a file and I can't get feedback over its return status or stdout, so I use a polling pattern similar to this:

local val = nil

-- kick off the external process
fork_process(...)

repeat
    val = check_for_val(...)
until val ~= nil

val:foo()

In this current form, I get a diagnostic that says I need to perform a nil check on val before calling foo, but the loop condition here should be considered the nil check.

This already works for while val == nil do...end so it would be nice to see it for repeat...until val~= nil as well.

dljsjr avatar Feb 19 '24 19:02 dljsjr