Issue #21807 has been updated by nagachika (Tomoyuki Chikanaga). Backport changed from 3.2: DONTNEED, 3.3: DONTNEED, 3.4: REQUIRED, 4.0: DONTNEED to 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONE, 4.0: DONTNEED ruby_3_4 commit:55920677854fe757c36368785f6dfdbce0b49ab7 merged revision(s) commit:86320a53002a3adaf35ad7434c70e86747a8b345. ---------------------------------------- Bug #21807: ArgumentError is reported when forwarding arguments to method with intermediate optional arguments https://bugs.ruby-lang.org/issues/21807#change-116205 * Author: taichi730 (Taichi Ishitani) * Status: Closed * ruby -v: 3.4.8 (2025-12-17 revision 995b59f666) +PRISM [x86_64-linux] * Backport: 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONE, 4.0: DONTNEED ---------------------------------------- In Ruby 3.4.x, `ArgumentError` is reported when forwarding arguments to a method with intermediate optional arguments. How to reproduce: Execute sample below. ``` ruby class Foo def foo(a = nil, b) p a, b end end class Bar def initialize @foo = Foo.new end def bar(...) @foo.foo(...) @foo.foo(...) end end class Baz def initialize @bar = Bar.new end def baz(_a, ...) @bar.bar(...) end end puts RUBY_VERSION baz = Baz.new baz.baz(0, 1) ``` output: ```console $ RBENV_VERSION=3.4.8 ruby test.rb 3.4.8 nil 1 test.rb:2:in 'foo': wrong number of arguments (given 0, expected 1..2) (ArgumentError) from test.rb:14:in 'Bar#bar' from test.rb:24:in 'Baz#baz' ``` ```console $ RBENV_VERSION=3.4.1 ruby test.rb 3.4.1 nil 1 test.rb:2:in 'foo': wrong number of arguments (given 0, expected 1..2) (ArgumentError) from test.rb:14:in 'Bar#bar' from test.rb:24:in 'Baz#baz' ``` For other Ruby verions (e.g. 4.0.0, 3.3.0), no error is reported. ```console $ RBENV_VERSION=4.0.0 ruby test.rb 4.0.0 nil 1 nil 1 ``` ```console $ RBENV_VERSION=3.3.0 ruby test.rb 3.3.0 nil 1 nil 1 ``` -- https://bugs.ruby-lang.org/