-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Fully separate positional arguments and keyword arguments #2794
Conversation
The test-bundler failures appear to be due to:
I think in order to fix this:
|
@jeremyevans Now the PR has been merged, and a new version including the changes has been released: https://rubygems.org/gems/mustermann/versions/1.1.0 |
Now the failure is due to sinatra. Sinatra needs a new release with the following commit: sinatra/sinatra@d423f56. Then bundler needs to be updated to use it, and the bundler changes merged into Ruby. |
This removes the warnings added in 2.7, and changes the behavior so that a final positional hash is not treated as keywords or vice-versa. To handle the arg_setup_block splat case correctly with keyword arguments, we need to check if we are taking a keyword hash. That case didn't have a test, but it affects real-world code, so add a test for it. This removes rb_empty_keyword_given_p() and related code, as that is not needed in Ruby 3. The empty keyword case is the same as the no keyword case in Ruby 3. This changes rb_scan_args to implement keyword argument separation for C functions when the : character is used. For backwards compatibility, it returns a duped hash. This is a bad idea for performance, but not duping the hash breaks at least Enumerator::ArithmeticSequence#inspect. Instead of having RB_PASS_CALLED_KEYWORDS be a number, simplify the code by just making it be rb_keyword_given_p().
Rails CI with Ruby master has broken by ruby/ruby#2794. https://buildkite.com/rails/rails/builds/66163#c6c0c423-bb9b-4c20-bab4-8a6aa56c726d/936-1205 To fix the CI failure, fixing kwargs deprecation warnings is required.
Rails CI with Ruby master has broken by ruby/ruby#2794. https://buildkite.com/rails/rails/builds/66163#c6c0c423-bb9b-4c20-bab4-8a6aa56c726d/936-1235 https://github.com/rails/rails/blob/5a010d8537afa957f1a6c7ec0d9f4d66ef5ae5e1/activestorage/test/test_helper.rb#L94 To fix the CI failure, fixing kwargs deprecation warnings is required.
Rails CI with Ruby master has broken by ruby/ruby#2794. https://buildkite.com/rails/rails/builds/66163#c6c0c423-bb9b-4c20-bab4-8a6aa56c726d/936-1235 https://github.com/rails/rails/blob/5a010d8537afa957f1a6c7ec0d9f4d66ef5ae5e1/activestorage/test/test_helper.rb#L94 To fix the CI failure, fixing kwargs deprecation warnings is required.
Rails CI with Ruby master has broken by ruby/ruby#2794. https://buildkite.com/rails/rails/builds/66163#c6c0c423-bb9b-4c20-bab4-8a6aa56c726d/936-1235 https://github.com/rails/rails/blob/5a010d8537afa957f1a6c7ec0d9f4d66ef5ae5e1/activestorage/test/test_helper.rb#L94 To fix the CI failure, fixing kwargs deprecation warnings is required.
* Fix Ruby 2.7 warnings Rails CI with Ruby master has broken by ruby/ruby#2794. https://buildkite.com/rails/rails/builds/66163#c6c0c423-bb9b-4c20-bab4-8a6aa56c726d/936-1235 https://github.com/rails/rails/blob/5a010d8537afa957f1a6c7ec0d9f4d66ef5ae5e1/activestorage/test/test_helper.rb#L94 To fix the CI failure, fixing kwargs deprecation warnings is required. * Drop Ruby 1.9 support to use double splat `**options`
## Summary This PR suppresses the following keyword arguments warning for Ruby 2.7.0. ```console % ruby -v ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin17] % DB=sqlite bundle exec appraisal activerecord_6.0.0 rake /Users/koic/src/github.com/CanCanCommunity/cancancan/lib/cancan/unauthorized_message_resolver.rb:9: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call /Users/koic/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/i18n-1.8.0/lib/i18n.rb:195: warning: The called method `translate' is defined here ``` For Ruby 2.8.0-dev (Ruby 3.0) the warning will be `ArgumentError`. ruby/ruby#2794 ## Other Infromation There are other similar warnings against Active Record, but Rails 6.0 stable branch is WIP. rails/rails#37935 It is not subject to changes in this repository.
## Summary This PR suppresses the following keyword arguments warning for Ruby 2.7.0. ```console % ruby -v ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin17] % DB=sqlite bundle exec appraisal activerecord_6.0.0 rake /Users/koic/src/github.com/CanCanCommunity/cancancan/lib/cancan/unauthorized_message_resolver.rb:9: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call /Users/koic/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/i18n-1.8.0/lib/i18n.rb:195: warning: The called method `translate' is defined here ``` For Ruby 2.8.0-dev (Ruby 3.0) the warning will be `ArgumentError`. ruby/ruby#2794 ## Other Infromation There are other similar warnings against Active Record, but Rails 6.0 stable branch is WIP. rails/rails#37935 It is not subject to changes in this repository.
This PR suppresses the following keyword arguments warning for Ruby 2.7.0. ```console % bundle exec rspec spec/hashie/extensions/mash/symbolize_keys_spec.rb (snip) /Users/koic/src/github.com/hahie/hashie/spec/hashie/extensions/mash/symbolize_keys_spec.rb:29: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call /Users/koic/src/github.com/hahie/hashie/spec/hashie/extensions/mash/symbolize_keys_spec.rb:21: warning: The called method `call' is defined here ``` For Ruby 2.8.0-dev (Ruby 3.0) the warning will be `ArgumentError`. ruby/ruby#2794
This PR suppresses the following keyword arguments warning for Ruby 2.7.0. ```console % bundle exec rspec spec/hashie/extensions/mash/symbolize_keys_spec.rb (snip) /Users/koic/src/github.com/hahie/hashie/spec/hashie/extensions/mash/symbolize_keys_spec.rb:29: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call /Users/koic/src/github.com/hahie/hashie/spec/hashie/extensions/mash/symbolize_keys_spec.rb:21: warning: The called method `call' is defined here ``` For Ruby 2.8.0-dev (Ruby 3.0) the warning will be `ArgumentError`. ruby/ruby#2794
This PR suppresses the following keyword arguments warning for Ruby 2.7.0. ```console % bundle exec rspec spec/hashie/extensions/mash/symbolize_keys_spec.rb (snip) /Users/koic/src/github.com/hahie/hashie/spec/hashie/extensions/mash/symbolize_keys_spec.rb:29: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call /Users/koic/src/github.com/hahie/hashie/spec/hashie/extensions/mash/symbolize_keys_spec.rb:21: warning: The called method `call' is defined here ``` For Ruby 2.8.0-dev (Ruby 3.0) the warning will be `ArgumentError`. ruby/ruby#2794
* Fix Ruby 2.7 warnings Rails CI with Ruby master has broken by ruby/ruby#2794. https://buildkite.com/rails/rails/builds/66163#c6c0c423-bb9b-4c20-bab4-8a6aa56c726d/936-1235 https://github.com/rails/rails/blob/5a010d8537afa957f1a6c7ec0d9f4d66ef5ae5e1/activestorage/test/test_helper.rb#L94 To fix the CI failure, fixing kwargs deprecation warnings is required. * Drop Ruby 1.9 support to use double splat `**options`
No description provided.