rbs icon indicating copy to clipboard operation
rbs copied to clipboard

Support main object

Open ksss opened this issue 8 months ago • 0 comments

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

ksss avatar Mar 26 '25 13:03 ksss