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

Remove an example which is a syntax error in Ruby's parser #2017

Merged
merged 1 commit into from
Dec 26, 2024
Merged

Conversation

ydah
Copy link
Member

@ydah ydah commented Dec 25, 2024

This code generates a syntax error as follows:

 ruby -e '[1].each { put _1; [1].each { put _1 } }'
-e: -e:1: syntax error found (SyntaxError)
> 1 | ... _1 } }
    |     ^~ numbered parameter is already used in outer block

When numbered parameters are used in nested blocks, it is not possible to use numbered parameters in multiple different hierarchies.

While it was considered to split these up, we discussed below.
#2014 (comment)


Before submitting the PR make sure the following are checked:

  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Updated documentation.
  • Added an entry to the CHANGELOG.md if the new code introduces user-observable changes.
  • The build (bundle exec rake) passes (be sure to run this locally, since it may produce updated documentation that you will need to commit).

If you have created a new cop:

  • Added the new cop to config/default.yml.
  • The cop is configured as Enabled: pending in config/default.yml.
  • The cop is configured as Enabled: true in .rubocop.yml.
  • The cop documents examples of good and bad code.
  • The tests assert both that bad code is reported and that good code is not reported.
  • Set VersionAdded: "<<next>>" in default/config.yml.

If you have modified an existing cop's configuration options:

  • Set VersionChanged: "<<next>>" in config/default.yml.

This code generates a syntax error as follows:
```ruby
❯ ruby -e '[1].each { put _1; [1].each { put _1 } }'
-e: -e:1: syntax error found (SyntaxError)
> 1 | ... _1 } }
    |     ^~ numbered parameter is already used in outer block
```

When numbered parameters are used in nested blocks, it is not possible to use numbered parameters in multiple different hierarchies.

While it was considered to split these up, we discussed below.
#2014 (comment)
Copy link
Member

@pirj pirj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! ❤️

@ydah ydah merged commit 162d91a into master Dec 26, 2024
27 checks passed
@ydah ydah deleted the rmv branch December 26, 2024 01:14
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 this pull request may close these issues.

2 participants