`collect` returns `Vector{Any}` for `Iterators.reverse(::Stack)`, `zip(::SparseIntSet...)` and `partial_path`

Đang mở
#1,000 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
65/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Lĩnh vực
backend

Hướng nghiên cứu

Start with the three iterator types named in the issue: DequeIterator in src/deque.jl (around line 135), ZippedSparseIntSetIterator in src/sparse_int_set.jl (around line 210), and TrieIterator in src/trie.jl (around line 100). Run the reproduction snippet from the issue to confirm that collect returns Vector{Any}. Done means each iterator reports a concrete eltype so collect yields a typed vector, with the choice for TrieIterator (type parameter or EltypeUnknown) settled first.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

These exported iterators have no eltype, so collect returns Vector{Any}:

using DataStructures
s = Stack{Int}(); push!(s, 1)
a = SparseIntSet([1, 2])
t = Trie{Char,Int}(); t["ab"] = 1
@show typeof(collect(Iterators.reverse(s))) typeof(first(Iterators.reverse(s)))
@show typeof(collect(zip(a, a))) typeof(first(zip(a, a)))
@show typeof(collect(partial_path(t, "ab"))) typeof(first(partial_path(t, "ab")))

Output on master (b9ff234), Julia 1.13.3:

typeof(collect(Iterators.reverse(s))) = Vector{Any}
typeof(first(Iterators.reverse(s))) = Int64
typeof(collect(zip(a, a))) = Vector{Any}
typeof(first(zip(a, a))) = Tuple{Int64, Int64}
typeof(collect(partial_path(t, "ab"))) = Vector{Any}
typeof(first(partial_path(t, "ab"))) = Trie{Char, Int64}

DequeIterator (src/deque.jl:135), ZippedSparseIntSetIterator (src/sparse_int_set.jl:210) and TrieIterator (src/trie.jl:100) define iterate but no eltype. IteratorEltype keeps its default HasEltype(), so collect trusts the fallback eltype of Any. TrieIterator is not parameterized, so it would need a type parameter or IteratorEltype set to EltypeUnknown().

Ngôn ngữ chính
Julia
Star
747
Fork
261
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của JuliaCollections/DataStructures.jl

Tất cả issue của JuliaCollections/DataStructures.jl

Issue tương tự

Thêm issue về Julia

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.