tonyhffong / Lint.jl

A lint tool for Julia code
Other
168 stars 33 forks source link

False positive: E539 when number as type parameter #232

Closed mfalt closed 7 years ago

mfalt commented 7 years ago

The following function

function f{N}(v::NTuple{N,Float64})
    for i = 1:N
        println(v[i])
    end
end

Gives the error E539 i: assigning an error to a variable, I assume this is because Lint doesn't recognize that N is a number. It is easy to verify by running

lintstr("function f{N}(v::NTuple{N,Float64}) for i = 1:N println(v[i]) end end")

but is is clearly not a real problem:

julia> f((1.0,3.0,2.0))
1.0
3.0
2.0

Verified on Julia Version 0.6.0-rc1.0

TotalVerb commented 7 years ago

Thanks for the report. Can you try Pkg.checkout("Lint") and see if the problem persists?

mfalt commented 7 years ago

Seems to work fine on master, thanks!