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

Declare type in initializer for RubyIndexer::Enhancement #2895

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/ruby_indexer/lib/ruby_indexer/enhancement.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def clear

sig { params(listener: DeclarationListener).void }
def initialize(listener)
@listener = listener
@listener = T.let(listener, RubyIndexer::DeclarationListener)
Copy link
Member

Choose a reason for hiding this comment

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

How will this eliminate the need for the shim? Tapioca doesn't carry instance variable declarations to the RBIs AFAIK.

Also, Sorbet already knows the right type for @listener thanks to the method signature.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah true.

Would it be possible to distribute the shim with this gem?

Copy link
Member

Choose a reason for hiding this comment

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

We can try, but I'm not sure if Tapioca picks up instance variable types.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No luck, closing.

end

# The `on_extend` indexing enhancement is invoked whenever an extend is encountered in the code. It can be used to
Expand Down
Loading