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

Introduce RBSSig node #420

Closed
wants to merge 1 commit into from
Closed

Introduce RBSSig node #420

wants to merge 1 commit into from

Conversation

KaanOzkan
Copy link
Contributor

A simple node that's currently used for printing RBS signatures correctly.

lib/rbi/model.rb Outdated
extend T::Sig

#: String
attr_reader :signature
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
attr_reader :signature
attr_reader :string

lib/rbi/model.rb Outdated
@@ -982,6 +987,21 @@ def ==(other)
end
end

# RBS signatures

class RBSSig < NodeWithComments
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not a fan of the name, what about CommentSig or SigComment?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think we want to attach comments to them

Suggested change
class RBSSig < NodeWithComments
class RBSSig < Node

#: (RBSSig node) -> void
def visit_rbs_sig(node)
print_loc(node)
printt("#")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's strip the : when we create the sig so it's nicer to handle, then we add it back when we print:

Suggested change
printt("#")
printt("#:")

@KaanOzkan KaanOzkan force-pushed the ko/rbs-signature branch 2 times, most recently from 147feed to 939fdfc Compare February 25, 2025 17:15
@KaanOzkan KaanOzkan marked this pull request as ready for review February 25, 2025 17:15
@KaanOzkan KaanOzkan requested a review from a team as a code owner February 25, 2025 17:15
@KaanOzkan KaanOzkan requested a review from Morriar February 25, 2025 18:45
#: (RBSSig node) -> void
def visit_rbs_sig(node)
print_loc(node)
printt("#:")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
printt("#:")
printt("#: ")

@@ -1166,5 +1166,15 @@ def test_print_sigs_with_final
end
RBI
end

def test_print_rbs_sigs
rbs_sig = RBSSig.new(" -> String")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
rbs_sig = RBSSig.new(" -> String")
rbs_sig = RBSSig.new("-> String")

This was referenced Mar 4, 2025
@Morriar Morriar closed this in #424 Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants