Special handling for Array#min, max, etc.
Open
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 833
- Forks
- 99
- Avg merge
- 9h 30m
- Merged PRs (30d)
- 12
Description
as = [1, 2, 3]
as.min.to_s(2) #=> [error] failed to resolve overload: nil#to_s
Array[Elem]#min returns Elem | nil in RBS definition. It is correct but it would be useful to return Elem when the receiver is a non-empty tuple.
Contributor guide
No contributing guide indexed for this repository
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 reading the Array[Elem]#min RBS definition and the type inference path for non-empty tuples. Trace how the example [1, 2, 3].min.to_s(2) is resolved; done means a non-empty tuple's min, max, and related methods are inferred as Elem rather than Elem | nil, so the example no longer reports nil#to_s.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100