Skip to content

Create parameter type list based on position instead of name - #2714

Closed
vinistock wants to merge 1 commit into
mainfrom
vs_fix_anonymous_block_and_keyword_rest
Closed

vinistock wants to merge 1 commit into
mainfrom
vs_fix_anonymous_block_and_keyword_rest

Conversation

@vinistock

@vinistock vinistock commented Sep 10, 2026

Copy link
Copy Markdown
Member

Motivation

I was testing out the latest Tapioca main and noticed that we are producing invalid syntax in RBIs for anonymous keyword rest or block parameters (see tests).

We are currently outputting this:

# Note the missing type after the parameter name, which is a syntax error
sig { arg_1: }.void
def foo(**); end

Implementation

The essence of the issue is that we create a hash of parameter types, which we lookup based on names. This only works if the parameter actually has a name.

The idea of the implementation is to rely on the fact that Sorbet errors if parameters are out of order and process them based on their position instead. This allows us to at least produce syntactically valid RBIs under the scenarios.

Tests

Added tests.

@vinistock vinistock self-assigned this Sep 10, 2026
@vinistock
vinistock requested a review from a team as a code owner September 10, 2026 14:54
@vinistock
vinistock force-pushed the vs_fix_anonymous_block_and_keyword_rest branch from 71542cd to 55ba472 Compare September 10, 2026 18:15
@vinistock

Copy link
Copy Markdown
Member Author

Actually, we should push #2687 forward instead.

@vinistock vinistock closed this Sep 14, 2026
@vinistock
vinistock deleted the vs_fix_anonymous_block_and_keyword_rest branch September 14, 2026 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants