Skip to content

Fix Enumerable#each_cons and each_slice to return a receiver - #1509

Merged
nobu merged 6 commits into
ruby:masterfrom
makenowjust:fix/enum/each-cons-slice-return-self
Oct 25, 2021
Merged

nobu merged 6 commits into
ruby:masterfrom
makenowjust:fix/enum/each-cons-slice-return-self

Conversation

@makenowjust

Copy link
Copy Markdown
Contributor

Why not?

I think Enumerable#each_cons and Enumerable#each_slice are extensions of each method, so to return a receiver looks a natural behavior.

Comment thread test/ruby/test_enum.rb Outdated
@makenowjust

makenowjust commented Jan 5, 2017 •

Copy link
Copy Markdown
Contributor Author

What should I make CI successful for?

@nobu

nobu commented Jan 5, 2017

Copy link
Copy Markdown
Member

Make a branch with version guards and send a pull request to https://github.com/ruby/spec.
Then check out that branch before make update-rubyspec at the end of before_script section in .travis.yml file.

@k0kubun
k0kubun changed the base branch from trunk to master August 15, 2019 17:38
@junaruga

Copy link
Copy Markdown
Member

Then check out that branch before make update-rubyspec at the end of before_script section in .travis.yml file.

Note that the Travis was revived by 9d4266f , only managing non-x86 cases.

Comment thread enum.c

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
* h = {foo: 0, bar: 1, baz: 2, bam: 3}
* h = {foo: 0, bar: 1, baz: 2, bam: 3}

@knu knu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm the original author of these methods and this is fine with me.

@nobu
nobu merged commit dfb47bb into ruby:master Oct 25, 2021
@makenowjust
makenowjust deleted the fix/enum/each-cons-slice-return-self branch October 25, 2021 05:53
koic added a commit to koic/rubocop that referenced this pull request Oct 26, 2021
This PR fixes the following build error.

```console
% bundle exec rspec ./spec/rubocop/cop/layout/block_alignment_spec.rb:222
(snip)

      # ./lib/rubocop/cop/layout/block_alignment.rb:97:in `start_for_block_node'
      # ./lib/rubocop/cop/layout/block_alignment.rb:82:in `on_block'
      # ./lib/rubocop/cop/commissioner.rb:100:in `public_send'
      # ./lib/rubocop/cop/commissioner.rb:100:in `block (2 levels) in trigger_responding_cops'
      # ./lib/rubocop/cop/commissioner.rb:160:in `with_cop_error_handling'
      # ./lib/rubocop/cop/commissioner.rb:99:in `block in trigger_responding_cops'
```

https://app.circleci.com/pipelines/github/rubocop/rubocop/5414/workflows/4a7e4b81-7380-41e5-8ede-e28d9160010d/jobs/201236

I reported on this change of behavior.
https://bugs.ruby-lang.org/issues/18268

And it was due to the following change.
ruby/ruby#1509

This PR will be changed to the cop logic that is not affected by the above Ruby 3.1.0-dev change.
soutaro added a commit to ruby/rbs that referenced this pull request Feb 1, 2022
soutaro added a commit to ruby/rbs that referenced this pull request Feb 1, 2022
jcmfernandes added a commit to jcmfernandes/truffleruby that referenced this pull request Jan 13, 2023
jcmfernandes added a commit to jcmfernandes/truffleruby that referenced this pull request Jan 13, 2023
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.

6 participants