ruby / ruby/rbs

"Duplicated declaration" after integrating rbs collection

Open
#848 4 comments 0 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

I'm just enabling "rbs collection" in a project previously integrated with rbs. After doing rbs collection install, running rbs-enabled tests breaks on parsing sig files, on a static var which I know for sure ain't repeated:

# sig smth like this:

module A
  class B
    DEFAULT_VAR = String
> bundle exec rbs test --target "A::*" rspec
/home/.bundle/ruby/3.0.0/gems/rbs-1.8.1/lib/rbs/environment.rb:135:in `cache_name': /home/sig/jwt_token_kms/configuration.rbs:19:4...19:37: Duplicated declaration: ::A::B::DEFAULT_VAR (RBS::DuplicatedDeclarationError)
        from /home/.bundle/ruby/3.0.0/gems/rbs-1.8.1/lib/rbs/environment.rb:193:in `insert_decl'
        from /home/.bundle/ruby/3.0.0/gems/rbs-1.8.1/lib/rbs/environment.rb:177:in `block in insert_decl'
        from /home/.bundle/ruby/3.0.0/gems/rbs-1.8.1/lib/rbs/ast/declarations.rb:121:in `block in each_decl'
...

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 bundle exec rbs test --target "A::*" rspec, using the configuration.rbs example from the report. Start by reading rbs/environment.rb around cache_name and insert_decl, then trace declaration traversal in rbs/ast/declarations.rb. Done means the valid static variable no longer raises a duplicate declaration after rbs collection install, while genuine duplicates remain detectable.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.