Duplicate type definitions for `rbs prototype rb` in certain cases.
Open
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 2.2k
- Forks
- 256
- Avg merge
- 6d 17h
- Merged PRs (30d)
- 37
Description
Similar to https://github.com/ruby/rbs/issues/1345.
# callable.rb
module Callable
extend ActiveSupport::Concern
# https://api.rubyonrails.org/v7.0.5/classes/ActiveSupport/Concern.html#method-i-class_methods
class_methods do
def call(...)
new(...).call
end
end
def call(*)
raise NotImplementedError
end
end
$ rbs prototype rb -osig callable.rb --force
Processing `callable.rb`...
Generating RBS for `callable.rb`...
- Writing RBS to existing file `sig/callable.rbs`...
# cat sig/callable.rbs
module Callable
extend ActiveSupport::Concern
def call: (*untyped) ?{ () -> untyped } -> untyped
def call: (*untyped) -> untyped
end
$ rbs -Isig validate --silent
/gems/rbs-3.1.0/lib/rbs/definition_builder/method_builder.rb:38:in `block in validate!': sig/callable.rbs:4:2...4:52: ::Callable#call has duplicated definitions in sig/callable.rbs:6:2...6:33 (RBS::DuplicatedMethodDefinitionError)
def call: (*untyped) ?{ () -> untyped } -> untyped
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Duplicate call method types are defined.
I think method definitions in blocks such as ActiveSupport::Concern.class_methods should be ignored.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the output with callable.rb using rbs prototype rb -osig callable.rb --force, then inspect the generated sig/callable.rbs and the rbs prototype rb entry point. The work is done when the generated signature contains no duplicate call definitions and rbs -Isig validate --silent succeeds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100