a slighly uncanny `UndefRefError` with default-empty SortedSet
評価
調査の方向性
最小限の 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 を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
JuliaCollections/DataStructures.jl のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
append!(l1::MutableLinkedList, l2::MutableLinkedList) fails for empty l2対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
JuliaCollections/DataStructures.jl#997 · コメント 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
-
several `mutable struct` type definitions do not require mutability, review and adjust対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
JuliaCollections/DataStructures.jl の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
osrep/Runes2P.jl#153 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
WaterLily-jl/WaterLily-Examples#49 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
documentation invalid
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
JuliaPhysics/BeamletOptics.jl#190 ·
メンテナーはふだん 1 日以内に返信