julia-vscode icon indicating copy to clipboard operation
julia-vscode copied to clipboard

Bogus unused variable in function argument

Open KristofferC opened this issue 4 years ago • 2 comments

This code shows var being unused and color-highlighted in gray.

function f(var)
    rand() > 0.5 && (var = 1)
    return var
end

It is however used.

KristofferC avatar Nov 23 '21 12:11 KristofferC

Well, it is used in 50% of function calls... :) But yes, we don't currently handle this kind of conditional assignment well at all.

pfitzseb avatar Nov 23 '21 12:11 pfitzseb

I don't know if this is the right "unused variable" issue to add examples to, but Base.@kwdef's code shows params_ex and call_args as unused while they are Screen Shot 2022-08-07 at 2 17 51 PM

IanButterworth avatar Aug 07 '22 18:08 IanButterworth