JuliaCollections / JuliaCollections/DataStructures.jl
append!(l1::MutableLinkedList, l2::MutableLinkedList) fails for empty l2
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 745
- Forks
- 261
- PR merge metrics
- No merged PRs in 30d
Description
The append! function on master currently assumes l2.node.next != l2.node != l2.node.prev and fails if isempty(l2).
E.g.,
A = MutableLinkedList{Int}(1,2,3)
B = MutableLinkedList{Int}()
append!(A,B) # endless loop
This is not directly related to the more general issues #739 #886 #794 , which have been fixed on master.
The simplest solution seems to be adding a check for isempty(l2)? I can try making such PR later.
There don't seem to be any issues if isempty(l1).
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
Open src/mutable_list.jl at the append! implementation around line 153 and reproduce the A/B example with an empty l2. Trace that case and verify that append!(A, B) terminates; done means the empty-l2 scenario no longer enters an endless loop.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 62/100