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

Do not rely on return type for attr_writer RBS signatures #368

Merged
merged 1 commit into from
Oct 3, 2024

Conversation

Morriar
Copy link
Collaborator

@Morriar Morriar commented Oct 3, 2024

The current RBS translation mechanism for attr_writers relies on the return type of its signature. However, the return type can't always be trusted as both these syntax are valid for Sorbet:

sig { params(x: Integer).returns(Integer) }
attr_writer :x

sig { params(y: Integer).void }
attr_writer :y

Instead, we should rely on the first parameter which we can be sure to find since Sorbet requires it.

@Morriar Morriar added the bugfix Fix a bug label Oct 3, 2024
@Morriar Morriar self-assigned this Oct 3, 2024
@Morriar Morriar requested a review from a team as a code owner October 3, 2024 18:48
Copy link
Contributor

@amomchilov amomchilov left a comment

Choose a reason for hiding this comment

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

Subtle, good catch

Copy link
Member

@paracycle paracycle left a comment

Choose a reason for hiding this comment

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

Makes sense!

@Morriar Morriar merged commit 80784c2 into main Oct 3, 2024
8 checks passed
@Morriar Morriar deleted the at-rbs-attr branch October 3, 2024 18:52
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