Skip to content
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

Rightward assignment => converted to in when preceded by in in a prior line #146

Closed
nixme opened this issue Aug 23, 2022 · 1 comment · Fixed by #147
Closed

Rightward assignment => converted to in when preceded by in in a prior line #146

nixme opened this issue Aug 23, 2022 · 1 comment · Fixed by #147

Comments

@nixme
Copy link

nixme commented Aug 23, 2022

Example:

puts SyntaxTree.format <<~RUBY
  if a in Integer
    puts "a is integer"
  end

  b => [Integer => c]
RUBY

emits:

puts "a is integer" if a in Integer

b in [Integer => c]

However, as long as you don't use in earlier in scope, the b line correctly isn't modified

puts SyntaxTree.format "b => [Integer => c]"

emits

b => [Integer => c]

Happy to take a crack at fixing if you can point me in the right direction.

@kddnewton
Copy link
Member

Thanks for the report! This was actually pretty in the weeds of how the parser works so I went ahead and fixed it myself. The PR is linked, and it'll be out in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants