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

Incorrect unused binding lint in do block #2601

Open
BenPH opened this issue Dec 5, 2021 · 1 comment
Open

Incorrect unused binding lint in do block #2601

BenPH opened this issue Dec 5, 2021 · 1 comment
Labels

Comments

@BenPH
Copy link
Contributor

BenPH commented Dec 5, 2021

line in the do block below gets linted as unused.

image

For copy paste

function f()
    local line
    open("path") do io
        line = readline(io)
    end
    line
end
@grahamgill
Copy link

grahamgill commented Feb 28, 2023

Interestingly, in this example

function test_this()
    local u
    local v::Int
    
    try
        u = 1
        v = 2
    catch
        @warn "Unexpected!"
    end
    
    v
end

function test_that()
    local x
    local y::Int
    
    let
        x = 1
        y = 2
    end
    
    x + y
end

contrary to expectations, u gets no unused warning, whereas v, x and y all get unused warnings, as indicated by the greyed out variable names in the screen shot try and let scope blocks below.

Calling the functions, we get test_this() == 2 and test_that() == 3 as expected.

This is with vscode 1.75.1, julia-vscode 1.38.2, Julia 1.8.5.

Screenshot 2023-02-28 at 2 10 52 PM

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

3 participants