Issue #16500 has been updated by mame (Yusuke Endoh).


Ruby 2.7 partially changed the behavior.  Coped from my comment: https://github.com/ruby-grape/grape/issues/1967#issuecomment-573366122

```ruby
# in 2.6 or before
args = [1, 2, -> {}]; foo(   *args, &args.pop) #=> passes [1, 2] (bug; [1, 2, ->{}] is expected)
args = [1, 2, -> {}]; foo(0, *args, &args.pop) #=> passes [0, 1, 2] (bug; [0, 1, 2, ->{}] is expected)

# in 2.7
args = [1, 2, -> {}]; foo(   *args, &args.pop) #=> passes [1, 2] (bug; [1, 2, ->{}] is expected)
args = [1, 2, -> {}]; foo(0, *args, &args.pop) #=> passes [0, 1, 2, ->{}] (good)
```

So, there are two issues.

* The issue that this ticket says is caused by a behavior change of 2.7, and ruby-grape's change will fix the issue https://github.com/ruby-grape/grape/commit/dec3e1ff5dbf3215a714565e62b12bd2ef6b0ddb
* The behavior of `args = [1, 2, -> {}]; foo(   *args, &args.pop)` should pass `[1, 2, ->{}]`, and we should fix the bug on the ruby interpreter.

----------------------------------------
Bug #16500: Argument added both to splat and last &block argument
https://bugs.ruby-lang.org/issues/16500#change-83790

* Author: anatolik (Anatol Pomozov)
* Status: Open
* Priority: Normal
* Assignee: ioquatix (Samuel Williams)
* Target version: 
* ruby -v: 2.7.0
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
Here is a followup for a ruby2.7 issue discussed here https://gitlab.com/groups/gitlab-org/-/epics/2380

I run gitlab with ruby2.7. Things work mostly fine except one weird issue. gitlab/lib/api/api_guard.rb calls Rack's `use` method:


```ruby
  use Rack::OAuth2::Server::Resource::Bearer, 'The API' do |request|
    # The authenticator only fetches the raw token string

    # Must yield access token to store it in the env
    request.access_token
  end

```

The `use` method looks like
```ruby
    def use(middleware, *args, &block)
      if @map
        mapping, @map = @map, nil
        @use << proc { |app| generate_map app, mapping }
      end
      @use << proc { |app| middleware.new(app, *args, &block) }
    end
```

For some reason `Proc` method set to `&block` *and* added to `args`. It sounds wrong. `Proc` should be set to `&block` only and `args` should contain only 1 argument.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>