Infer attr_accessor writer signatures#2667
Merged
Merged
Conversation
ca25ff8 to
af71b55
Compare
vinistock
approved these changes
Jul 7, 2026
af71b55 to
3d448e9
Compare
paracycle
reviewed
Jul 7, 2026
3d448e9 to
4d4bae1
Compare
Contributor
Author
|
Handled the review comments:
|
4d4bae1 to
2b10f49
Compare
paracycle
approved these changes
Jul 8, 2026
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
This PR teaches gem RBI generation to infer signatures for writers generated by
attr_accessor.When code uses:
sorbet-runtimeattaches the pending signature to the generated reader (foo) only. The generated writer (foo=) has no runtime signature, so Tapioca previously emitted it as untyped:With this change, Tapioca infers the writer signature from the matching reader signature:
Details
The inference is intentionally conservative:
=attr_accessorcall and avoid separately-defined or manually-defined writer methods.