Repository navigation
Handle top level type aliases in Prism RBS rewriter - #10231
Merged
Merged
Conversation
dejmedus
force-pushed
the
handle-type-alias-prism
branch
from
May 7, 2026 15:53
e2f8261 to
16a6588
Compare
dejmedus
marked this pull request as ready for review
May 7, 2026 18:51
jez
requested changes
May 28, 2026
Previously, RBS type alias comments (`#: type foo = Integer`) outside of a class or module were ignored since the program node wasn't a context that allowed type aliases This commit matches the pattern used by class and module nodes to allow type aliases to be associated with standalone placeholders. Since a program node's location range ends after the last statement (or at 0 if the program contains only comments), we scan to the end of the program to catch trailing comments This has only been implemented in the Prism RBS rewriter
dejmedus
force-pushed
the
handle-type-alias-prism
branch
from
July 2, 2026 19:44
16a6588 to
00bb1cd
Compare
Closed
jez
approved these changes
Jul 31, 2026
jez
left a comment
Collaborator
There was a problem hiding this comment.
Apologies for the delayed review.
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
T.type_aliasis allowed at top level, so the RBS rewriter can similary support type alias commentsThis PR matches the pattern used by class and module nodes to allow type aliases to be associated with standalone placeholders. Since a program node's location range ends after the last statement (or at 0 if the program contains only comments), we scan to the end of the program to catch any trailing comments
Test plan
Added a new test fixture:
signatures_type_aliases_empty_fileand added top level examples tosignatures_type_aliases