Description
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 inentry.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.