fix: 多重経路の末端が entries へ重複掲載される欠陥を修正する - #15
Merged
Conversation
複数の中間 sealed を同時に実装する末端は経路の数だけ到達するため、 IR 側の末端収集が同じ末端を経路の数だけ entries へ載せていた。 FIR 側(EnumizeHierarchyResolver)は ClassId キーで重複排除済みであり、 IR 側だけが非対称だった。 中間 sealed を含む全メンバーを走査順を保つ集合へ初出のみ収集し、 そこから末端だけを取り出す形へ改める。この集合が末端の重複掲載と 中間の再展開を同時に抑えるため、訪問済みガードを別に持つ必要はない。 FIR 側の収集(全メンバー収集 → 非 sealed で絞る)とも同じ形になる。 並べ替えは行わないため展開順は従来どおりである。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
producer-jvm の fixtures.mid へ独立階層 MultiPath を追加する。 兄弟中間 MpLeft / MpRight と両方を実装する末端 MpBoth、 各単独経路の末端で、初出位置への 1 回掲載と kind の一意性を固定する。 RootVia の entries スナップショットを汚さないよう独立階層とする。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
設計00 §6.2・設計02 §2・概要 §5 へ規則を追記し、 テスト資料側は K5 へ「多重経路」の値・ケース01 へ API-57・ ケース03 §1 へ規則の典拠・フィクスチャ構成へ MultiPath を反映する。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
k163377
force-pushed
the
fix/multipath-leaf-duplicate-entries
branch
from
August 1, 2026 14:22
9a395bf to
a6f9b18
Compare
k163377
marked this pull request as ready for review
August 1, 2026 14:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
複数の中間 sealed を同時に実装する末端(多重経路)が、
entriesへ経路の数だけ重複して載っていた。診断は発火せず(基底は一意に定まるため)、kind・
asEnumish・valueOfも正常だったが、entriesだけが[Impl2, Impl3, Impl1, Impl3]となり、enum 的意味論(末端 1 種類につき 1 kind)が崩れていた。原因
IR 側の末端収集で、再帰する sealed ノードだけを訪問済み判定し、末端は無条件に追加していた。
FIR 側(
EnumizeHierarchyResolver)はClassIdキーで重複排除しており、IR 側だけが非対称だった。修正
LinkedHashSetとし、初出位置の 1 回だけを残すテスト
producer-jvm の
fixtures.midへ独立階層MultiPath(兄弟中間 + 両実装末端 + 各単独経路末端)とMultiPathTestを追加し、初出位置への 1 回掲載・kind の一意性・else不要の kind-when を固定した。検証済み:
:sealed-class-enumizer-compiler-plugin:check(ktfmtCheck 含む)/producer-jvm・consumer-pure-jvm・consumer-plugin-jvm・downstream-subtype-jvm・java-consumer の
test/:mpp-producer:jvmTest。ドキュメント
🤖 Generated with Claude Code