Skip to content

Unflag a splatted flagged hash if the method doesn't use ruby2_keywords + use latest rspec-mocks#5684

Merged
eregon merged 3 commits into
ruby:masterfrom
eregon:unflag-splatted-flagged-hash-18625-with-rspec-mocks-pr
Apr 5, 2022
Merged

Unflag a splatted flagged hash if the method doesn't use ruby2_keywords + use latest rspec-mocks#5684
eregon merged 3 commits into
ruby:masterfrom
eregon:unflag-splatted-flagged-hash-18625-with-rspec-mocks-pr

Conversation

@eregon

@eregon eregon commented Mar 21, 2022

Copy link
Copy Markdown
Member

@eregon eregon force-pushed the unflag-splatted-flagged-hash-18625-with-rspec-mocks-pr branch from 28335c4 to 3c75d30 Compare March 30, 2022 10:57
@eregon eregon force-pushed the unflag-splatted-flagged-hash-18625-with-rspec-mocks-pr branch 4 times, most recently from 29bf545 to 5f8cd69 Compare March 30, 2022 14:21
@eregon eregon force-pushed the unflag-splatted-flagged-hash-18625-with-rspec-mocks-pr branch from 5f8cd69 to 9cd764d Compare April 1, 2022 11:03
@eregon

eregon commented Apr 1, 2022

Copy link
Copy Markdown
Member Author

@jeremyevans There is a rspec-mocks release with the fix now (3.11.1), so I updated to that and hopefully the Bundler tests should pass now.

@eregon eregon changed the title #5645 + fix in RSpec mocks Unflag a splatted flagged hash if the method doesn't use ruby2_keywords + use latest rspec-mocks Apr 4, 2022
jeremyevans and others added 3 commits April 5, 2022 11:41
For a method such as:

  def foo(*callee_args) end

If this method is called with a flagged hash (created by a method
flagged with ruby2_keywords), this previously passed the hash
through without modification.  With this change, it acts as if the
last hash was passed as keywords, so a call to:

  foo(*caller_args)

where the last element of caller_args is a flagged hash, will be
treated as:

  foo(*caller_args[0...-1], **caller_args[-1])

As a result, inside foo, callee_args[-1] is an unflagged duplicate
of caller_args[-1] (all other elements of callee_args match
caller_args).

Fixes [Bug #18625]
@eregon eregon force-pushed the unflag-splatted-flagged-hash-18625-with-rspec-mocks-pr branch from 38d21fc to 3d0aac9 Compare April 5, 2022 09:41
@eregon eregon merged commit d3f659d into ruby:master Apr 5, 2022
ivoanjo added a commit to DataDog/dd-trace-rb that referenced this pull request Apr 12, 2022
A maximum version was initially added in
#1495 because we expected
the `ruby2_keywords` method to be removed (see the PR for the
discussion).

Now Ruby 3.2.0-preview1 is out and `ruby2_keywords` are still there,
and there's even a recent change for it in
ruby/ruby#5684 that is documented as
"ruby2_keywords needed in 3.2+".

So for now let's bump the maximum version to < 3.3 to allow the
Ruby 3.2 series to be supported and we can keep an eye on the Ruby 3.2
test releases to see if anything changes.

(Otherwise, once Ruby 3.2.0 stable is out, we should probably bump
this to 3.4, and so on...)
ivoanjo added a commit to DataDog/dd-trace-rb that referenced this pull request May 4, 2022
A maximum version was initially added in
#1495 because we expected
the `ruby2_keywords` method to be removed (see the PR for the
discussion).

Now Ruby 3.2.0-preview1 is out and `ruby2_keywords` are still there,
and there's even a recent change for it in
ruby/ruby#5684 that is documented as
"ruby2_keywords needed in 3.2+".

So for now let's bump the maximum version to < 3.3 to allow the
Ruby 3.2 series to be supported and we can keep an eye on the Ruby 3.2
test releases to see if anything changes.

(Otherwise, once Ruby 3.2.0 stable is out, we should probably bump
this to 3.4, and so on...)
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