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

VSCode linter not able to reason about the 1.7 destructuring syntax properly #2639

Closed
MrVPlusOne opened this issue Dec 19, 2021 · 1 comment · Fixed by julia-vscode/StaticLint.jl#371

Comments

@MrVPlusOne
Copy link

A minimal example to demonstrate this:

For the following code

struct TestStruct
    a
    b
end

struct TestWrapper
    s::TestStruct
end

# linter generates "missing references" for s.b
function test(wrapper::TestWrapper)
    (; s) = wrapper
    s.b
end

# but works fine if not using the destructuring syntax
function test_2(wrapper::TestWrapper)
    s = wrapper.s
    s.b
end

The linter has the following behavior:
image

@HugoMelchers
Copy link

Just replying to this issue to say that I'm running into this as well right now. Based on the suggestions that the language server is providing, it thinks that the type of s is TestWrapper instead of TestStruct.
suggestion1
The warnings at s.b doesn't show up here for some reason, but in more complicated code I do get equivalent warnings.
suggestion2

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

Successfully merging a pull request may close this issue.

3 participants