Lint.jl icon indicating copy to clipboard operation
Lint.jl copied to clipboard

Generator expression handled incorrectly when there is if

Open TotalVerb opened this issue 8 years ago • 2 comments

julia> lintstr("""
       f(x) = [tag for tag in x if iseven(tag)]
       """)
2-element Array{Lint.LintMessage,1}:
 none:1 E321 tag: use of undeclared symbol    
 none:1 I382 x: argument declared but not used

TotalVerb avatar Feb 05 '17 22:02 TotalVerb

This seems to show up across the board with comprehensions.

julia> lintstr("""
       f() = [x for x = 1:10 if iseven(x)]
       g() = (y for y = 1:10 if iseven(x))
       h() = Dict(z => z^2 for z = 1:10 if iseven(z))
       """)
6-element Array{Lint.LintMessage,1}:
 none:1 E321 x: use of undeclared symbol
 none:2 E321 y: use of undeclared symbol
 none:3 E321 z: use of undeclared symbol
 none:3 E321 z: use of undeclared symbol
 none:3 E321 z: use of undeclared symbol
 none:3 E321 z: use of undeclared symbol

HarrisonGrodin avatar Mar 31 '17 19:03 HarrisonGrodin

Yep, luckily I think all these cases can be handled similarly. I'll have a fix this weekend.

TotalVerb avatar Apr 01 '17 01:04 TotalVerb