ruby / ruby/rbs

Add signatures for the `main` object

Open
#1,117 9 comments 1 reaction 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

Hello. The using method at the top level seems not typed. Is there a way to resolve it?

Reprodoction

The following is a reproduction using Steep. First, prepare a few files.

a.rb:

using Module.new

Steepfile:

target :test do
  check "a.rb"
end

Gemfile:

source "https://rubygems.org"
gem "steep", "1.2"
gem "rbs", "2.7"

Then, install the gems and run steep on your terminal:

$ bundle config set --local path vendor/bundle
$ bundle install
$ bundle exec steep check

You should see the following output:

a.rb:1:0: [error] Type `::Object` does not have method `using`
│ Diagnostic ID: Ruby::NoMethod
│
└ using Module.new
  ~~~~~

Detected 1 problem from 1 file

Environment

  • ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin21]
  • rbs 2.6.0 2.7.0
  • steep 1.1.0 1.2.0

Note

The Module#using method signature has been existing already:

https://github.com/ruby/rbs/blob/95667d76c725566fa455bbcca0c10cc1e539475a/core/module.rbs#L1519

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

Reproduce the report with a.rb, Steepfile, and Gemfile using the documented Steep command. Compare the existing Module#using signature in core/module.rbs with the signatures available to the top-level main object; done means steep check accepts using Module.new without the reported Ruby::NoMethod error.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.