Skip to content

Use forwarding super when translating abstract sigs to RBS - #1028

Merged
alexcrocha merged 2 commits into
mainfrom
ar-translate-abstract-sigs-super
Oct 22, 2026
Merged

alexcrocha merged 2 commits into
mainfrom
ar-translate-abstract-sigs-super

Conversation

@alexcrocha

@alexcrocha alexcrocha commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Use forwarding super bodies when translating abstract Sorbet signatures to RBS comments, matching sorbet/sorbet#10707.

Motivation

Ruby can find a module's abstract method before an implementation inherited from a parent class. The previous generated raise NotImplementedError body prevents that implementation from being reached. A bare super forwards arguments and blocks to the inherited implementation instead. Calling a method with no implementation raises NoMethodError.

Changes

  • Generate super instead of raise NotImplementedError for translated abstract methods.
  • Preserve parameters and trailing header comments. Keep setters and methods with unparenthesized parameters multiline.
  • Preserve the opt-out behavior when abstract-method translation is disabled.
  • Update the development lockfile to Sorbet 0.6.13580; keep the published dependency floor unchanged.
  • Migrate Spoom's 12 existing RBS abstract-method bodies to forwarding super so its own source passes the upgraded checker.

Typechecking generated abstract-method bodies requires Sorbet 0.6.13580 or newer.

@alexcrocha
alexcrocha force-pushed the ar-translate-abstract-sigs-super branch from 8a6bf93 to b0984db Compare October 20, 2026 21:51
@alexcrocha
alexcrocha force-pushed the ar-translate-abstract-sigs-super branch from b0984db to 2055450 Compare October 20, 2026 21:57
@alexcrocha
alexcrocha marked this pull request as ready for review October 20, 2026 21:58
@alexcrocha
alexcrocha requested a review from a team as a code owner October 20, 2026 21:58
Comment thread README.md
Comment on lines +259 to +264
Include abstract methods:

```sh
spoom srb sigs translate --translate-abstract-methods
```

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.

Out of curiosity: Why is this not default now?

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.

I'm keeping it optional to maintain compatibility with older Sorbet versions. Let me know if I am being too conservative and this is not an issue, happy to make it the default in a follow-up

@alexcrocha
alexcrocha merged commit 0e9c73e into main Oct 22, 2026
11 checks passed
@alexcrocha
alexcrocha deleted the ar-translate-abstract-sigs-super branch October 22, 2026 00:11
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.

2 participants