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

Support singleton attr by prototype rb #505

Merged
merged 1 commit into from Dec 6, 2020

Conversation

pocke
Copy link
Member

@pocke pocke commented Dec 6, 2020

This pull request adds to support singleton attr, which was introduced by #502, to rbs prototype rb command.

@@ -15,6 +15,14 @@ def method_kind
:instance
end
end

def attribute_kind
Copy link
Member Author

Choose a reason for hiding this comment

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

rbs/lib/rbs/parser.y

Lines 205 to 207 in 8871f6d

attribute_kind:
{ result = :instance }
| kSELF kDOT { result = :singleton }

Attribute doesn't support singleton_instance syntax (self?), unlike method definition. Is it intentional?

Copy link
Member

Choose a reason for hiding this comment

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

It's intentional but I'm open to adding the syntax if it's better.

I was assuming that we rarely define attributes for both singleton and instance while the presence of module_function implies it happens frequently fordefs.

Copy link
Member Author

Choose a reason for hiding this comment

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

I was assuming that we rarely define attributes for both singleton and instance while the presence of module_function implies it happens frequently for defs.

I completely agree. It is rare and I do not have any use cases for singleton_instance attributes.

Copy link
Member

@soutaro soutaro left a comment

Choose a reason for hiding this comment

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

🙏

@soutaro soutaro merged commit b0b10d9 into ruby:master Dec 6, 2020
@pocke pocke deleted the Support-singleton-attr-by-prototype-rb branch December 6, 2020 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants