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

Make owner non nilable in all members and instance variables #2506

Open
vinistock opened this issue Aug 28, 2024 · 0 comments
Open

Make owner non nilable in all members and instance variables #2506

vinistock opened this issue Aug 28, 2024 · 0 comments
Labels
chore Chore task pinned This issue or pull request is pinned and won't be marked as stale

Comments

@vinistock
Copy link
Member

Before we could index RBS, we started out by saying that the owner of a method or instance variable could be nil (since we didn't index Object).

In reality, that's not correct. Every instance variable and method always has an owner in Ruby (since everything is an object!). It would be nice if we could get rid of the nilability on owner for all entries, so that we more accurately represent reality.

Notes

The implementation is something like this:

  • Remove the T.nilable from all owner type annotations in entry.rb
  • Run Sorbet to find all type check errors. Fix them one by one

The challenging part is actually tests. Since any method defined directly on the top level is added to Object, the DeclarationListener will now have a dependency that RBS indexing must run before Ruby indexing for correct results.

However, that would mean that we need to index RBS on every single test, even small ones where we only index one tiny Ruby class. I'm not sure how to speed that up, but we need to come up with a strategy that won't slow down the test suite too much.

@vinistock vinistock added chore Chore task pinned This issue or pull request is pinned and won't be marked as stale labels Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Chore task pinned This issue or pull request is pinned and won't be marked as stale
Projects
None yet
Development

No branches or pull requests

1 participant