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

Case where auto correction of multiline { } to do end block introduces a syntax error #1350

Closed
rousisk opened this issue Sep 26, 2014 · 2 comments
Assignees

Comments

@rousisk
Copy link

rousisk commented Sep 26, 2014

This snippet:

my_method :arg1, arg2: proc { 
  # assume a long proc that warrants the use of multiple lines
}, arg3: :another_value

is being auto corrected to:

my_method :arg1, arg2: proc do 
  # assume a long proc that warrants the use of multiple lines
end, arg3: :another_value

which raises a syntax error (due to the precedence differences between {} and do end).

@bbatsov
Copy link
Collaborator

bbatsov commented Oct 3, 2014

Indeed. We should check for AST changes before doing such auto-corrections. @jonas054 Would you take care of this?

@jonas054
Copy link
Collaborator

jonas054 commented Oct 3, 2014

Sure.

@jonas054 jonas054 self-assigned this Oct 3, 2014
bbatsov added a commit that referenced this issue Oct 8, 2014
[Fix #1350] Check that Blocks cop doesn't create syntax errors
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

No branches or pull requests

3 participants