ruby / ruby/rbs

Support main object

Open
#2,361 0 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
2.2k
Forks
256
Avg merge
6d 17h
Merged PRs (30d)
37

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the proposed RBS::Unnamed::TopLevelSelfClass design and the referenced pull request 2357, then trace how Steep represents the main object. Compare the intended modeling with ENV and ARGF. Done means the sample using Foo is no longer reported as a missing method on Object and the main object uses the proposed type.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.