Introduce ForwardingParam for argument forwarding - #625
Open
Morriar wants to merge 1 commit into
Open
Conversation
amomchilov
reviewed
Jul 10, 2026
| return false unless other.is_a?(Method) | ||
| return false unless name == other.name | ||
| return false unless params.size == other.params.size | ||
| if (params_have_forwarding?(params) || params_have_forwarding?(other.params)) && params != other.params |
Contributor
There was a problem hiding this comment.
Why params != other.params?
Morriar
force-pushed
the
at-fix-anonymous-params
branch
3 times, most recently
from
July 17, 2026 14:42
be2225d to
290fc6f
Compare
Ruby argument forwarding (...) is a distinct parameter form, and expanding it to *args, **kwargs, &block loses source fidelity. Model it explicitly so RBI parsing and printing round-trip forwarding methods. Add RBI::ForwardingParam and wire it through parser, visitors, printers, and RBS output. Skip add-sig templates for forwarding methods because Sorbet doesn't support signatures on argument forwarding. Treat forwarding params as merge-compatible only with the same forwarding shape. Closes #562. Closes #578. Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Morriar
force-pushed
the
at/forwarding-param-model
branch
from
July 17, 2026 15:18
0760636 to
49d3bc5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on #624.
Ruby argument forwarding (
...) is a distinct parameter form; expanding it to*args, **kwargs, &blockloses source fidelity and makes round-tripping impossible.This PR:
RBI::ForwardingParamand wires it through parsing, visitors, RBI/RBS printing, and generated RBI signatures.AddSigTemplatesfor methods containing..., since Sorbet does not support signatures on argument-forwarding methods.foo(...)is compatible withfoo(...), but incompatible with expanded*args, **kwargs, &blockshapes.Closes #562.
Closes #578.