rbs
rbs copied to clipboard
Support main object
RBS & Steep does not handle the main object well.
# sample.rb
using Foo
sample.rb:1:0: [error] Type `::Object` does not have method `using`
│ Diagnostic ID: Ruby::NoMethod
│
└ using Foo
~~~~~
Problem
Steep (1.10.0) treats main object as Object.
Proposal
We propose to introduce RBS::Unnamed::TopLevelSelfClass.
This is modeled on ENV and ARGF.
class RBS::Unnamed::TopLevelSelfClass
def using: (Module arg0) -> self
end
Steep
Use RBS::Unnamed::TopLevelSelfClass as the main object in Steep.
Reference
https://github.com/ruby/rbs/pull/2357