76a36333c2
feat(joinir): Phase 204 PHI Contract Verifier complete
...
Phase 204-3/5/6/7: PHI inputs verification, integration, testing, docs
Implementation:
- verify_phi_inputs_defined(): Conservative sanity checks (ValueId < 100000)
- Integration: All verifiers in verify_joinir_contracts()
- Testing: 821 tests PASS, no regressions
Task Status:
- ✅ 204-1: Design document (phase204-phi-contract-verifier.md)
- ✅ 204-2: PHI dst overwrite detection
- ✅ 204-3: PHI inputs sanity checks
- ⚠️ 204-4: JoinValueSpace region verification (deferred to Phase 205+)
- Rationale: Requires LoopHeaderPhiInfo extension (4+ files)
- Alternative: Conservative threshold checks in verify_phi_inputs_defined()
- ✅ 204-5: Integration (verify_joinir_contracts)
- ✅ 204-6: Tests (821 PASS)
- ✅ 204-7: Documentation (phase204 doc + CURRENT_TASK.md)
Verification Coverage:
- ✅ PHI exists (Phase 200-3)
- ✅ PHI dst match (Phase 200-3)
- ✅ PHI dst not overwritten (Phase 204-2) ✨
- ✅ PHI inputs sanity (Phase 204-3) ✨
- ⚠️ PHI inputs DFA (Phase 205+)
- ⚠️ ValueId regions (Phase 205+)
Design Principles:
- Debug-only (#[cfg(debug_assertions)])
- Fail-Fast (panic on violation)
- Zero cost in release builds
Files Modified:
- src/mir/builder/control_flow/joinir/merge/mod.rs (+115 lines)
- src/mir/builder/control_flow/joinir/merge/exit_line/reconnector.rs (1 line)
- docs/development/current/main/phase204-phi-contract-verifier.md (updated)
- CURRENT_TASK.md (Phase 204 complete)
Success Criteria: 4/5 met (1 deferred with rationale)
2025-12-09 19:57:32 +09:00
c6091f414a
docs(joinir): Phase 203-B update documentation for Phase 201-202
...
Update documentation to reflect Phase 201 (JoinValueSpace) and Phase 202
(Pattern 1-4 unification) achievements.
Changes:
1. joinir-architecture-overview.md:
- Add Section 1.9 "ValueId Space Management (Phase 201)"
- ValueId space diagram (PHI/Param/Local regions)
- Component-to-region mapping table
- Design principles and value_id_ranges.rs relationship
2. CURRENT_TASK.md:
- Add Phase 201 completion report (JoinValueSpace design + implementation)
- Add Phase 202 completion report (Pattern 1-4 unified migration)
- Add Phase 203-A completion report (dead code removal)
- Include commit hashes, test results, and next steps
3. phase202-summary.md (NEW):
- Complete Phase 202 summary document
- Before/After comparison tables
- Region usage matrix for all patterns
- Test coverage (821 tests passing)
- Architecture impact and benefits
Documentation Coverage:
- Phase 201: JoinValueSpace unified ValueId allocation
- Phase 202-A: Pattern 1 migration (commit 6e778948 )
- Phase 202-B: Pattern 3 migration (commit 98e81b26 )
- Phase 202-C: Pattern 4 migration (commit ae741d97 )
- Phase 203-A: Dead code removal (commit de9fe3bf )
All documentation links verified and consistent.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-09 19:39:01 +09:00
32a91e31ac
feat(joinir): Phase 200-B/C/D capture analysis + Phase 201-A reserved_value_ids infra
...
Phase 200-B: FunctionScopeCaptureAnalyzer implementation
- analyze_captured_vars_v2() with structural loop matching
- CapturedEnv for immutable function-scope variables
- ParamRole::Condition for condition-only variables
Phase 200-C: ConditionEnvBuilder extension
- build_with_captures() integrates CapturedEnv into ConditionEnv
- fn_body propagation through LoopPatternContext to Pattern 2
Phase 200-D: E2E verification
- capture detection working for base, limit, n etc.
- Test files: phase200d_capture_minimal.hako, phase200d_capture_in_condition.hako
Phase 201-A: MirBuilder reserved_value_ids infrastructure
- reserved_value_ids: HashSet<ValueId> field in MirBuilder
- next_value_id() skips reserved IDs
- merge/mod.rs sets/clears reserved IDs around JoinIR merge
Phase 201: JoinValueSpace design document
- Param/Local/PHI disjoint regions design
- API: alloc_param(), alloc_local(), reserve_phi()
- Migration plan for Pattern 1-4 lowerers
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-09 18:32:03 +09:00
3a9b44c4e2
feat(joinir): Phase 200-A ConditionEnv extension infrastructure
...
Added type and skeleton infrastructure for function-scoped variable
capture, preparing for Phase 200-B integration with ConditionEnv.
New Types:
- CapturedVar: { name, host_id, is_immutable }
- CapturedEnv: Collection of captured variables
- ParamRole: { LoopParam, Condition, Carrier, ExprResult }
New Functions (Skeletons):
- analyze_captured_vars(): Detects function-scoped "constants"
- build_with_captures(): ConditionEnvBuilder v2 entry point
- add_param_with_role(): Role-based parameter routing
New File:
- src/mir/loop_pattern_detection/function_scope_capture.rs
Design Principles:
- Infra only: Types and skeletons, no behavior changes
- Existing behavior maintained: All current loops work identically
- Box-first: New responsibilities in new file
- Documentation: Future implementation plans in code comments
Test Results:
- 6 new unit tests (function_scope_capture: 3, param_role: 3)
- All 804 existing tests PASS (0 regressions)
Next: Phase 200-B (actual capture detection and integration)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-09 16:19:08 +09:00
f47fa9a7a8
feat(joinir): Phase 197 lightweight loops E2E validation complete
...
Verified JoinIR infrastructure on production-ready lightweight loops:
Test Results (4/5 E2E PASS, 1/5 routing confirmed):
- phase195_sum_count.hako (P3 multi-carrier): 93 ✅
- loop_if_phi.hako (P3 single-carrier): sum=9 ✅
- loop_min_while.hako (P1): 0,1,2 ✅
- phase182_match_literal.hako (P1): MATCH ✅
- _skip_whitespace (P2): routing whitelisted ✅
Key Findings:
- No [joinir/freeze] messages - all loops route through JoinIR mainline
- Zero regressions on Phase 190-196 tests
- Pattern detection (P1/P2/P3) working correctly
Documentation Updates:
- phase197-lightweight-loops-deployment.md: Implementation Results
- joinir-architecture-overview.md: Deployment status table (7/13 = 54%)
- CURRENT_TASK.md: Phase 197 marked complete
Coverage: 7/13 JsonParser loops JoinIR-enabled (54%)
Deferred: 6 loops (ConditionEnv, complex carriers, multiple MethodCalls)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-09 15:28:49 +09:00
845715a822
docs: Phase 197 lightweight loops deployment design
...
Created comprehensive Phase 197 design document for JoinIR deployment
validation on lightweight loops.
1. phase197-lightweight-loops-deployment.md:
- Target loops selection (5 loops: 2 JsonParser + 3 tests)
- Task breakdown (197-1 to 197-4)
- Success criteria and design principles
- Deferred loops documentation
2. CURRENT_TASK.md:
- Added Phase 197 section with target loop list
- Implementation plan (routing check, structure trace, E2E execution)
- Next phase candidates (Phase 200+ ConditionEnv, Phase 198+ JsonParser)
Target Loops:
- _match_literal (P1) - JsonParser simple while
- _skip_whitespace (P2) - JsonParser break pattern
- phase195_sum_count.hako (P3 multi-carrier) - Phase 196 verified
- loop_if_phi.hako (P3 single-carrier) - Phase 196 verified
- loop_min_while.hako (P1 minimal) - Phase 165 baseline
Ready for Phase 197 implementation.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-09 15:01:42 +09:00
996925ebaf
fix(joinir): Phase 196 Select double-remap bug in instruction_rewriter
...
Root cause: PHI inputs were being remapped twice in instruction_rewriter.rs
- Line 304: remap_instruction() already remapped JoinIR → Host ValueIds
- Line 328: remap_value() attempted to remap again → undefined ValueIds
Fix: Only remap block IDs, use already-remapped ValueIds as-is
Test results:
- phase195_sum_count.hako → 93 ✅ (multi-carrier P3)
- loop_if_phi.hako → sum=9 ✅ (single-carrier P3)
- loop_min_while.hako → 0,1,2 ✅ (Pattern 1)
- joinir_min_loop.hako → RC:0 ✅ (Pattern 2)
- No [joinir/freeze], no regressions
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-09 14:45:04 +09:00
dc4eda9cdc
docs: Phase 195 implementation status + Phase 196 (Select bug) planning
...
Phase 195 implementation complete (Lowerer side):
- loop_with_if_phi_minimal.rs: multi-carrier PHI generation (sum + count)
- pattern3_with_if_phi.rs: dynamic single/multi-carrier handling
- ExitLine/CarrierVar.join_id: NO CHANGES NEEDED (existing infra worked!)
- YAGNI principle validated - PhiGroupBox was not necessary
Blocker discovered: Nested Select→Branch+Phi conversion bug
- JoinIR correctly generates: ValueId(20) = phi [(bb3, 14), (bb4, 18)]
- MIR incorrectly produces: %27 = phi [%28, bb8], [%32, bb9] (undefined)
- Root cause: joinir_block.rs Select expansion (bridge layer)
- NOT a Phase 195 issue - pre-existing bug in Select conversion
Phase 196 planned (NEW):
- 196-1: Document select_expansion / instruction_rewriter responsibilities
- 196-2: Formalize "1 Select = 3 blocks + 1 PHI" interface
- 196-3: Debug block reuse / block ID mapping
- 196-4: Fix and E2E test (phase195_sum_count.hako → 72)
Documentation updates:
- phase195-pattern3-extension-design.md: Implementation Status section
- CURRENT_TASK.md: Phase 195 complete + Phase 196 TODO
- joinir-architecture-overview.md: P3 Lowerer complete, bridge blocker noted
Key insight: "Pattern side is done, problem is in bridge side"
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-09 13:58:31 +09:00
22f97b67b1
docs: Phase 195 Pattern 3 extension design (multi-carrier support)
...
Phase 195 design document for P3 (If-Else PHI) multi-carrier expansion:
- Goal: Handle 2-3 carriers in if-else branches simultaneously
- Scope: if-complete multi-carrier updates (flag+buffer, sum+count patterns)
Task breakdown:
- 195-1: Loop inventory (_parse_string simple, if-sum patterns)
- 195-2: LoopUpdateSummary/CarrierInfo design (multi-carrier support)
- 195-3: Pattern3 lowerer design (PhiGroup vs ExitLine extension)
- 195-4: Implementation scope (2-3 carriers, existing UpdateKind range)
- 195-5: Documentation updates (CURRENT_TASK.md + overview)
Design decisions:
- ✅ ExitLine extension (no PhiGroupBox - YAGNI principle)
- ✅ Both-branch carrier definition check (unchanged = use previous value)
- ❌ No ConditionEnv expansion (Phase 200+ deferred)
- ❌ LoopBodyLocal + MethodCall mix deferred to Phase 195+
Target loops:
1. JsonParser _parse_string (escaped flag + buffer)
- Carrier 1: escaped (BoolFlag) - conditional flag
- Carrier 2: buffer (StringAppend) - else-only update
2. selfhost if-sum (sum + count)
- Carrier 1: sum (NumberAccumulation) - then-only update
- Carrier 2: count (CounterLike) - then-only update
Test cases designed:
- phase195_flag_buffer.hako (BoolFlag + StringAppend)
- phase195_sum_count.hako (NumberAccumulation + CounterLike)
Expected outcome:
- phase195-pattern3-extension-design.md (complete design spec)
- Clear implementation scope for Phase 195-impl
- Path to 40% → 60% JsonParser coverage
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-09 13:22:14 +09:00
eb1eb2c712
docs: Phase 193 ConditionEnv design decision - maintain 2-tier boundary
...
Phase 193 設計判断の記録:
- ConditionEnv を「ループパラメータ専用 view」として維持
- 外部ローカル変数(digits 等)は含めない判断を明記
- 理由: Phase 170-200 の 2-tier 境界設計(ConditionEnv/LoopBodyLocalEnv)保持
- 安全性と保守性を優先(箱理論の実践)
phase193-init-methodcall-design.md:
- "ConditionEnv 制約の設計判断" セクション追加
- 対応範囲明確化: ループパラメータベース MethodCall のみ
- 将来の対応案: 独立した箱として設計、または .hako リライト
- Phase 194+ は Option C(実戦投入優先)を推奨
CURRENT_TASK.md:
- Phase 193 完了マーク(2025-12-09)
- 重要な設計判断セクション追加
- digits.indexOf(ch) は Phase 200+ に保留と明記
設計原則:
> 「LoopBodyLocal + Param ベースの安全な init」は JoinIR に乗せる。
> 「テーブル+メソッド呼び出し」のような複合パターンは、次の箱案件にする。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-09 06:04:09 +09:00
4f94309548
feat(joinir): Phase 192-impl ComplexAddendNormalizer implementation
...
- New module: complex_addend_normalizer.rs (320 lines, 5 unit tests)
- Transforms `result = result * 10 + f(x)` into temp variable pattern
- Pattern2 preprocessing integration (~40 lines added)
- Zero changes to emission layers (reuses Phase 191 + Phase 190)
Tests:
- Unit tests: 5/5 passing (normalization logic)
- Regression: phase190/191 tests all pass
- Demo: phase192_normalization_demo.hako → 123
Limitation: Full E2E requires Phase 193 (MethodCall in init)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-09 04:20:28 +09:00
b7bf4a721e
docs: Phase 191 completion + Phase 192 Complex addend design
...
- Updated joinir-architecture-overview.md:
- Phase 191 body-local init integration complete
- Phase 192 Complex addend normalization strategy
- Updated CURRENT_TASK.md: Phase 191 complete with results
- Created phase192-complex-addend-design.md:
- ComplexAddendNormalizer design (temp variable decomposition)
- Integration with LoopUpdateAnalyzer and Pattern2
- No changes to emission layer (reuses existing boxes)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-09 03:59:53 +09:00
57cf67002e
docs: JoinIR Chapter 1 foundation complete summary + Phase 191 spec
...
- Added Section 7 to joinir-architecture-overview.md with completion status
- Updated CURRENT_TASK.md with Phase 191-193 roadmap
- Created phase191-body-local-integration.md instruction document
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-09 03:18:05 +09:00
1af92d8aea
docs: Phase 190-impl-D complete - NumberAccumulation PHI wiring fixed
...
- Fixed ValueId collision between body-local and carrier params
- Added ExitLine contract verifier (debug assertions)
- Updated test files to use Main box
- E2E verified: atoi→12, parse_number→123
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-09 03:07:15 +09:00
0b705f9ca0
docs(joinir): Phase 190 NumberAccumulation design (doc-only)
...
Design document for `result = result * 10 + digit` patterns:
- Section 1-2: Target loop analysis (_atoi, _parse_number)
- Section 3: UpdateKind::NumberAccumulation { base: i64 }
- Section 4: classify_number_update() algorithm
- Section 5: Pattern2/4 can_lower() specification
- Section 6: CarrierUpdateLowerer 2-instruction emission
- Section 7-12: Implementation roadmap, testing strategy
Key decisions:
- Safe: lhs = lhs * CONST + Variable/Const
- Unsafe: LHS 2+ occurrences, variable base, method calls
- Integer type only (no string)
- Fail-Fast for Complex patterns
Next: Phase 190-impl for code implementation
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-09 01:54:53 +09:00
88e9fff141
docs(joinir): Phase 189 JsonParser mini verification
...
Investigation Results:
- _match_literal: ✅ Works correctly (Pattern1)
- _parse_number: ❌ Blocked by LoopBodyLocal
- _atoi: ❌ Carrier detection gap identified
Root Cause: Carrier Detection Limitation
- Pattern1/2 only detect loop counter from condition
- Accumulator variables (result = result * 10 + digit) not detected
- MIR shows missing PHI for accumulator variables
Phase 188 Status:
- StringAppend implementation: ✅ Complete and correct
- End-to-end verification: ⏳ Waiting for carrier detection fix
Phase 190 Options:
- Option A: Expand LoopUpdateAnalyzer (recursive traversal)
- Option B: Explicit carrier annotation syntax
- Option C: Whole-body variable analysis
Created:
- phase189-jsonparser-mini-verification.md (comprehensive report)
- 3 test files (parse_number, atoi, match_literal)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-09 01:47:07 +09:00
a2933880ae
feat(joinir): Phase 188 StringAppend support in Pattern2/4
...
- Extended Pattern2/4 whitelist to accept StringLiteral updates
- CarrierUpdateEmitter now emits JoinIR for string append
- Selective Fail-Fast: accept safe patterns, reject complex
Changes:
- pattern2_with_break.rs: StringLiteral whitelist
- pattern4_with_continue.rs: StringLiteral whitelist
- carrier_update_emitter.rs: StringLiteral JoinIR emission
Tests:
- phase188_string_append_char.hako
- phase188_string_append_literal.hako
- 10/10 carrier_update_emitter tests PASS
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-09 01:09:54 +09:00
d4231f5d3a
feat(joinir): Phase 185-187 body-local infrastructure + string design
...
Phase 185: Body-local Pattern2/4 integration skeleton
- Added collect_body_local_variables() helper
- Integrated UpdateEnv usage in loop_with_break_minimal
- Test files created (blocked by init lowering)
Phase 186: Body-local init lowering infrastructure
- Created LoopBodyLocalInitLowerer box (378 lines)
- Supports BinOp (+/-/*//) + Const + Variable
- Fail-Fast for method calls/string operations
- 3 unit tests passing
Phase 187: String UpdateLowering design (doc-only)
- Defined UpdateKind whitelist (6 categories)
- StringAppendChar/Literal patterns identified
- 3-layer architecture documented
- No code changes
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-09 00:59:38 +09:00
b6e31cf8ca
feat(joinir): Phase 184 - Body-local MIR Lowering Infrastructure
...
Phase 184 implements the foundation for body-local variable support in
update expressions, completing the three-box architecture:
LoopBodyLocalEnv (storage), UpdateEnv (composition), and
CarrierUpdateEmitter (emission).
## Implementation Summary
### Task 184-1: Design Document
- Created phase184-body-local-mir-lowering.md
- Two-Environment System design (ConditionEnv + LoopBodyLocalEnv)
- Box-First design principles documented
### Task 184-2: LoopBodyLocalEnv Implementation
- New file: src/mir/join_ir/lowering/loop_body_local_env.rs (216 lines)
- Storage box for body-local variable name → ValueId mappings
- BTreeMap for deterministic ordering (PHI consistency)
- 7 unit tests: empty env, single/multiple locals, get/contains, iteration
### Task 184-3: UpdateEnv Implementation
- New file: src/mir/join_ir/lowering/update_env.rs (237 lines)
- Composition box for unified variable resolution
- Priority order: ConditionEnv (condition vars) → LoopBodyLocalEnv (body-local)
- 8 unit tests: priority, fallback, not found, combined lookup
### Task 184-4: CarrierUpdateEmitter Integration
- Modified: src/mir/join_ir/lowering/carrier_update_emitter.rs
- Added emit_carrier_update_with_env() (UpdateEnv version)
- Kept emit_carrier_update() for backward compatibility
- 4 new unit tests: body-local variable, priority, not found, const update
- Total 10 tests PASS (6 existing + 4 new)
### Task 184-5: Representative Test Cases
- apps/tests/phase184_body_local_update.hako (Pattern1 baseline)
- apps/tests/phase184_body_local_with_break.hako (Pattern2, Phase 185 target)
### Task 184-6: Documentation Updates
- Updated: docs/development/current/main/joinir-architecture-overview.md
- Updated: CURRENT_TASK.md (Phase 184 completion record)
## Test Results
All 25 unit tests PASS:
- LoopBodyLocalEnv: 7 tests
- UpdateEnv: 8 tests
- CarrierUpdateEmitter: 10 tests (6 existing + 4 new)
Build: ✅ Success (0 errors)
## Design Constraints
Following 箱理論 (Box Theory) principles:
- Single Responsibility: Each box has one clear purpose
- Deterministic: BTreeMap ensures consistent ordering
- Conservative: Pattern5 (Trim) integration deferred to Phase 185
- Fail-Fast: Explicit errors for unsupported patterns
## Scope Limitation
Phase 184 provides the **infrastructure only**:
- ✅ Storage box (LoopBodyLocalEnv)
- ✅ Composition box (UpdateEnv)
- ✅ Emission support (CarrierUpdateEmitter)
- ❌ Pattern2/4 integration (requires body-local collection, Phase 185)
## Next Steps
Phase 185: Pattern2/4 Integration
- Integrate LoopBodyLocalEnv into Pattern2/4 lowerers
- Add body-local variable collection from loop body AST
- Enable full E2E body-local variable support in update expressions
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-08 23:59:19 +09:00
a3df5ecc7a
feat(joinir): Phase 183 LoopBodyLocal role separation
...
Implements role-based separation of LoopBodyLocal variables to prevent
inappropriate Trim promotion for body-only local variables.
## Changes
### Task 183-1: Design Documentation
- Created `phase183-loopbodylocal-role-separation.md` with role taxonomy:
- Condition LoopBodyLocal: Used in loop conditions → Trim promotion target
- Body-only LoopBodyLocal: Only in body → No promotion needed
- Documented architectural approach and implementation strategy
### Task 183-2: Implementation
- Added `TrimLoopLowerer::is_var_used_in_condition()` helper
- Recursively checks if variable appears in condition AST
- Handles BinaryOp, UnaryOp, MethodCall node types
- Updated `try_lower_trim_like_loop()` to filter condition LoopBodyLocal
- Only processes LoopBodyLocal that appear in break conditions
- Skips body-only LoopBodyLocal (returns Ok(None) early)
- Added 5 unit tests for variable detection logic
### Task 183-3: Test Files
- Created `phase183_body_only_loopbodylocal.hako`
- Demonstrates body-only LoopBodyLocal (`temp`) not triggering Trim
- Verified trace output: "No LoopBodyLocal detected, skipping Trim lowering"
- Created additional test files (phase183_p1_match_literal, phase183_p2_atoi, phase183_p2_parse_number)
### Task 183-4: Documentation Updates
- Updated `joinir-architecture-overview.md` with Phase 183 results
- Updated `CURRENT_TASK.md` with Phase 183 completion status
## Results
✅ LoopBodyLocal role separation complete
✅ Body-only LoopBodyLocal skips Trim promotion
✅ 5 unit tests passing
✅ Trace verification successful
## Next Steps (Phase 184+)
- Body-local variable MIR lowering support
- String concatenation filter relaxation
- Full _parse_number/_atoi implementation
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-08 23:14:10 +09:00
0772dc3e82
docs(joinir): Phase 182-6 Update documentation with P1/P2 verification results
...
Phase 182 Summary:
✅ Pattern1 (Simple) verification complete
✅ Pattern2 (Break) verification complete with integer operations
✅ Routing whitelist updated (_parse_number/2, _atoi/1, _match_literal/3)
✅ Representative tests created and passing
Blockers identified:
1. LoopBodyLocal variable handling
- Current: Tries Trim-specific carrier promotion (fails)
- Needed: Allow pure local variables (no promotion) in P1/P2
2. String concatenation filter (Phase 178)
- Current: Rejects 'num_str = num_str + ch' conservatively
- Needed: Gradual enablement for JsonParser use cases
Updated documentation:
- joinir-architecture-overview.md: Added Phase 182 status to JsonParser section
- CURRENT_TASK.md: Added Phase 182 completion and Phase 183 next steps
- phase182-simple-loops-design.md: Design memo for Phase 182
2025-12-08 21:41:19 +09:00
6e429624eb
docs(joinir): Update CURRENT_TASK for Phase 181 completion
2025-12-08 21:20:38 +09:00
bd282d3ddd
docs(joinir): Phase 180 completion - Trim/P5 submodule refactoring
...
Phase 180-5: Update documentation and finalize
Changes:
- joinir-architecture-overview.md: Added TrimLoopLowerer section
- phase180-trim-module-design.md: Pattern4 analysis and timeline update
- CURRENT_TASK.md: Added Phase 180 completion entry
Summary:
- Task 180-1: Design document ✅
- Task 180-2: TrimLoopLowerer skeleton ✅
- Task 180-3: Pattern2 refactoring ✅ (-135 lines)
- Task 180-4: Pattern4 analysis (skipped - detection only)
- Task 180-5: Documentation update ✅
Impact:
- Pattern2: 510 → 375 lines (-26%)
- TrimLoopLowerer: 404 lines (new dedicated module)
- Code organization: Single responsibility, high reusability
- Behavior: 100% preserved, refactoring only
- Build: SUCCESS (0 errors)
2025-12-08 21:09:00 +09:00
eb946797f3
docs(joinir): Update architecture docs for Phase 179-B completion
...
Phase 179-B Task 7: Document PatternPipelineContext in architecture
overview and record completion in CURRENT_TASK.md.
Changes:
- joinir-architecture-overview.md: Add PatternPipelineContext section
- Document "解析済みコンテキスト箱" design philosophy
- Explain analyzer-only dependencies and pattern-specific variants
- Add design principles (Pure analysis container, Option<T> patterns, SSOT)
- CURRENT_TASK.md: Add Phase 179-B completion summary
- Record all 7 tasks and their outcomes
- Document line reduction: P1/P3 11%, P2 1.5%, P4 1.9%
- Note design constraints for Pattern 2/4 complexity
Test Results:
- Pattern 1 (loop_min_while.hako): ✅ PASS
- Pattern 2 (joinir_min_loop.hako): ✅ PASS
- Pattern 3 (loop_if_phi.hako): ✅ PASS (sum=9)
- Pattern 4 (loop_continue_pattern4.hako): ✅ PASS (25)
All representative test cases pass with identical behavior.
🤖 Generated with Claude Code (https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-08 19:51:04 +09:00
95f3aa429e
refactor(joinir): Extract legacy binding path to routing_legacy_binding.rs
...
Phase 179-A Step 2: Separate LoopFrontendBinding JSON construction logic
into dedicated module for better organization.
Changes:
- New file: routing_legacy_binding.rs (223 lines)
- routing.rs: cf_loop_joinir_impl() simplified to 15 lines (delegates to legacy path)
- Routing now clearly separates pattern-based vs. legacy binding paths
Benefits:
- Clear separation of concerns (pattern router vs. legacy whitelist)
- routing.rs reduced from 364 to 146 lines (60% reduction)
- Legacy path isolated for future deprecation
2025-12-08 18:36:13 +09:00
99d329096f
feat(joinir): Phase 176 Pattern2 multi-carrier lowering complete
...
Task 176-1: Pattern2 limitation investigation
- Identified 10 limitation points where only position carrier was handled
- Added TODO markers for Phase 176-2/3 implementation
- Created phase176-pattern2-limitations.md documentation
Task 176-2: CarrierUpdateLowerer helper implementation
- Implemented emit_carrier_update() helper function
- Supports CounterLike and AccumulationLike UpdateExpr patterns
- Added 6 unit tests (all passing)
- Fail-Fast error handling for carrier/variable not found
Task 176-3: Pattern2 lowerer multi-carrier extension
- Extended header PHI generation for all carriers
- Implemented loop update for all carriers using emit_carrier_update()
- Extended ExitLine/ExitMeta construction for all carriers
- Updated function call/jump args to include all carriers
- 9/10 tests passing (1 pre-existing test issue)
Task 176-4: E2E testing and bug fixes
- Fixed Trim pattern loop_var_name overwrite bug (pattern2_with_break.rs)
- Fixed InstructionRewriter latch_incoming mapping bug
- All E2E tests passing (RC=0): pos + result dual-carrier loops work
- test_jsonparser_parse_string_min2.hako verified
Task 176-5: Documentation updates
- Created phase176-completion-report.md
- Updated phase175-multicarrier-design.md with completion status
- Updated joinir-architecture-overview.md roadmap
- Updated CURRENT_TASK.md with Phase 176 completion + Phase 177 TODO
- Updated loop_pattern_space.md F-axis (multi-carrier support complete)
Technical achievements:
- Pattern2 now handles single/multiple carriers uniformly
- CarrierInfo architecture proven to work end-to-end
- Two critical bugs fixed (loop_var overwrite, latch_incoming mapping)
- No regressions in existing tests
Next: Phase 177 - Apply to JsonParser _parse_string full implementation
2025-12-08 15:17:53 +09:00
24aa8ced75
feat(joinir): Phase 175 - P5 multi-carrier architecture validation
...
Task 175-1: Analyzed _parse_string carrier candidates
- Identified 3 carriers: pos (position), result (buffer), is_ch_match (promoted)
- Categorized as: required carriers (pos, result), promoted carrier (is_ch_match)
Task 175-2: Validated existing boxes support multi-carrier
- CarrierInfo: Vec<CarrierData> supports arbitrary carriers ✅
- LoopUpdateAnalyzer: Loops over all carriers ✅
- ExitMeta: Vec<(String, ValueId)> supports all exit bindings ✅
- ExitLineReconnector: Reconnects all carriers to variable_map ✅
- No code changes needed - architecture already supports it!
Task 175-3: PoC test revealed Pattern2 limitation
- Test: test_jsonparser_parse_string_min2.hako (pos + result carriers)
- CarrierInfo detected 3 carriers correctly (pos, result, is_ch_match)
- variable_map contains all carriers at pattern2_start
- BUT: Pattern2's Trim optimization only emits pos carrier in MIR
- MIR shows result stays as empty string (no loop update emitted)
- Root cause: Trim pattern focuses on position-only optimization
Task 175-4: Documentation updates
- Created: phase175-multicarrier-design.md (comprehensive analysis)
- Updated: CURRENT_TASK.md (Phase 175 completion)
- Updated: routing.rs (added JsonParserStringTest2 whitelist)
Key Finding:
- Architecture is sound ✅ - all boxes support multi-carrier
- Pattern2 implementation gap ❌ - Trim optimization ignores non-position carriers
- Phase 176 scope: Extend Pattern2 to emit all carrier updates
Next: Phase 176 for escape sequence handling and full multi-carrier emission
2025-12-08 13:34:43 +09:00
309d0803c7
feat(joinir): Phase 174 - JsonParser complex loop P5 extension design
...
- Task 174-1: Complex loop inventory (_parse_string/_parse_array/_parse_object)
- Analyzed remaining JsonParser loops for P5 expansion potential
- Identified _parse_string as most Trim-like structure (99% similarity)
- Documented complexity scores and minimization potential
- Task 174-2: Selected _parse_string as next P5 target (closest to Trim)
- Reason: LoopBodyLocal 'ch' usage matches Trim pattern exactly
- Structure: loop(pos < len) + substring + char comparison + break
- Minimization: Remove escape/buffer/continue → identical to Trim
- Task 174-3: Design doc for P5B extension (TrimLoopHelper reuse strategy)
- File: docs/development/current/main/phase174-jsonparser-p5b-design.md
- Strategy: Reuse existing TrimLoopHelper without modifications
- Proven: Pattern applies to any character comparison, not just whitespace
- Task 174-4: Minimal PoC (_parse_string without escape) successful
- Test: local_tests/test_jsonparser_parse_string_min.hako
- Result: [pattern2/trim] Safe Trim pattern detected ✅
- Detection: Trim with literals=['"'] (quote instead of whitespace)
- Routing: Added whitelist entries for JsonParserStringTest methods
- Task 174-5: Documentation updates
- Updated CURRENT_TASK.md with Phase 174 summary
- Updated joinir-architecture-overview.md with P5 generality proof
- Created phase174-jsonparser-loop-inventory-2.md (detailed analysis)
- Created phase174-jsonparser-p5b-design.md (implementation strategy)
Success Criteria Met:
✅ _parse_string minimized version runs on P5 pipeline
✅ TrimLoopHelper works with '"' (non-whitespace character)
✅ Proven: Trim pattern is character-comparison-generic, not whitespace-specific
✅ Two new design docs (inventory + design)
✅ Phase 175+ roadmap established (multi-carrier, escape sequences)
Technical Achievement:
The P5 Trim pipeline successfully handled a quote-detection loop with zero code changes,
proving the architecture's generality beyond whitespace trimming.
2025-12-08 13:08:44 +09:00
290e97c54c
feat(joinir): Phase 173 - JsonParser P5 expansion with _skip_whitespace
...
- Task 173-1: JsonParser loop inventory recheck
- Observed 6 loops: _trim (2 loops, already working), _skip_whitespace,
_parse_string, _parse_array, _unescape_string
- Created comprehensive observation report with Trim similarity ratings
- Discovered that JsonParser._trim already uses P5 pipeline successfully
- Task 173-2: Selected _skip_whitespace as Trim-equivalent pattern
- Perfect structural match with Trim (100% identical)
- Independent helper method, easy to test
- Frequently used in JsonParser (7 call sites)
- Task 173-3: Design doc for P5 pipeline extension to JsonParser
- Confirmed existing TrimLoopHelper works without modification
- No charAt() support needed (_skip_whitespace uses substring())
- Documented data flow and risk analysis
- Task 173-4: Successfully converted _skip_whitespace to JoinIR
- Created test case: local_tests/test_jsonparser_skip_whitespace.hako
- Added routing whitelist: JsonParserTest._skip_whitespace/3
- Pattern detection SUCCESS:
* LoopBodyLocal 'ch' detected
* Carrier promotion to 'is_ch_match'
* Trim pattern recognized
* JoinIR generation successful
- Verified P5 pipeline works for both static box methods and helper methods
- Task 173-5: Documentation updates
- phase173-jsonparser-loop-recheck.md: Loop observation report
- phase173-jsonparser-p5-design.md: P5 extension design
- phase173-jsonparser-p5-impl.md: Implementation results
- CURRENT_TASK.md: Phase 173 completion record
Key achievement: Proven that Trim P5 pipeline is fully generic -
works for both TrimTest (static box method) and JsonParser (helper method).
LoopBodyLocal carrier promotion is production-ready for Trim-like patterns.
Changes:
- src/mir/builder/control_flow/joinir/routing.rs: Add JsonParserTest whitelist
- docs/development/current/main/*173*.md: 3 new documentation files
- CURRENT_TASK.md: Phase 173 completion entry
2025-12-08 10:13:34 +09:00
cbeab6abd7
feat(joinir): Phase 201 - JoinInlineBoundaryBuilder expansion to Pattern3/4
...
- Task 201-1: Established canonical Builder pattern documentation
- Created docs/development/current/main/joinir-boundary-builder-pattern.md
- Documented Builder usage patterns for all patterns (P1/P2/P3/P4)
- Added reference comments in pattern lowerers
- Task 201-2: Refactored Pattern3 to use Builder (removed field mutations)
- Replaced new_with_exit_bindings + field mutation with Builder chain
- Pattern3: 2 carriers (i + sum), exit_bindings, loop_var_name
- Proper LoopExitBinding struct usage
- Task 201-3: Refactored Pattern4 to use Builder (continue/Trim support)
- Replaced new_with_exit_bindings + field mutation with Builder chain
- Pattern4: Dynamic carrier count, proper boundary construction
- Task 201-4: Added unit tests for Pattern3/4 style boundaries
- test_builder_pattern3_style: Two carriers, exit_bindings validation
- test_builder_pattern4_style: Dynamic carrier count validation
- Verified no field mutations remain (exit_binding.rs uses deprecated fields only)
- Task 201-5: Updated architecture docs and CURRENT_TASK
- joinir-architecture-overview.md: Builder now applied to all patterns
- CURRENT_TASK.md: Phase 201 completion entry
All patterns now use consistent boundary construction via Builder.
Tests: All patterns pass (挙動不変).
2025-12-08 06:14:03 +09:00
891c39c67f
docs(joinir): Task 200-4 - Update CURRENT_TASK and overview for Phase 200 Pipeline Cleanup
...
- Added Phase 200 completion status to CURRENT_TASK.md
- Updated joinir-architecture-overview.md with:
- JoinInlineBoundaryBuilder (Phase 200-2)
- JoinIRVerifier (Phase 200-3)
- Phase 200 achievements:
- Task 200-1: Pattern × Box matrix table (21 boxes documented)
- Task 200-2: Builder pattern for JoinInlineBoundary (Pattern2 pilot)
- Task 200-3: Debug contract verifier for LoopHeader PHI/ExitLine
- Task 200-4: Documentation updates
Phase 200 cleanup focuses on pipeline structure improvement without
changing behavior, establishing foundation for future refactoring.
2025-12-08 04:35:13 +09:00
14c84fc583
feat(joinir): Phase 171 complete - Trim pattern LoopBodyLocal promotion
...
Phase 171-C-4/5 + impl-Trim: Full Trim pattern validation infrastructure
## CarrierInfo 統合 (C-4)
- CarrierInfo::merge_from(): Deduplicated carrier merging
- TrimPatternInfo::to_carrier_info(): Conversion helper
- Pattern2/4: Promoted carrier merge integration
- 7 unit tests for merge logic
## TrimLoopHelper 設計 (C-5)
- TrimLoopHelper struct: Trim-specific validation box
- carrier_type(), initial_value(), whitespace helpers
- CarrierInfo::trim_helper() accessor
- 5 unit tests
## Validation-Only Integration (impl-Trim)
- TrimLoopHelper::is_safe_trim(), is_trim_like(), has_valid_structure()
- Pattern2/4: Trim exception route with safety validation
- body_locals extraction from loop body AST
- LoopBodyCarrierPromoter: ASTNode::Local handler extension
- 4 unit tests for safety validation
## Architecture
- Box Theory: TrimLoopHelper is "validation only" (no JoinIR generation)
- Fail-Fast: Non-Trim LoopBodyLocal immediately rejected
- Whitelist approach: Only Trim pattern bypasses LoopBodyLocal restriction
Tests: 16 new unit tests, all passing
E2E: test_trim_main_pattern.hako validation successful
Next: Phase 172 - Actual JoinIR lowering for Trim pattern
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-08 02:41:53 +09:00
88400e7e22
feat(joinir): Phase 171-C-2 Trim pattern detection in LoopBodyCarrierPromoter
...
Implements the Trim pattern detection logic for carrier promotion:
- find_definition_in_body(): Iterative AST traversal to locate variable definitions
- is_substring_method_call(): Detects substring() method calls
- extract_equality_literals(): Extracts string literals from OR chains (ch == " " || ch == "\t")
- TrimPatternInfo: Captures detected pattern details for carrier promotion
This enables Pattern 5 to detect trim-style loops:
```hako
loop(start < end) {
local ch = s.substring(start, start+1)
if ch == " " || ch == "\t" || ch == "\n" || ch == "\r" {
start = start + 1
} else {
break
}
}
```
Unit tests cover:
- Simple and nested definition detection
- substring method call detection
- Single and chained equality literal extraction
- Full Trim pattern detection with 2-4 whitespace characters
Next: Phase 171-C-3 integration with Pattern 2/4 routing
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-07 23:09:25 +09:00
3e82f2b670
docs(phase170-d): Phase 170-D-impl-4 Completion - Tests and Documentation
...
## Summary
Completed Phase 170-D-impl-4: Comprehensive documentation and test verification
for LoopConditionScopeBox infrastructure. All four implementation phases (1-4)
now complete with full modular Box-based architecture and thorough test coverage.
## Changes
### New Documentation
- **phase170-d-impl-design.md** (1,356 lines): Comprehensive design document
- Architecture overview and modular components
- Detailed implementation summary for all 4 phases
- Test results and verification procedures
- Architecture decisions (Box Theory, Fail-Fast, Conservative Classification)
- Future work for Phase 170-D-E and Phase 171+
### Updated Documentation
- **CURRENT_TASK.md**: Added Phase 170-D completion section
- Full status overview
- Completed work breakdown
- Test verification results
- Commit history
- Architecture summary
## Implementation Status
### Phase 170-D-impl Complete Summary
**Phase 170-D-impl-1** ✅
- LoopConditionScopeBox skeleton (220 lines)
- CondVarScope enum and data structures
- Public API design
**Phase 170-D-impl-2** ✅
- Minimal analysis logic (317 lines)
- Pure functions: extract_all_variables, is_outer_scope_variable
- 12 comprehensive unit tests
**Phase 170-D-impl-3** ✅
- Pattern 2/4 integration
- Fail-Fast validation checks
- 4 integration tests in loop_with_break_minimal.rs
**Phase 170-D-impl-4** ✅
- Design documentation
- Test verification and results
- Architecture guide
### Module Structure
```
src/mir/loop_pattern_detection/
├── mod.rs (201 lines)
├── loop_condition_scope.rs (220 lines)
└── condition_var_analyzer.rs (317 lines)
Total: 738 lines
```
### Test Results
✅ Unit Tests: 16 total (12 in condition_var_analyzer + 4 in loop_with_break_minimal)
✅ Integration Tests: 2 verified (Pattern 2 accept/reject cases)
✅ Build: cargo build --release (0 errors, 50 warnings)
✅ Verification: NYASH_JOINIR_STRUCTURE_ONLY=1 tests pass
## Architecture Highlights
- **Box Theory**: Clear separation of LoopConditionScopeBox (orchestration) and
condition_var_analyzer (pure functions)
- **Fail-Fast**: Early error detection before JoinIR generation
- **Conservative Classification**: Defaults to LoopBodyLocal for unknown variables
- **Reusable**: Pure functions independent and composition-friendly
## Future Work
Phase 170-D-E: Advanced Patterns (Pattern 5+)
- Support loop-body-local variables in conditions
- Expanded scope heuristics
- Selective pattern detection
Phase 171: Condition Environment Integration
- Tighter coupling with condition_to_joinir
- Enhanced variable mapping
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com >
2025-12-07 21:43:08 +09:00
4e32a803a7
feat(joinir): Phase 33-22 CommonPatternInitializer & JoinIRConversionPipeline integration
...
Unifies initialization and conversion logic across all 4 loop patterns,
eliminating code duplication and establishing single source of truth.
## Changes
### Infrastructure (New)
- CommonPatternInitializer (117 lines): Unified loop var extraction + CarrierInfo building
- JoinIRConversionPipeline (127 lines): Unified JoinIR→MIR→Merge flow
### Pattern Refactoring
- Pattern 1: Uses CommonPatternInitializer + JoinIRConversionPipeline (-25 lines)
- Pattern 2: Uses CommonPatternInitializer + JoinIRConversionPipeline (-25 lines)
- Pattern 3: Uses CommonPatternInitializer + JoinIRConversionPipeline (-25 lines)
- Pattern 4: Uses CommonPatternInitializer + JoinIRConversionPipeline (-40 lines)
### Code Reduction
- Total reduction: ~115 lines across all patterns
- Zero code duplication in initialization/conversion
- Pattern files: 806 lines total (down from ~920)
### Quality Improvements
- Single source of truth for initialization
- Consistent conversion flow across all patterns
- Guaranteed boundary.loop_var_name setting (prevents SSA-undef bugs)
- Improved maintainability and testability
### Testing
- All 4 patterns tested and passing:
- Pattern 1 (Simple While): ✅
- Pattern 2 (With Break): ✅
- Pattern 3 (If-Else PHI): ✅
- Pattern 4 (With Continue): ✅
### Documentation
- Phase 33-22 inventory and results document
- Updated joinir-architecture-overview.md with new infrastructure
## Breaking Changes
None - pure refactoring with no API changes
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com >
2025-12-07 21:02:20 +09:00
35f5a48eb0
docs(joinir): Phase 33 Completion - Box Theory Modularization Summary
...
## Phase 33: Complete JoinIR Modularization via Box Theory (3 Phases)
This commit consolidates the comprehensive modularization work across three phases:
- Phase 33-10: Exit Line Modularization (ExitLineReconnector + ExitMetaCollector Boxes)
- Phase 33-11: Quick Wins (Pattern 4 stub clarification, unused imports cleanup)
- Phase 33-12: Large Module Modularization (split mod.rs, loop_patterns.rs restructuring)
### Phase 33-10: Exit Line Modularization (Boxes P0-P1)
**New Files**:
- `exit_line/reconnector.rs` (+130 lines): ExitLineReconnector Box
- Responsibility: Update host variable_map with remapped exit values
- Design: Phase 197-B multi-carrier support (each carrier gets specific remapped value)
- Pure side effects: Only updates builder.variable_map
- Testing: Independent unit testing possible without full merge machinery
- `exit_line/meta_collector.rs` (+102 lines): ExitMetaCollector Box
- Responsibility: Construct exit_bindings from ExitMeta + variable_map lookup
- Design: Pure function philosophy (no side effects except variable_map reads)
- Reusability: Pattern-agnostic (works for Pattern 1, 2, 3, 4)
- Algorithm: For each carrier in exit_meta, lookup host ValueId, create binding
- `exit_line/mod.rs` (+58 lines): ExitLineOrchestrator facade
- Coordination: Orchestrates Phase 6 boundary reconnection
- Architecture: Delegates to ExitLineReconnector (demonstrates Box composition)
- Documentation: Comprehensive header explaining Box Theory modularization benefits
**Modified Files**:
- `merge/mod.rs` (-91 lines): Extracted reconnect_boundary() → ExitLineReconnector
- Made exit_line module public (was mod, now pub mod)
- Phase 6 delegation: Local function call → ExitLineOrchestrator::execute()
- Added exit_bindings' join_exit_values to used_values for remapping (Phase 172-3)
- `patterns/pattern2_with_break.rs` (-20 lines): Uses ExitMetaCollector
- Removed: Manual exit_binding construction loop
- Added: Delegated ExitMetaCollector::collect() for cleaner caller code
- Benefit: Reusable collector for all pattern lowerers (Pattern 1-4)
**Design Philosophy** (Exit Line Module):
Each Box handles one concern:
- ExitLineReconnector: Updates host variable_map with exit values
- ExitMetaCollector: Constructs exit_bindings from ExitMeta
- ExitLineOrchestrator: Orchestrates Phase 6 reconnection
### Phase 33-11: Quick Wins
**Pattern 4 Stub Clarification** (+132 lines):
- Added comprehensive header documentation (106 lines)
- Made `lower()` return explicit error (not silent stub)
- Migration guide: Workarounds using Pattern 1-3
- New file: `docs/development/proposals/phase-195-pattern4.md` (implementation plan)
- Status: Formal documentation that Pattern 4 is deferred to Phase 195
**Cleanup**:
- Removed unused imports via `cargo fix` (-10 lines, 11 files)
- Files affected: generic_case_a/ (5 files), if_merge.rs, if_select.rs, etc.
### Phase 33-12: Large Module Modularization
**New Files** (Modularization):
- `if_lowering_router.rs` (172 lines): If-expression routing
- Extracted from mod.rs lines 201-423
- Routes if-expressions to appropriate JoinIR lowering strategies
- Single responsibility: If expression dispatch
- `loop_pattern_router.rs` (149 lines): Loop pattern routing
- Extracted from mod.rs lines 424-511
- Routes loop patterns to Pattern 1-4 implementations
- Design: Dispatcher pattern for pattern selection
- `loop_patterns/mod.rs` (178 lines): Pattern dispatcher + shared utilities
- Created as coordinator for per-pattern files
- Exports all pattern functions via pub use
- Utilities: Shared logic across pattern lowerers
- `loop_patterns/simple_while.rs` (225 lines): Pattern 1 lowering
- `loop_patterns/with_break.rs` (129 lines): Pattern 2 lowering
- `loop_patterns/with_if_phi.rs` (123 lines): Pattern 3 lowering
- `loop_patterns/with_continue.rs` (129 lines): Pattern 4 stub
**Modified Files** (Refactoring):
- `lowering/mod.rs` (511 → 221 lines, -57%):
- Removed try_lower_if_to_joinir() (223 lines) → if_lowering_router.rs
- Removed try_lower_loop_pattern_to_joinir() (88 lines) → loop_pattern_router.rs
- Result: Cleaner core module with routers handling dispatch
- `loop_patterns.rs` → Re-export wrapper (backward compatibility)
**Result**: Clearer code organization
- Monolithic mod.rs split into focused routers
- Large loop_patterns.rs split into per-pattern files
- Better maintainability and testability
### Phase 33: Comprehensive Documentation
**New Architecture Documentation** (+489 lines):
- File: `docs/development/architecture/phase-33-modularization.md`
- Coverage: All three phases (33-10, 33-11, 33-12)
- Content:
- Box Theory principles applied
- Complete statistics table (commits, files, lines)
- Code quality analysis
- Module structure diagrams
- Design patterns explanation
- Testing strategy
- Future work recommendations
- References to implementation details
**Source Code Comments** (+165 lines):
- `exit_line/mod.rs`: Box Theory modularization context
- `exit_line/reconnector.rs`: Design notes on multi-carrier support
- `exit_line/meta_collector.rs`: Pure function philosophy
- `pattern4_with_continue.rs`: Comprehensive stub documentation + migration paths
- `if_lowering_router.rs`: Modularization context
- `loop_pattern_router.rs`: Pattern dispatch documentation
- `loop_patterns/mod.rs`: Per-pattern structure benefits
**Project Documentation** (+45 lines):
- CLAUDE.md: Phase 33 completion summary + links
- CURRENT_TASK.md: Current state and next phases
### Metrics Summary
**Phase 33 Total Impact**:
- Commits: 5 commits (P0, P1, Quick Wins×2, P2)
- Files Changed: 15 files modified/created
- Lines Added: ~1,500 lines (Boxes + documentation + comments)
- Lines Removed: ~200 lines (monolithic extractions)
- Code Organization: 2 monolithic files → 7 focused modules
- Documentation: 1 comprehensive architecture guide created
**mod.rs Impact** (Phase 33-12 P2):
- Before: 511 lines (monolithic)
- After: 221 lines (dispatcher + utilities)
- Reduction: -57% (290 lines extracted)
**loop_patterns.rs Impact** (Phase 33-12 P2):
- Before: 735 lines (monolithic)
- After: 5 files in loop_patterns/ (178 + 225 + 129 + 123 + 129)
- Improvement: Per-pattern organization
### Box Theory Principles Applied
1. **Single Responsibility**: Each Box handles one concern
- ExitLineReconnector: variable_map updates
- ExitMetaCollector: exit_binding construction
- if_lowering_router: if-expression dispatch
- loop_pattern_router: loop pattern dispatch
- Per-pattern files: Individual pattern lowering
2. **Clear Boundaries**: Public/private visibility enforced
- Boxes have explicit input/output contracts
- Module boundaries clearly defined
- Re-exports for backward compatibility
3. **Replaceability**: Boxes can be swapped/upgraded independently
- ExitLineReconnector can be optimized without affecting ExitMetaCollector
- Per-pattern files can be improved individually
- Router logic decoupled from lowering implementations
4. **Testability**: Smaller modules easier to unit test
- ExitMetaCollector can be tested independently
- ExitLineReconnector mockable with simple boundary
- Pattern lowerers isolated in separate files
### Design Patterns Introduced
1. **Facade Pattern**: ExitLineOrchestrator
- Single-entry point for Phase 6 reconnection
- Hides complexity of multi-step process
- Coordinates ExitLineReconnector + other steps
2. **Dispatcher Pattern**: if_lowering_router + loop_pattern_router
- Centralized routing logic
- Easy to add new strategies
- Separates dispatch from implementation
3. **Pure Function Pattern**: ExitMetaCollector::collect()
- No side effects (except reading variable_map)
- Easy to test, reason about, parallelize
- Reusable across all pattern lowerers
### Testing Strategy
- **Unit Tests**: Can test ExitMetaCollector independently
- **Integration Tests**: Verify boundary reconnection works end-to-end
- **Regression Tests**: Pattern 2 simple loop still passes
- **Backward Compatibility**: All existing imports still work
### Future Work
- **Phase 33-13**: Consolidate whitespace utilities (expected -100 lines)
- **Phase 34**: Extract inline_boundary validators (expected 3h effort)
- **Phase 35**: Mark loop_patterns_old.rs as legacy and remove (Phase 35+)
- **Phase 195**: Implement Pattern 4 (continue) fully
- **Phase 200+**: More complex loop patterns and optimizations
🧱 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-07 04:03:42 +09:00
e30116f53d
feat(joinir): Phase 171-fix ConditionEnv/ConditionBinding architecture
...
Proper HOST↔JoinIR ValueId separation for condition variables:
- Add ConditionEnv struct (name → JoinIR-local ValueId mapping)
- Add ConditionBinding struct (HOST/JoinIR ValueId pairs)
- Modify condition_to_joinir to use ConditionEnv instead of builder.variable_map
- Update Pattern2 lowerer to build ConditionEnv and ConditionBindings
- Extend JoinInlineBoundary with condition_bindings field
- Update BoundaryInjector to inject Copy instructions for condition variables
This fixes the undefined ValueId errors where HOST ValueIds were being
used directly in JoinIR instructions. Programs now execute (RC: 0),
though loop variable exit values still need Phase 172 work.
Key invariants established:
1. JoinIR uses ONLY JoinIR-local ValueIds
2. HOST↔JoinIR bridging is ONLY through JoinInlineBoundary
3. condition_to_joinir NEVER accesses builder.variable_map
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-07 01:45:03 +09:00
b8a9d08894
feat(joinir): Phase 165 Pattern4 (continue) validation complete - ALL PATTERNS NOW WORKING!
...
- Created 3 representative Pattern4 test cases:
* test_pattern4_simple_continue.hako - Simple continue loop (odd number sum)
* test_pattern4_parse_string.hako - String parsing with escape + continue
* test_pattern4_parse_array.hako - Array element parsing with continue
- Validated Pattern4_WithContinue detection:
* All 3 test cases: Pattern4_WithContinue MATCHED ✅
* JoinIR lowering successful (20-24 blocks → 14-20 blocks)
* [joinir/freeze] elimination: Complete (no errors on any test)
- Verified execution correctness:
* test_pattern4_simple_continue: Sum=25 (1+3+5+7+9) ✅ CORRECT
* test_pattern4_parse_string: Execution successful, expected error handling
* test_pattern4_parse_array: Execution successful, expected error handling
- **MAJOR MILESTONE**: All 4 Loop Patterns Now Complete!
* Pattern1 (Simple): 6 loops ✅
* Pattern2 (Break): 5 loops ✅
* Pattern3 (If-Else PHI): 1 loop ✅
* Pattern3+break (as Pattern2): 3 loops ✅
* Pattern4 (Continue): 3 loops ✅
* Total: 18 loops covered, zero [joinir/freeze] errors!
- Updated CURRENT_TASK.md with Phase 165 section and complete statistics
Next phases:
* Phase 166: JsonParserBox full implementation & verification
* Phase 167: .hako JoinIR Frontend prototype development
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-06 16:25:33 +09:00
701f1fd650
feat(joinir): Phase 164 Pattern3 (If-Else PHI) validation complete
...
- Created 4 representative test cases for Pattern3 patterns:
* test_pattern3_if_phi_no_break.hako - Core Pattern3 (if-else PHI, no break/continue)
* test_pattern3_skip_whitespace.hako - Pattern3+break style (routed to Pattern2)
* test_pattern3_trim_leading.hako - Pattern3+break style (routed to Pattern2)
* test_pattern3_trim_trailing.hako - Pattern3+break style (routed to Pattern2)
- Validated Pattern3_WithIfPhi detection:
* Pattern routing: Pattern3_WithIfPhi MATCHED confirmed
* JoinIR lowering: 3 functions, 20 blocks → 8 blocks (successful)
* [joinir/freeze] elimination: Complete (no errors on any test)
- Clarified pattern classification:
* Pattern3_WithIfPhi handles if-else PHI without break/continue
* Loops with "if-else PHI + break" are routed to Pattern2_WithBreak
* Break takes priority over if-else PHI in pattern detection
- Cumulative achievement (Phase 162-164):
* Pattern1: 6 loops working ✅
* Pattern2: 5 loops working ✅
* Pattern3 (no break): 1 loop working ✅
* Pattern3+break (as Pattern2): 3 loops working ✅
* Total: 15 loops covered, zero [joinir/freeze] errors
- Updated CURRENT_TASK.md with Phase 164 section and findings
Next: Phase 165 Pattern4 (continue) validation
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-06 16:22:38 +09:00
ae61226691
feat(joinir): Phase 197 Pattern4 multi-carrier exit fix & AST-based update
...
Phase 197-B: Multi-Carrier Exit Mechanism
- Fixed reconnect_boundary() to use remapper for per-carrier exit values
- ExitMeta now uses carrier_param_ids (Jump arguments) instead of
carrier_exit_ids (k_exit parameters)
- Root cause: k_exit parameters aren't defined when JoinIR functions
merge into host MIR
Phase 197-C: AST-Based Update Expression
- LoopUpdateAnalyzer extracts update patterns from loop body AST
- Pattern4 lowerer uses UpdateExpr for semantically correct RHS
- sum = sum + i → uses i_next (current iteration value)
- count = count + 1 → uses const_1
Files modified:
- src/mir/builder/control_flow/joinir/merge/mod.rs
- src/mir/join_ir/lowering/loop_with_continue_minimal.rs
- src/mir/join_ir/lowering/loop_update_analyzer.rs (new)
Test results:
- loop_continue_multi_carrier.hako: 25, 5 ✅
- loop_continue_pattern4.hako: 25 ✅
Pattern 1–4 now unified with:
- Structure-based detection (LoopFeatures + classify)
- Carrier/Exit metadata (CarrierInfo + ExitMeta)
- Boundary connection (JoinInlineBoundary + LoopExitBinding)
- AST-based update expressions (LoopUpdateAnalyzer)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-06 14:46:33 +09:00
d28ba4cd9d
refactor(joinir): Phase 193-1 - AST Feature Extractor Box modularization
...
**Phase 193-1**: Create independent AST Feature Extractor Box module
## Summary
Extracted feature detection logic from router.rs into a new, reusable
ast_feature_extractor.rs module. This improves:
- **Modularity**: Feature extraction is now a pure, side-effect-free module
- **Reusability**: Can be used for Pattern 5-6 detection and analysis tools
- **Testability**: Pure functions can be unit tested independently
- **Maintainability**: Clear separation of concerns (router does dispatch, extractor does analysis)
## Changes
### New Files
- **src/mir/builder/control_flow/joinir/patterns/ast_feature_extractor.rs** (+180 lines)
- `detect_continue_in_body()`: Detect continue statements
- `detect_break_in_body()`: Detect break statements
- `extract_features()`: Full feature extraction pipeline
- `detect_if_else_phi_in_body()`: Pattern detection for if-else PHI
- `count_carriers_in_body()`: Heuristic carrier counting
- Unit tests for basic functionality
### Modified Files
- **src/mir/builder/control_flow/joinir/patterns/router.rs**
- Removed 75 lines of feature detection code
- Now delegates to `ast_features::` module
- Phase 193 documentation in comments
- Cleaner separation of concerns
- **src/mir/builder/control_flow/joinir/patterns/mod.rs**
- Added module declaration for ast_feature_extractor
- Updated documentation with Phase 193 info
## Architecture
```
router.rs (10 lines)
└─→ ast_feature_extractor.rs (180 lines)
- Pure functions for AST analysis
- No side effects
- High reusability
- Testable in isolation
```
## Testing
✅ Build succeeds: `cargo build --release` compiles cleanly
✅ Binary compatibility: Existing .hako files execute correctly
✅ No logic changes: Feature detection identical to previous implementation
## Metrics
- Lines moved from router to new module: 75
- New module total: 180 lines (including tests and documentation)
- Router.rs reduced by ~40% in feature detection code
- New module rated ⭐ ⭐ ⭐ ⭐ ⭐ for reusability and independence
## Next Steps
- Phase 193-2: CarrierInfo Builder Enhancement
- Phase 193-3: Pattern Classification Improvement
- Phase 194: Further pattern detection optimizations
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-06 03:30:03 +09:00
0397df5240
refactor(joinir): Phase 189 - Remove hardcoded 'sum' variable, generalize exit PHI connection
...
Key improvements:
1. **Eliminate hardcoded variable name**: Replace hardcoded "sum" with generic
ValueId-based variable_map updates. Add new JoinInlineBoundary constructor
`new_with_input_and_host_outputs()` for Pattern 3.
2. **Generalize output slot mapping**: Exit PHI result now updates all host_outputs
entries in variable_map, not just hardcoded "sum". Prepares for future
multi-carrier patterns.
3. **PHI preservation in blocks**: Fix block finalization to preserve existing
PHI instructions (from handle_select) instead of overwriting them.
4. **Stable function name→ValueId mapping**: Ensure consistent ValueId
assignment for tail call detection across multi-function merges.
5. **Enhanced debugging**: Add detailed logging in block converter and meta
analysis for PHI verification.
Files modified:
- src/mir/builder/control_flow.rs: Remove hardcoded "sum", use boundary outputs
- src/mir/join_ir/lowering/inline_boundary.rs: Add new constructor
- src/mir/join_ir_vm_bridge/joinir_block_converter.rs: Stable mappings, PHI preservation
- src/mir/join_ir_vm_bridge/meta.rs: Debug output for PHI tracking
- src/mir/builder/joinir_id_remapper.rs: PHI value remapping
- src/mir/builder/joinir_inline_boundary_injector.rs: Span preservation
Test status: Pattern 3 (loop_if_phi.hako) still produces correct result (sum=9, RC=9)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: ChatGPT <noreply@openai.com >
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-05 19:39:54 +09:00
67395e67d9
docs: Update CURRENT_TASK.md with Phase 188 completion summary
2025-12-05 16:00:31 +09:00
074fab8459
fix(joinir): Phase 189 HashMap collision bug fix - composite keys
...
Problem: Multiple JoinIR functions had blocks with identical BasicBlockIds
(e.g., func_0 and func_2 both had BasicBlockId(0)), causing HashMap key
collisions in merge_joinir_mir_blocks(). This corrupted block mappings
and prevented multi-function JoinIR→MIR merge.
Solution: Use composite keys (String, BasicBlockId) instead of simple
BasicBlockId in the global block_map to guarantee uniqueness across
functions.
Implementation:
- Line 399: Changed block_map type to HashMap<(String, BasicBlockId), BasicBlockId>
- Lines 491-507: Added per-function local_block_map for remap compatibility
- Lines 610-616: Updated entry function block_map access to use composite key
Verification:
- Build: ✅ 0 errors (34 unrelated warnings)
- Coverage: ✅ 100% (all 4 block_map accesses use composite keys)
- Performance: ✅ O(1) HashMap lookups maintained
Phase 189 Status: ✅ COMPLETED (1h vs 4-6h estimate)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-05 11:08:08 +09:00
5bc0fa861f
feat(joinir): Phase 188 Pattern 1 Core Implementation + Phase 189 Planning
...
Phase 188 Status: Planning & Foundation Complete (100%)
Completed Tasks:
✅ Task 188-1: Error Inventory (5 patterns identified)
✅ Task 188-2: Pattern Classification (3 patterns selected)
✅ Task 188-3: Design (51KB comprehensive blueprint)
✅ Task 188-4: Implementation Foundation (1,802 lines scaffolding)
✅ Task 188-5: Verification & Documentation
✅ Pattern 1 Core Implementation: Detection + Lowering + Routing
Pattern 1 Implementation (322 lines):
- Pattern Detection: is_simple_while_pattern() in loop_pattern_detection.rs
- JoinIR Lowering: lower_simple_while_to_joinir() in simple_while_minimal.rs (219 lines)
- Generates 3 functions: entry, loop_step (tail-recursive), k_exit
- Implements condition negation: exit_cond = !(i < 3)
- Tail-recursive Call pattern with state propagation
- Routing: Added "main" to function routing list in control_flow.rs
- Build: ✅ SUCCESS (0 errors, 34 warnings)
Infrastructure Blocker Identified:
- merge_joinir_mir_blocks() only handles single-function JoinIR modules
- Pattern 1 generates 3 functions (entry + loop_step + k_exit)
- Current implementation only merges first function → loop body never executes
- Root cause: control_flow.rs line ~850 takes only .next() function
Phase 189 Planning Complete:
- Goal: Refactor merge_joinir_mir_blocks() for multi-function support
- Strategy: Sequential Merge (Option A) - merge all functions in call order
- Effort estimate: 5.5-7.5 hours
- Deliverables: README.md (16KB), current-analysis.md (15KB), QUICKSTART.md (5.8KB)
Files Modified/Created:
- src/mir/loop_pattern_detection.rs (+50 lines) - Pattern detection
- src/mir/join_ir/lowering/simple_while_minimal.rs (+219 lines) - Lowering
- src/mir/join_ir/lowering/loop_patterns.rs (+803 lines) - Foundation skeleton
- src/mir/join_ir/lowering/mod.rs (+2 lines) - Module registration
- src/mir/builder/control_flow.rs (+1 line) - Routing fix
- src/mir/builder/loop_frontend_binding.rs (+20 lines) - Binding updates
- tools/test_phase188_foundation.sh (executable) - Foundation verification
- CURRENT_TASK.md (updated) - Phase 188/189 status
Next: Phase 189 implementation (merge_joinir_mir_blocks refactor)
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-05 07:47:22 +09:00
2d41039f62
docs: Phase 188 Task 188-5 CURRENT_TASK.md Update
...
Phase 188 Status: 80% COMPLETE - Foundation Ready for Implementation
Updated CURRENT_TASK.md to reflect Phase 188 completion status:
- ✅ Task 188-1: Error Inventory (5 patterns)
- ✅ Task 188-2: Pattern Classification (3 selected)
- ✅ Task 188-3: Design (51KB blueprint)
- ✅ Task 188-4: Implementation Foundation (1,802 lines)
- ✅ Task 188-5: Verification & Documentation (COMPLETE)
Foundation Verification:
- ✅ cargo build --release: SUCCESS (0 errors)
- ✅ Foundation tests: PASS (8/8)
- ✅ Pattern detection module: 338 lines
- ✅ Lowering functions module: 803 lines
- ✅ Router integration: 153 lines
- ✅ Implementation roadmap: 508 lines
Ready for Implementation:
- Pattern 1 (Simple While): 6-8h
- Pattern 2 (Break): 6-10h
- Pattern 3 (If-Else PHI): 6-10h
Next: Implement is_simple_while_pattern() in src/mir/loop_pattern_detection.rs
Updated docs/private submodule with test-results.md and all Phase 188 docs.
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-05 00:47:06 +09:00
6d6853e08e
docs: Update CURRENT_TASK.md with Phase 187 completion and Phase 188 planning
...
Add comprehensive documentation for:
- Phase 187: LoopBuilder Physical Removal (all 4 tasks completed)
- Deleted 8 files (~1000 LOC) from src/mir/loop_builder/
- Preserved only IfInLoopPhiEmitter in new minimal module
- Verified JoinIR-only path with explicit error messages
- Clean SSOT established for loop lowering
- Phase 188: JoinIR Loop Pattern Expansion (planning ready)
- 5 sequential tasks: Inventory → Classify → Design → Implement → Verify
- Goal: Implement 2-3 representative loop patterns
- Estimated effort: 18-28 hours
- Full documentation in phase-188-joinir-loop-pattern-expansion/README.md
This establishes the clean pipeline for Phase 188 execution.
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-05 00:00:57 +09:00
fa8a96a51b
docs(joinir): Phase 187 LoopBuilder Physical Removal - Completion Documentation
...
## Changes
- Added Phase 187 section to Phase 180 README documenting complete LoopBuilder deletion
- Documented all 4 tasks completion (187-1 through 187-4)
- Added architectural impact analysis before/after Phase 187
- Documented code deletion summary and archival strategy
- Explained NYASH_LEGACY_LOOPBUILDER variable status after deletion
## Key Achievements
- LoopBuilder module (8 files, ~1000+ lines) completely deleted
- IfInLoopPhiEmitter preserved in minimal new module
- JoinIR Frontend is now sole authoritative loop lowering system
- Explicit failures replace implicit fallbacks
## Architectural Impact
- Single authoritative path (JoinIR Frontend)
- No implicit fallbacks
- Future JoinIR expansion is only way forward
- Fail-Fast principle enforced at architecture level
## Related Phases
- Phase 185: Strict mode semantics unified
- Phase 186: Hard freeze with access control guard
- Phase 187: Physical module deletion (this change)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-04 23:51:49 +09:00
1e350a6bc5
docs(joinir): Phase 186-4 Documentation Update - LoopBuilder Usage Prohibition
...
## Changes
- Added Phase 186 section to Phase 180 README documenting hard freeze
- Established LoopBuilder as **legacy/dev-only**
- Documented NYASH_LEGACY_LOOPBUILDER as dev toggle with planned removal
- Documented Phase 187 (physical removal) transition plan
## Architecture Decisions Documented
1. Explicit Environment Variable Over Feature Flag
- Dev-only toggles should be explicit and ephemeral
- NYASH_LEGACY_LOOPBUILDER intended for eventual removal
2. Error Over Silent Fallback
- Fail-Fast principle: developers aware of legacy paths
- Clear error messages with developer guidance
3. Single Guard Point Over Scattered Checks
- 箱化モジュール化 principle: isolated at entry/exit
- Guard at the single LoopBuilder instantiation point
## Documentation Structure
- Phase 186.1-6: Implementation details, verification, architecture impact
- Phase 186.7: Transition to Phase 187
- Phase 186.8-9: Key decisions and commits
- Phase 187 preview: Physical removal plan
## Related Issues
- Completes Phase 186 hard freeze implementation
- Prepares foundation for Phase 187 physical removal
- Aligns with JoinIR-only mainline strategy
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-04 23:37:47 +09:00
6561832545
feat(joinir): Phase 185 Strict Mode Semantics Cleanup
...
Remove redundant strict checks from If lowering (3 → 1 check point):
- mod.rs: Remove 2 strict panic blocks from try_lower_if_to_joinir()
- mod.rs: Comment out unused strict_on variable
- Keep single strict check at caller level (if_form.rs)
This aligns If lowering architecture with Loop lowering:
- Lowerers are thin Result-returning boxes (no policy decisions)
- Strict mode check happens at router/caller level (single source of truth)
- Fail-Fast principle: panic at ONE location when strict=ON
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-12-04 22:27:12 +09:00