Special handling for Array#zip
Open
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 833
- Forks
- 99
- Avg merge
- 9h 30m
- Merged PRs (30d)
- 12
Description
It is useful to keep the elements of Array#zip as tuples. RBS of Array#zip has less information for the behavior, so it would be good to implement it as a built-in method.
as = [1, 2, 3]
bs = %w(a b c)
p as.zip(bs)
#=> expected: Array[[Integer, String]] (or [Integer, String?])
# actual: Array[Array[(Integer | String)?]]
as.zip(bs) do |a, b|
p a #=> expected: Integer
# actual: (Integer | String)?
p b #=> expected: String (or String?)
# actual: (Integer | String)?
end
cs = [1.0, 2.0, 3.0]
as.zip(bs, cs) do |a, b, c|
p a #=> expected: Integer
# actual: untyped
p b #=> expected: String (or String?)
# actual: untyped
p c #=> expected: Float (or Float?)
# actual: untyped
end
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
No file or test is named in the issue. Start by locating the built-in handling for Array#zip, then use the shown array and block examples to check tuple element types and confirm the resulting inferred types match the expected output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100