Skip to content

Use rest_type/keyrest_type for a Sorbet signature#2603

Merged
KaanOzkan merged 1 commit intomainfrom
ko-fix-has-rest-removal
Apr 22, 2026
Merged

Use rest_type/keyrest_type for a Sorbet signature#2603
KaanOzkan merged 1 commit intomainfrom
ko-fix-has-rest-removal

Conversation

@KaanOzkan
Copy link
Copy Markdown
Contributor

@KaanOzkan KaanOzkan commented Apr 21, 2026

Motivation

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).

Implementation

Update to pre-existing variables rest_type/keyrest_type, no Sorbet version bump is necessary.

Tests

Already tested

Comment thread lib/tapioca/dsl/compiler.rb Outdated

# rest parameter type
params << signature.rest_type.to_s if signature.has_rest
params << signature.rest_type.to_s if signature.rest_type
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, we don't need two invocations. Thanks.

Comment thread lib/tapioca/dsl/compiler.rb Outdated

# keyrest parameter type
params << signature.keyrest_type.to_s if signature.has_keyrest
params << signature.keyrest_type.to_s if signature.keyrest_type
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@KaanOzkan KaanOzkan force-pushed the ko-fix-has-rest-removal branch from 33d9554 to e478662 Compare April 22, 2026 15:55
…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.
@KaanOzkan KaanOzkan force-pushed the ko-fix-has-rest-removal branch from e478662 to ce2b0b4 Compare April 22, 2026 17:43
@KaanOzkan KaanOzkan merged commit c709bb2 into main Apr 22, 2026
19 checks passed
@KaanOzkan KaanOzkan deleted the ko-fix-has-rest-removal branch April 22, 2026 18:12
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.

3 participants