-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: crystal next compatibility #407
Conversation
7d751be
to
5010f61
Compare
5010f61
to
789e1b7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint/UselessAssign
rule is using transformed?
, just fyi
Exactly, I left it for BC. It is not needed anymore for Crystal master and above. |
@veelenga Could you please explain what do you mean by BC in this particular case? And why it's not longer needed? |
@Sija, sure. In this PR, we've introduced support for Crystal's master version and subsequent versions. The term "BC" refers to the backward compatibility of Crystal (1.9.x) and earlier versions. We implemented the collection.each do |(a, b)|
puts b
end is transformed before the AST phase to: collection.each do |__arg0|
a = __arg0[0]
b = __arg0[1]
puts(b)
end This transformation leads to false positives since the assignment to the variable However, in the Crystal master, the block mentioned above remains unaltered, and the resulting AST mirrors the original code: collection.each do |(a, b)|
puts(b)
end Consequently, for the Crystal master and later versions, the |
@veelenga Thanks for the thorough explanation ❤️ It all makes sense (re-reading referenced PR helped too 😅), let's have this shipped then! |
refs crystal-lang/crystal#11597
fixes #406
cc @straight-shoota