Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop generating new singleton methods for abstract classes #1524

Merged
merged 2 commits into from
Jun 1, 2023

Conversation

paracycle
Copy link
Member

Motivation

Fixes #1507

Implementation

When generating methods for a constant, we check to see if:

  1. the constant is a singleton class (does it have an attached class?)
  2. the method is named :new
  3. the constant is marked as :abstract or :interface
  4. the constant is a Class

If all these conditions are satisfied, then we skip the definition of the new method, since generating it messes with Sorbet's internal handling of how new method calls behave.

Tests

Added a new test and updated existing tests to reflect the behaviour change.

@paracycle paracycle requested a review from a team as a code owner May 31, 2023 20:59
@paracycle paracycle changed the title Uk fix abstract class new Stop generating new singleton methods for abstract classes May 31, 2023
@paracycle paracycle merged commit 3b629b2 into main Jun 1, 2023
@paracycle paracycle deleted the uk-fix-abstract-class-new branch June 1, 2023 17:43
@paracycle paracycle added the bug Something isn't working label Jun 12, 2023
@shopify-shipit shopify-shipit bot temporarily deployed to production June 23, 2023 18:32 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Omit declaring .new constructors for abstract classes in generated RBI files
3 participants