feat(joinir): Phase 66 - Ownership-Relay Multihop Implementation (dev-only)

Phase 65設計に基づき、relay_path.len() > 1 を analysis/plan 層で受理するよう実装。

Key changes:
- plan_to_lowering.rs: relay_path.len() > 1 制限撤去 + 構造的 Fail-Fast 維持
  - relay_path.is_empty() → Err(loop relay は最低 1 hop)
  - relay_path[0] != plan.scope_id → Err(この scope が最初の hop)
  - relay.owner_scope == plan.scope_id → Err(relay と owned は排他)
  - owned_vars ∩ relay_writes ≠ ∅ → Err(同名は不変条件違反)

- ast_analyzer.rs: 3階層 multihop テスト追加
  - multihop_relay_detected_for_3_layer_nested_loops

Unit tests (plan_to_lowering):
- test_relay_multi_hop_accepted_in_with_relay
- test_relay_path_empty_rejected_in_with_relay
- test_relay_path_not_starting_at_plan_scope_rejected
- test_relay_owner_same_as_plan_scope_rejected
- test_owned_and_relay_same_name_rejected

Tests: normalized_dev 49/49 PASS, lib 947/947 PASS
Design: Analysis-only, no behavior change in production lowering

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-12-12 23:33:16 +09:00
parent ba68fb2bad
commit 5c75506dcc
4 changed files with 285 additions and 14 deletions

View File

@ -281,7 +281,15 @@
- 禁止事項の明文化by-name分岐排除dev-only name guard対象外
- 代表ケース3階層multihop AST例Merge relay JSON fixture例
- 詳細: [phase65-ownership-relay-multihop-design.md](docs/development/current/main/phase65-ownership-relay-multihop-design.md)
24. JoinIR Verify / 最適化まわり
24. **Phase 66-OWNERSHIP-RELAY-MULTIHOP-IMPL完了✅ 2025-12-12**: Multihop relay 実装analysis/plan層
- `plan_to_lowering.rs` relay_path.len() > 1 制限撤去
- ✅ 構造的 Fail-Fast ガード実装empty path, scope mismatch, owner=scope, name conflict
- ✅ ユニットテスト追加5件: multihop accepted, empty rejected, path mismatch, owner same, name conflict
-`ast_analyzer.rs` に 3階層 multihop テスト追加
- ✅ テスト結果: normalized_dev 49/49, lib 947/947 PASS
- 次フェーズ: Phase 67本番lowering側のmultihop実行対応 or merge relay
- 詳細: [phase65-ownership-relay-multihop-design.md](docs/development/current/main/phase65-ownership-relay-multihop-design.md)
25. JoinIR Verify / 最適化まわり
- すでに PHI/ValueId 契約は debug ビルドで検証しているので、
必要なら SSADFA や軽い最適化Loop invariant / Strength reductionを検討。