Add overloads_strategy option to RBSCommentsToSorbetSigs#921
Open
Morriar wants to merge 3 commits into
Open
Conversation
000878e to
067d8cf
Compare
paracycle
reviewed
May 14, 2026
amomchilov
reviewed
May 14, 2026
18253d1 to
6c9e591
Compare
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
6c9e591 to
5189326
Compare
When a method has multiple `#:` annotations (RBS overloads), the translator emits multiple consecutive `sig` blocks which sorbet-runtime rejects at load time with "You called sig twice without declaring a method in between". Add an `overloads_strategy` keyword parameter that accepts `:translate_all` (default, current behavior), `:translate_last` (keep only the last signature), or `:raise` (raise Translate::Error). Fixes #913
5189326 to
e797b5e
Compare
paracycle
approved these changes
May 21, 2026
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
e797b5e to
9b456b1
Compare
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.
Summary
When a method has multiple
#:annotations (RBS overloads),RBSCommentsToSorbetSigsemits multiple consecutivesigblocks.sorbet-runtimerejects this at load time with:This breaks
tapioca gemfor any gem using overloaded RBS annotations (e.g. the commoneachwith-block/without-block pattern).This PR adds an
overloads_strategykeyword parameter torbs_comments_to_sorbet_sigsthat accepts one of three symbols::translate_all(default) -- current behavior, translates all overloads into separatesigblocks. No breaking change.:translate_last-- keeps only the last signature (closest to the method def, matching Sorbet's "last sig wins" semantics) and removes the others.:raise-- raisesTranslate::Error, allowing callers like tapioca to rescue and fall back to the original source.Fixes #913