Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Enumerable#uniq with non single yield arguments #1658

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

Closed
wants to merge 1 commit into from

Conversation

kachick
Copy link
Member

@kachick kachick commented Jun 20, 2017

ticket: https://bugs.ruby-lang.org/issues/13669

ruby -v: ruby 2.5.0dev (2017-06-20 trunk 59122) [x86_64-darwin16]
enum = Object.new.to_enum
class << enum
  def each
    yield
    yield nil
    yield 0
    yield 1
    yield 0, :LABEL
    yield [0, :LABEL]
    yield 1, :LABEL
    yield 1, :LABEL
    yield 1, :DIFFERENT
  end
end

p enum.uniq

Before

[nil, 0, 1, [0, :LABEL]]

Is this intentional?

After this PR

[nil, 0, 1, [0, :LABEL], [1, :LABEL], [1, :DIFFERENT]]

@kachick
Copy link
Member Author

kachick commented Jun 21, 2017

Thank you!

@kachick kachick deleted the enum-uniq-arg branch June 21, 2017 04:56
matzbot pushed a commit that referenced this pull request Aug 5, 2017
	Fix Enumerable#uniq with non single yield arguments

	* enum.c (uniq_func, uniq_iter): need packed value as the unique
	  key.  [ruby-core:81734] [Bug #13669] [Fix GH-1658]

	Author:    Kenichi Kamiya <[email protected]>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@59515 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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.

1 participant