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

Warn on 1-element tuple created without parens

Open tkelman opened this issue 8 years ago • 2 comments

This confused a colleague of mine: a = b, creates a 1-element tuple in a. It's an easy typo to make if you're used to putting semicolons at the end of lines.

tkelman avatar Apr 02 '16 00:04 tkelman

by the time the ast reaches lint, these two statements are identical: a = (b,) a = b, and I have a suspicion that the first one may have a legitimate use. If Lint has access to the literal code text, there may be a chance to handle that.

tonyhffong avatar Apr 02 '16 19:04 tonyhffong

Yeah, the former is explicitly the syntax for a 1-element tuple, the latter gets implicitly lowered to the same thing but that could be pretty surprising.

tkelman avatar Apr 02 '16 20:04 tkelman