relative lookup failing when subclass has the same name as eval'ed class
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 2.2k
- Forks
- 256
- Avg merge
- 6d 17h
- Merged PRs (30d)
- 37
Description
I have the following sig defined:
# resolver/resolver.rbs
module HTTPX
module Resolver
class Resolver
end
end
end
# resolver.rbs
module HTTPX
module Resolver
def self?.resolver_for: () -> singleton(Resolver::Resolver)
end
end
runtime evaluation using runtime rbs/tester.rb fails though, because the parsed type for the method return is wrong, i.e. it evaluates to a RBS::Types::ClassSingleton instance with a namespace declaring @path=[:Resolver], which when evaluated to to_s, evaluates to Resolver::Resolver, instead of HTTPX::Resolver::Resolver.
I found two workarounds:
def self?.resolver_for: () -> singleton(HTTPX::Resolver::Resolver) #=> absolute namespace, bypasses issues
def self?.resolver_for: () -> singleton(Resolver) #=> resolves to class Resolver instead of module Resolver, which seems wrong
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
Reproduce the failure with the signatures in resolver/resolver.rbs and resolver.rbs using runtime rbs/tester.rb. Trace how the relative singleton type is evaluated in the HTTPX::Resolver context; done means it resolves to HTTPX::Resolver::Resolver rather than Resolver::Resolver.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100