Use rest_type/keyrest_type for a Sorbet signature#2603
Merged
Conversation
vinistock
approved these changes
Apr 22, 2026
|
|
||
| # rest parameter type | ||
| params << signature.rest_type.to_s if signature.has_rest | ||
| params << signature.rest_type.to_s if signature.rest_type |
Member
There was a problem hiding this comment.
Nit
Suggested change
| params << signature.rest_type.to_s if signature.rest_type | |
| rest_type = signature.rest_type | |
| params << rest_type.to_s if rest_type |
Contributor
Author
There was a problem hiding this comment.
Ah yes, we don't need two invocations. Thanks.
|
|
||
| # keyrest parameter type | ||
| params << signature.keyrest_type.to_s if signature.has_keyrest | ||
| params << signature.keyrest_type.to_s if signature.keyrest_type |
Member
There was a problem hiding this comment.
Nit
Suggested change
| params << signature.keyrest_type.to_s if signature.keyrest_type | |
| keyrest_type = signature.keyrest_type | |
| params << keyrest_type.to_s if keyrest_type |
33d9554 to
e478662
Compare
alexcrocha
approved these changes
Apr 22, 2026
…t`/`has_keyrest` `sorbet-runtime` 0.6.13149 (sorbet/sorbet#10177) removed `@has_rest` and `@has_keyrest` from `T::Private::Methods::Signature`, since they were redundant with the `@rest_type`/`@keyrest_type` ivars (nil when absent). Tapioca still referenced the removed accessors in two places, crashing with `NoMethodError: undefined method 'has_rest' for T::Private::Methods::Signature` during `tapioca gem` on any gem with runtime `sig {}` blocks on `*args`/`**kwargs` methods. Replace the boolean checks with truthiness on the `_type` accessors; same semantics, works on both pre- and post-0.6.13149 runtimes since `rest_type` and `keyrest_type` are unchanged.
e478662 to
ce2b0b4
Compare
3 tasks
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.
Motivation
sorbet-runtime0.6.13149 (sorbet/sorbet#10177) removed@has_restand@has_keyrestfromT::Private::Methods::Signature, since they were redundant with the@rest_type/@keyrest_typeivars (nil when absent).Implementation
Update to pre-existing variables
rest_type/keyrest_type, no Sorbet version bump is necessary.Tests
Already tested