Project

General

Profile

Actions

Bug #16504

closed

`foo(*args, &args.pop)` should pass all elements of args

Added by mame (Yusuke Endoh) almost 5 years ago. Updated over 4 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux]
[ruby-core:96798]

Description

https://bugs.ruby-lang.org/issues/16500?next_issue_id=16499&prev_issue_id=16501#note-7

def foo(*args)
  p args
end

# 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)

Related issues 2 (0 open2 closed)

Related to Ruby master - Bug #16500: Argument is added to both splat and last &block argumentClosedioquatix (Samuel Williams)Actions
Related to Ruby master - Bug #12860: Splatting an argument does not obey left-to-right execution orderClosedActions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0