-
Notifications
You must be signed in to change notification settings - Fork 14
Fix RBI -> RBS translation for generics #430
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
Conversation
Signed-off-by: Alexandre Terrasa <[email protected]>
lib/rbi/rbs/type_translator.rb
Outdated
| case type_name | ||
| when "Array" | ||
| "T::Array" | ||
| when "Class" | ||
| "T::Class" | ||
| when "Enumerable" | ||
| "T::Enumerable" | ||
| when "Enumerator" | ||
| "T::Enumerator" | ||
| when "Hash" | ||
| "T::Hash" | ||
| when "Set" | ||
| "T::Set" | ||
| when "Range" | ||
| "T::Range" | ||
| else | ||
| type_name | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we are missing T::Enumerator::Chain and T::Enumerator::Lazy here: https://github.com/sorbet/sorbet/blob/master/rbi/sorbet/t.rbi#L323-L376
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, what if the name was fully qualified, like ::Array[String]?
KaanOzkan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Able to generate correct sigs for ruby-lsp with this branch 👍
Signed-off-by: Alexandre Terrasa <[email protected]>
843e550 to
d672b0b
Compare
Two fixes in there:
Foo[A, B]is not just translated asFooArraytoT::Arrayand friends