## Summary Implemented fail-fast validation for PHI ordering and value resolution in strict mode. ## Changes ### P1-1: Strict mode for "PHI after terminator" - File: `src/llvm_py/phi_wiring/wiring.py::ensure_phi` - Behavior: `NYASH_LLVM_PHI_STRICT=1` → RuntimeError if PHI created after terminator - Default: Warning only (no regression) ### P1-2: Strict mode for "fallback 0" - File: `src/llvm_py/phi_wiring/wiring.py::wire_incomings` - Behavior: Strict mode forbids silent fallback to 0 (2 locations) - Location 1: Unresolvable incoming value - Location 2: Type coercion failure - Error messages point to next debug file: `llvm_builder.py::_value_at_end_i64` ### P1-3: Connect verify_phi_ordering() to execution path - File: `src/llvm_py/builders/function_lower.py` - Behavior: Verify PHI ordering after all instructions emitted - Debug mode: Shows "✅ All N blocks have correct PHI ordering" - Strict mode: Raises RuntimeError with block list if violations found ## Testing ✅ Test 1: strict=OFF - passes without errors ✅ Test 2: strict=ON - passes without errors (no violations in test fixtures) ✅ Test 3: debug mode - verify_phi_ordering() connected and running ## Scope - LLVM harness (Python) changes only - No new environment variables (uses existing 3 from Phase 277 P2) - No JoinIR/Rust changes (root fix is Phase 279) - Default behavior unchanged (strict mode opt-in) ## Next Steps - Phase 278: Remove deprecated env var support - Phase 279: Root fix - unify "2本のコンパイラ" pipelines 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2.4 KiB
2.4 KiB
Phase 275 P1 (docs/lock): Update types.md + lock coercion matrix
Status: planned / instruction sheet
This is the follow-up after Phase 275 P0 (implementation) lands.
Prereq:
- Phase 275 P0 is complete and VM/LLVM smokes are green.
- Decisions are frozen in
docs/development/current/main/phases/phase-274/P3-DECISIONS.md.
1) Update the language SSOT doc
File:
docs/reference/language/types.md
Edits:
- Move “Accepted (Phase 275)” rules from “pending” into the current executable SSOT sections:
- truthiness:
Voidand non-bridgeBoxRefbecomeTypeError ==: B2 (Number-only) with precise Int↔Float; Bool↔Number has no coercion+: C2 (Number-only promotion) + String+String only; String mixedTypeError
- truthiness:
- Add a short “Migration notes” subsection:
- how to rewrite old code (
x != Void,str(x), interpolation) - explicitly call out any intentionally-breaking changes
- how to rewrite old code (
Acceptance:
types.mdno longer describes the legacy behavior (e.g.Void -> falsein conditions,"a"+1concat).
2) Add the minimum test matrix fixtures (SSOT lock)
Goal:
- prevent semantic drift by locking the truthiness /
==/+matrix in fixtures + smokes.
Add fixtures under apps/tests/ (minimal, self-contained):
apps/tests/phase275_p0_truthiness_min.hakoapps/tests/phase275_p0_eq_min.hakoapps/tests/phase275_p0_plus_min.hako
Rules:
- no env toggles required
- no dependency on unsupported externs/symbols on LLVM line
Add smokes under tools/smokes/v2/profiles/integration/apps/:
phase275_p0_truthiness_vm.sh/phase275_p0_truthiness_llvm.shphase275_p0_eq_vm.sh/phase275_p0_eq_llvm.shphase275_p0_plus_vm.sh/phase275_p0_plus_llvm.sh
Acceptance:
- all 6 smokes pass (expected exit codes fixed and documented in the scripts).
3) Update “Now / Backlog”
Files:
docs/development/current/main/10-Now.mddocs/development/current/main/30-Backlog.mddocs/development/current/main/phases/phase-275/README.md
Edits:
- Mark Phase 275 as ✅ complete (P0 done; P1 done).
- Move any remaining work (warnings/lints, broader coercion coverage) into Phase 276+ entries.
4) Optional: add diagnostics without new env vars (future phase)
If you want to surface legacy patterns proactively (without changing semantics again), create a new phase and keep it strictly “diagnostic-only”:
- warnings for
if Void, string-mixed+, etc. - no behavior toggles via new env vars