Skip to content

Warning: already initialized constant URI::Schemes::SOURCE #2471

@amomchilov

Description

@amomchilov
/home/runner/work/tapioca/tapioca/vendor/bundle/ruby/3.4.0/gems/uri-1.1.1/lib/uri/common.rb:123: warning: already initialized constant URI::Schemes::SOURCE
/home/runner/work/tapioca/tapioca/vendor/bundle/ruby/3.4.0/gems/uri-1.1.1/lib/uri/common.rb:123: warning: previous definition of SOURCE was here

CI build log

I made this commit to debug where this is coming from, and found these conflicting definitions when you run bin/test:

  1. if URI.respond_to?(:register_scheme)
    URI.register_scheme("SOURCE", self)
    else
    @@schemes["SOURCE"] = self
    end

  2. https://github.com/Shopify/ruby-lsp/blob/e0b26e129dcb58cbbfc31c1a6b56e57bf42ac5d6/lib/ruby_lsp/requests/support/source_uri.rb#L73-L78

We can easily detect this with condition with URI.scheme_list.has_key?("SOURCE"), but that doesn't solve the discrepancy of trying to set two different classes for the same URI. They're really similar, but still distinct.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions