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

wrong: cannot declare constant: already have a value: clear cache? #3598

Open
lmiq opened this issue Apr 26, 2024 · 3 comments
Open

wrong: cannot declare constant: already have a value: clear cache? #3598

lmiq opened this issue Apr 26, 2024 · 3 comments

Comments

@lmiq
Copy link

lmiq commented Apr 26, 2024

I'm getting these warning, wrongly, in VSCode:

image

One may try to see if that happens with:

julia> dev Packmol

and check the src/mono_atomic.jl file. It is the first structure defined there.

(but I'm getting that in other packages as well, completely unrelated)

For example, with: julia> dev ComplexMixtures, in the file src/results.jl, the Result data structure shows the same (line 61).

Someone already tried to reproduce the problem without success, and it was suggested that it might be a cache issue.

So, how can I clear the cache, or debug this issue?

@lmiq
Copy link
Author

lmiq commented Apr 26, 2024

I deleted:

~/.config/Code/User/globalStorage/julialang.language-julia

which seems the have triggered a rebuild of the cache.

And also deleted:

~/.vscode/extensions/julialang.language-julia-1.76.2

after removing the extension.

Then reinstalled, and the problem persists.

@lmiq lmiq changed the title wrong: > cannot declare constant: already have a value: clear cache? wrong: cannot declare constant: already have a value: clear cache? Apr 26, 2024
@pfitzseb
Copy link
Member

AFAICT this is happening due to the import Packmol: MonoAtomicFG, fg! line in the @testitem at the end of your source file. Seems like a weird place for that?

We can't easily tell that @testitems introduce a new module scope (they do, right?), so it seems like we should maybe just special case that macro; disabling linting in macros scopes might feel kinda bad.

@lmiq
Copy link
Author

lmiq commented Apr 26, 2024

Uhm, I see.

import Packmol: MonoAtomicFG, fg! line in the @testitem at the end of your source file. Seems like a weird place for that?

Not really, beacause MonoAtomicFG and fg! are internal functions which are being tested there, so seems reasonable to import them there (actually I should be using Packmol: MonoAtomicFG, fg!, but that triggers the linter as well).

As a workaround I removed that line and used explicit Packmol.fg! etc in the test code.

Related, but not the same: in the same file, we can see another incorrect linting of the same type, in the second line:

image

This is not the first use those types in the code. In fact I can remove that line, because the same types are imported into to scope in the main Packmol.jl file. However, it doesn't seem to me that the warning should be there, anyway, since these are imports of the same objects (but that is more of a preference, I guess).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants