Skip to content

Conversation

@Morriar
Copy link
Contributor

@Morriar Morriar commented Mar 6, 2025

Two fixes in there:

  1. Properly translate generic classes so RBS Foo[A, B] is not just translated as Foo
  2. Translate generic Array to T::Array and friends

@Morriar Morriar added the bugfix Fix a bug label Mar 6, 2025
@Morriar Morriar self-assigned this Mar 6, 2025
@Morriar Morriar requested a review from a team as a code owner March 6, 2025 21:08
Comment on lines 155 to 176
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
Copy link
Member

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

Copy link
Member

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]?

Copy link
Contributor

@KaanOzkan KaanOzkan left a 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 👍

@Morriar Morriar force-pushed the at-fix-rbs-generic branch from 843e550 to d672b0b Compare March 7, 2025 14:48
@Morriar Morriar requested a review from KaanOzkan March 7, 2025 14:48
@Morriar Morriar merged commit 29f5daa into main Mar 10, 2025
8 checks passed
@Morriar Morriar deleted the at-fix-rbs-generic branch March 10, 2025 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Fix a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants