8000 Fix `hidden-methods` failure in Ruby 2.7 by paracycle · Pull Request #3422 · sorbet/sorbet · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000

Fix hidden-methods failure in Ruby 2.7 #3422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 15, 2020

Conversation

paracycle
Copy link
Collaborator

Motivation

Resolve: #2771

Due to the way argument forwarding is implemented in Ruby 2.7, at runtime Sorbet will see parameter names for the expanded method parameters that are invalid. This causes a failure in the hidden methods generation process since the output ends up being an invalid RBI file.

The fix is to sanitize the parameter names to be valid unique names so that we still capture the runtime method signature but also have valid parameter names as well.

Test plan

No automated tests included since there is no framework to test sorbet gem under 2.7. However, there are user reports of the fix working successfully in their codebase with this patch

@paracycle paracycle requested a review from a team as a code owner September 14, 2020 22:19
@paracycle paracycle requested review from jez and removed request for a team September 14, 2020 22:19
Resolves sorbet#2771

Due to the way argument forwarding is implemented in Ruby 2.7, at
runtime Sorbet will see parameter names for the expanded method
parameters that are invalid. This causes a failure in the hidden methods
generation process since the output ends up being an invalid RBI file.

The fix is to sanitize the parameter names to be valid unique names so
that we still capture the runtime method signature but also have valid
parameter names as well.
@paracycle paracycle force-pushed the uk-correct-param-names-in-ruby27 branch from 50a583a to ff04946 Compare September 15, 2020 18:55
@jez jez merged commit 161f06e into sorbet:master Sep 15, 2020
@paracycle paracycle deleted the uk-correct-param-names-in-ruby27 branch September 15, 2020 20:43
elliottt pushed a commit that referenced this pull request Sep 23, 2020
Resolves #2771

Due to the way argument forwarding is implemented in Ruby 2.7, at
runtime Sorbet will see parameter names for the expanded method
parameters that are invalid. This causes a failure in the hidden methods
generation process since the output ends up being an invalid RBI file.

The fix is to sanitize the parameter names to be valid unique names so
that we still capture the runtime method signature but also have valid
parameter names as well.
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.

srb init fails on Ruby 2.7 because of argument delegation
2 participants
0