Lint.jl
Lint.jl copied to clipboard
Warn on 1-element tuple created without parens
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.
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.
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.