Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linter reports missing reference for assignments within while block condition #3550

Open
Holbormon opened this issue Feb 22, 2024 · 0 comments
Labels

Comments

@Holbormon
Copy link

Holbormon commented Feb 22, 2024

Consider the following MRE:

function rand_or_nothing()

    if (foo = rand()) < .5
        return foo
    end

    return foo + 1

end

while (bar = rand_or_nothing()) < .7
    display(bar)
end

display(bar)

While foo is correctly detected by the linter as being well-defined in both of its occurences, bar is reported as a "missing reference" in the second call to display (but not in the first call inside the while loop).

The code runs fine (without warning) when interpreted by Julia.

@pfitzseb pfitzseb added the bug label Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants