Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

a slighly uncanny `UndefRefError` with default-empty SortedSet

オープン
#969 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る

@StephenVavasis がすでに取り組んでいます。

2026年5月3日 から。

  • #970 @StephenVavasis による — オープン

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
52/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
julia
領域
data

調査の方向性

最小限の union(SortedSet(), SortedSet()) の再現から始め、sorted_set.jl の 82、360、378、697 行を調べてから、balanced_tree.jl の 1053 行にあるコンストラクターを追ってください。空の union ケースと空でない union ケース、および報告されている OrderedSet の動作を比較してください。空の SortedSet の union が UndefRefError を発生させなくなり、示されている空でない union が引き続き動作すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
Julia
スター
747
フォーク
261
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

JuliaCollections/DataStructures.jl のほかの issue

JuliaCollections/DataStructures.jl の issue をすべて見る

似ている issue

Julia の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。