Skip to content

Clear last_sigs when returning early on abstract#755

Merged
Morriar merged 2 commits into
mainfrom
at-fix-abstract
Jun 9, 2025
Merged

Clear last_sigs when returning early on abstract#755
Morriar merged 2 commits into
mainfrom
at-fix-abstract

Conversation

@Morriar

@Morriar Morriar commented Jun 9, 2025

Copy link
Copy Markdown
Contributor

Before this fix, when encountering a signature with abstract we were not clearing the list, meaning that subsequent signatures were not translated:

sig { abstract.void }
def foo; end

sig { void } # list still contains the abstract one and will return early
def bar; end

After this change, the second signature is properly translated:

sig { abstract.void }
def foo; end

#: -> void
def bar; end

@Morriar Morriar requested a review from a team as a code owner June 9, 2025 19:29
@Morriar Morriar self-assigned this Jun 9, 2025
@Morriar Morriar added the bugfix Fix a bug label Jun 9, 2025

@jesse-shopify jesse-shopify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I like the change from instance variable to local variable for this. This is easier to reason about.

Comment thread lib/spoom/sorbet/translate/sorbet_sigs_to_rbs_comments.rb
Morriar added 2 commits June 9, 2025 15:53
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
@Morriar Morriar force-pushed the at-fix-abstract branch from 7e2da32 to a04c7d4 Compare June 9, 2025 19:54
@Morriar Morriar merged commit 0c1edb8 into main Jun 9, 2025
8 checks passed
@Morriar Morriar deleted the at-fix-abstract branch June 9, 2025 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Fix a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants