Skip to content

Index RBS attribute methods - #970

Open
soutaro wants to merge 3 commits into
mainfrom
codex/rbs-attribute-method-definitions
Open

Index RBS attribute methods#970
soutaro wants to merge 3 commits into
mainfrom
codex/rbs-attribute-method-definitions

Conversation

@soutaro

@soutaro soutaro commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Index RBS attr_reader, attr_writer, and attr_accessor members.

RBS attributes are represented as MethodDefinitions because the existing attribute-definition variants cannot represent singleton attributes such as attr_reader self.foo: String.

This includes instance and singleton attributes, visibility, comments, and deprecated annotations. Writers are indexed with one required positional parameter.

@soutaro
soutaro requested a review from a team as a code owner July 31, 2026 04:10

@vinistock vinistock left a comment

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.

Just a few things, but it looks good. I can't believe we forgot attributes on RBS!

Signatures::Simple(Box::new([]))
};

let definition = Definition::Method(Box::new(MethodDefinition::new(

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.

We have specific definitions for AttrWriter, AttrReader and AttrAccessor. Also, attributes don't carry a name offset and regular offset, since there's no distinction.

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.

The Attr* definitions do not support singleton attribute syntax in RBS, such as attr_reader self.name: String. I can extend them if it's better, but I don't think it would be worthwhile.

Comment thread rust/rubydex/src/indexing/rbs_indexer.rs Outdated
Comment thread rust/rubydex/src/indexing/rbs_indexer.rs Outdated
@vinistock vinistock added the enhancement New feature or request label Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants