Skip to content

Add rewriter option to erase generics#946

Draft
dejmedus wants to merge 2 commits into
mainfrom
jb-erase-generic-types
Draft

Add rewriter option to erase generics#946
dejmedus wants to merge 2 commits into
mainfrom
jb-erase-generic-types

Conversation

@dejmedus

@dejmedus dejmedus commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

WIP, implementation will change and RBI changes need to go in first

dejmedus added 2 commits June 9, 2026 18:26
Sorbet erases generic types at runtime as they cannot
be enforced. This means in runtime contexts
we can drop generic types entirely, simplifying
the rbs to sorbet signature translation

This commit adds an `erase_generic_types` option to
the `RBSCommentsToSorbetSigs` rewriter. When set,
generic args are dropped from translated sigs
(`Box[Integer]` to `Box`) and `extend T::Generic`
is not added
Expose a flag to set the `erase_generic_types` option
in `Spoom::Sorbet::Translate.rbs_comments_to_sorbet_sigs`
so CLI users can drop generic types when translating from
RBS to RBI
@dejmedus dejmedus force-pushed the jb-erase-generic-types branch from 04e9229 to 507f839 Compare June 10, 2026 00:38
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.

1 participant