Skip to content

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

Open
@vinistock

Description

@vinistock

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    choreChore taskpinnedThis issue or pull request is pinned and won't be marked as stale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions