Skip to content

False positive "loop iterator will likely error" for local bound from Bool-mask indexing — fires in any package workspace, not standalone files #304

Description

@cdstephens

To reproduce: generate a test package with Pkg.generate("LintRepro"). Add test.jl with the 4-line code below:

function h(v::Vector{Float64}, m::Vector{Bool})
    mv = v[m]
    for a in mv; @show a; end
end

Then, open the folder in VSCode, it highlights a in mv. Replacing the second line with mv::Vector{Float64} = v[m] removes the warning. Replacing line 3 with for a in v[m]; @show a; end also removes the warning. Doesn't need to be in src/, just being in the workspace root suffices.

Version info:
Extension 1.219.2
Julia Version 1.12.7
Commit 6d172b025e (2026-08-15 08:05 UTC)
Build Info:
Official https://julialang.org release
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: 20 × 13th Gen Intel(R) Core(TM) i7-13700H
WORD_SIZE: 64
LLVM: libLLVM-18.1.7 (ORCJIT, alderlake)
GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 20 virtual cores)
Environment:
JULIA_EDITOR = code
JULIA_VSCODE_REPL = 1

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions