Skip to content

Do not forward the optional parameters before ... - #499

Merged
mame merged 2 commits into
ruby:masterfrom
mame:fix-forwarding-leading-optionals
Sep 28, 2026
Merged

mame merged 2 commits into
ruby:masterfrom
mame:fix-forwarding-leading-optionals

Conversation

@mame

@mame mame commented Sep 28, 2026

Copy link
Copy Markdown
Member

Found while reviewing #492.

... forwards only the arguments it receives, but TypeProf also forwarded the optional parameters before it:

def foo(a = 1, ...) = bar(...)
foo(:sym, "str")   # bar received :sym as well as "str"

This was left over from when a bare super shared this code; #492 gave super its own. This PR drops the optional parameters from the forwarded arguments. It also removes the post parameters, since no parameter can follow ....

mame and others added 2 commits September 28, 2026 21:40
`...` forwards only the arguments it takes, but it also forwarded the
optional parameters before it, a leftover from when a bare `super`
shared this code (ruby#492 gave it its own). So in

    def foo(a = 1, ...) = bar(...)
    foo(:sym, "str")

bar received :sym as well as "str". A parameter cannot follow `...`, so
the loop over the post parameters goes away with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mame
mame enabled auto-merge (rebase) September 28, 2026 13:27
@mame
mame merged commit e40572f into ruby:master Sep 28, 2026
6 checks passed
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.

1 participant