Cannot specify type variables for `instance`
Open
Nobody has claimed this yet.
wontfix
- Dominant language
- Ruby
- Stars
- 2.2k
- Forks
- 256
- Avg merge
- 6d 17h
- Merged PRs (30d)
- 37
Description
class MyWrapper[E]
def self.of: (E) -> instance # RBS::UnknownTypeName (it’s not inferred from `MyWrapper[E]`)
def self.of: (E) -> instance[E] # RBS::SyntaxError
def self.of: [E] (E) -> instance # ok, but `[E]` is not used in practice (it’s not the same `[E]` as the one in `MyWrapper[E]`)
def self.of: (untyped) -> instance # ok, but `untyped` is bad
end
Even Steep is aware of this limitation:
https://github.com/soutaro/steep/blob/v1.5.3/lib/steep/subtyping/check.rb#L307
Proposal: instance[E]?
The problem might be significant for class as well:
https://github.com/soutaro/steep/blob/v1.5.3/lib/steep/subtyping/check.rb#L322
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 with the proposed instance[E] syntax and the referenced Steep subtyping checks at lib/steep/subtyping/check.rb lines 307 and 322. Determine the intended treatment for both instance and class; done requires an agreed design and corresponding RBS and type-checking behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100