ruby / ruby/gem_rbs_collection

rbs files with untyped block type/method type parameters causes error in `bin/test`

Open
#620 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
303
Forks
136
Avg merge
5h 15m
Merged PRs (30d)
6

Description

reproduction:

  1. run bin/init_new_gem foobar (version: 0.0)
  2. edit gems/foobar/0.0/foobar.rbs as below
module Foobar
  def foo: (?) -> untyped
end
  1. running bin/test gems/foobar/0.0, raises an error as below:
Testing gems/foobar/0.0...
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Writing lockfile to ~/path/to/gem_rbs_collection/gems/foobar/0.0/_test/Gemfile.lock
Installing foobar:0.0 (~/path/to/gem_rbs_collection/gems/foobar/0.0)
It's done! 1 gems' RBSs now installed.
bundler: failed to load command: rbs (~/.rbenv/versions/3.3.3/bin/rbs)
~/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/rbs-3.5.1/lib/rbs/method_type.rb:130:in `with_nonreturn_void?': undefined method `with_nonreturn_void?' for an instance of RBS::Types::UntypedFunction (NoMethodError)

      if type.with_nonreturn_void?
             ^^^^^^^^^^^^^^^^^^^^^
Did you mean?  with_nonreturn_void
        from ~/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/rbs-3.5.1/lib/rbs/cli/validate.rb:274:in `void_type_context_validator'
        from ~/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/rbs-3.5.1/lib/rbs/cli/validate.rb:155:in `block (4 levels) in validate_class_module_definition'
        from ~/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/rbs-3.5.1/lib/rbs/cli/validate.rb:154:in `each'
        from ~/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/rbs-3.5.1/lib/rbs/cli/validate.rb:154:in `block (3 levels) in validate_class_module_definition'
        from ~/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/rbs-3.5.1/lib/rbs/ast/declarations.rb:14:in `block in each_member'
        from ~/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/rbs-3.5.1/lib/rbs/ast/declarations.rb:12:in `each'
        from ~/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/rbs-3.5.1/lib/rbs/ast/declarations.rb:12:in `each_member'
        from ~/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/rbs-3.5.1/lib/rbs/cli/validate.rb:150:in `block (2 levels) in validate_class_module_definition'
        from ~/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/rbs-3.5.1/lib/rbs/cli/validate.rb:149:in `each'
        from ~/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/rbs-3.5.1/lib/rbs/cli/validate.rb:149:in `block in validate_class_module_definition'
        from ~/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/rbs-3.5.1/lib/rbs/cli/validate.rb:97:in `each'
        from ~/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/rbs-3.5.1/lib/rbs/cli/validate.rb:97:in `validate_class_module_definition'
        from ~/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/rbs-3.5.1/lib/rbs/cli/validate.rb:84:in `run'
        from ~/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/rbs-3.5.1/lib/rbs/cli.rb:447:in `run_validate'
        from ~/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/rbs-3.5.1/lib/rbs/cli.rb:140:in `run'
        from ~/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/rbs-3.5.1/exe/rbs:7:in `<top (required)>'
        from ~/.rbenv/versions/3.3.3/bin/rbs:25:in `load'
        from ~/.rbenv/versions/3.3.3/bin/rbs:25:in `<top (required)>'
        from ~/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:58:in `load'
        from ~/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:58:in `kernel_load'
        from ~/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:23:in `run'
        from ~/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/bundler-2.4.13/lib/bundler/cli.rb:492:in `exec'
        from ~/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
        from ~/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
        from ~/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
        from ~/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/bundler-2.4.13/lib/bundler/cli.rb:34:in `dispatch'
        from ~/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
        from ~/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/bundler-2.4.13/lib/bundler/cli.rb:28:in `start'
        from ~/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/bundler-2.4.13/exe/bundle:45:in `block in <top (required)>'
        from ~/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/bundler-2.4.13/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
        from ~/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/bundler-2.4.13/exe/bundle:33:in `<top (required)>'
        from ~/.rbenv/versions/3.3.3/bin/bundle:25:in `load'
        from ~/.rbenv/versions/3.3.3/bin/bundle:25:in `<main>'
# Type checking files:

.....................................................................................

No type error detected. 🫖
No untyped calls detected. 🐾
 => Failure 🚨

# Failed gems
gems/foobar/0.0

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 failure with bin/init_new_gem, the sample gems/foobar/0.0/foobar.rbs signature, and bin/test gems/foobar/0.0. Start by tracing the validation error shown from RBS 3.5.1 in rbs/method_type.rb and cli/validate.rb. Done means bin/test handles the untyped signature without raising and the gem passes validation.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.