Preserve anonymous parameters in generated RBIs - #2687
Open
Morriar wants to merge 4 commits into
Open
Conversation
amomchilov
reviewed
Jul 28, 2026
Comment on lines
+131
to
+134
| anonymous_parameter = anonymous_parameter_name?(type, name) | ||
| name = fallback_arg_name unless anonymous_parameter || valid_parameter_name?(name) | ||
|
|
||
| [type, name] | ||
| [type, name, anonymous_parameter] |
Contributor
There was a problem hiding this comment.
Suggested change
| anonymous_parameter = anonymous_parameter_name?(type, name) | |
| name = fallback_arg_name unless anonymous_parameter || valid_parameter_name?(name) | |
| [type, name] | |
| [type, name, anonymous_parameter] | |
| is_anonymous_parameter = anonymous_parameter_name?(type, name) | |
| name = fallback_arg_name unless is_anonymous_parameter || valid_parameter_name?(name) | |
| [type, name, is_anonymous_parameter] |
| ) | ||
|
|
||
| sanitized_parameters.each do |type, name| | ||
| sanitized_parameters.each do |type, name, anonymous_parameter| |
Contributor
There was a problem hiding this comment.
Suggested change
| sanitized_parameters.each do |type, name, anonymous_parameter| | |
| sanitized_parameters.each do |type, name, is_anonymous_parameter| |
Contributor
There was a problem hiding this comment.
Do we need to thread the 3rd parameter through like this?
Could we instead modify the definition of name above, where anonymous_parameter is first set?
Contributor
Author
There was a problem hiding this comment.
We need to pass something because the method param needs to be generated with a nil name but the signature param lookup needs the "*" name.
I change the tuple to use both names instead of passing the anonymous flag 👍
Keep anonymous splat, keyword splat, and block parameter names for signature lookup while rendering them as anonymous RBI parameters.
Morriar
force-pushed
the
at/preserve-anonymous-parameters
branch
from
July 28, 2026 21:36
3a3dbeb to
095ee15
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.
Ruby reflects anonymous splat, keyword splat, and block parameters using pseudo-names:
Tapioca was treating those names as invalid parameter names and replacing them with fallback names like
_arg0,_arg1, and_arg2. That caused two issues:"*","**", and"&".For example, this could generate invalid RBI like:
This change preserves anonymous parameter names for signature lookup, while rendering them as anonymous RBI parameters:
It also bumps the minimum
rbidependency to0.4.1, since older versions don’t support anonymousRestParam,KwRestParam, andBlockParamnodes represented withnilnames.