Repository navigation
Open
Description
Hello!
while debugging one certain package (ConstraintTrees.jl) we found the following surprise with 0.19.4:
julia> union(SortedSet(Symbol[:x,:y]),SortedSet(Any[]))
SortedSet{Symbol, Base.Order.ForwardOrdering} with 2 elements:
:x
:y
julia> union(SortedSet(Any[]),SortedSet(Symbol[:x,:y])) # this triggered our tests
ERROR: UndefRefError: access to undefined reference
Stacktrace:
[1] getproperty
@ ./Base.jl:49 [inlined]
[2] DataStructures.BalancedTree23{…}(::Val{…}, iterable::Base.Generator{…}, ord::Base.Order.ForwardOrdering, allowdups::Bool)
@ DataStructures ~/.julia/packages/DataStructures/9m6yb/src/balanced_tree.jl:1053
[3] SortedSet
@ ~/.julia/packages/DataStructures/9m6yb/src/sorted_set.jl:82 [inlined]
[4] packcopy
@ ~/.julia/packages/DataStructures/9m6yb/src/sorted_set.jl:697 [inlined]
[5] union(m1::SortedSet{Any, Base.Order.ForwardOrdering}, others::SortedSet{Symbol, Base.Order.ForwardOrdering})
@ DataStructures ~/.julia/packages/DataStructures/9m6yb/src/sorted_set.jl:360
[6] top-level scope
@ REPL[18]:1
Some type information was truncated. Use `show(err)` to see complete types.
julia> union(SortedSet(),SortedSet()) # simplest reproducer
ERROR: UndefRefError: access to undefined reference
Stacktrace:
[1] getproperty
@ ./Base.jl:49 [inlined]
[2] DataStructures.BalancedTree23{…}(::Val{…}, iterable::Base.Generator{…}, ord::Base.Order.ForwardOrdering, allowdups::Bool)
@ DataStructures ~/.julia/packages/DataStructures/9m6yb/src/balanced_tree.jl:1053
[3] SortedSet
@ ~/.julia/packages/DataStructures/9m6yb/src/sorted_set.jl:82 [inlined]
[4] union(s1::SortedSet{Any, Base.Order.ForwardOrdering}, others::SortedSet{Any, Base.Order.ForwardOrdering})
@ DataStructures ~/.julia/packages/DataStructures/9m6yb/src/sorted_set.jl:378
[5] top-level scope
@ REPL[19]:1
Some type information was truncated. Use `show(err)` to see complete types.This was triggered by ConstraintTrees testing code and we can confirm that this "worked" originally in DataStructures 0.18-ish. Notably, other sets (OrderedSet) do not seem to have the issue.
I thought I'd leave a note here just in case this would point to a bigger issue somewhere (UndefRefError sounded scary). I looked at the changelogs but there's no notice of this being undefined behavior or so. I hope I didn't miss some obvious warning somewhere.
(also thanks for making DataStructures! I ❤️ the ordered ones!)
cc @stelmo the original discoverer
Metadata
Metadata
Assignees
Labels
No labels
Activity
workaround a possible regression in DataStructures
StephenVavasis commentedon May 3, 2026
StephenVavasis commentedon May 3, 2026
My pull request #970 has failed two of the Github checks. I don't know what these checks do so I don't know how to fix this.
exaexa commentedon May 3, 2026
@StephenVavasis oh great thanks for all the info!
The failed checks look like required code coverage, looks like that codepath is not tested: https://app.codecov.io/gh/JuliaCollections/DataStructures.jl/pull/970?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=checks&utm_campaign=pr+comments&utm_term=JuliaCollections
(note: here https://github.com/JuliaCollections/DataStructures.jl/pull/970/changes#diff-a483f51c6448ee1b535bba625d753f3bdc11643d30446ba9100694d9c0d5f1e0R310 you test
SortedDict, perhaps the codepath is specific toSortedSet?)StephenVavasis commentedon May 3, 2026
exaexa commentedon May 3, 2026
well see the link: https://app.codecov.io/gh/JuliaCollections/DataStructures.jl/pull/970/indirect-changes
that condition shortcircuited another condition, so that one is now untested
StephenVavasis commentedon May 3, 2026