diff --git a/docs/development/current/main/10-Now.md b/docs/development/current/main/10-Now.md index 66519fc6..57c0b691 100644 --- a/docs/development/current/main/10-Now.md +++ b/docs/development/current/main/10-Now.md @@ -1,5 +1,13 @@ # Self Current Task — Now (main) +## 2025-12-17:Phase 100 P1 完了 ✅ + +**Phase 100 P1: Pinned Local Captures** +- CapturedEnv に CapturedKind (Explicit/Pinned) 拡張 +- PinnedLocalAnalyzer で loop-outer read-only locals を識別 +- Pinned receiver (例: s.substring()) が loop 内で使用可能に +- Fixture/smoke で動作確認済み + ## 2025‑12‑17:Phase 99 完了 ✅ **Phase 99: Trim/escape 実コード寄り強化(VM+LLVM EXE)** diff --git a/docs/development/current/main/phases/phase-100/README.md b/docs/development/current/main/phases/phase-100/README.md index 7a02b6e2..c7139336 100644 --- a/docs/development/current/main/phases/phase-100/README.md +++ b/docs/development/current/main/phases/phase-100/README.md @@ -42,3 +42,42 @@ loop(i < n) { - **P2(mutable)**: loop body 内で再代入される外側変数は `Pinned` では扱わず、LoopState(carrier/env)に昇格して運ぶ。 - 初期は “更新形を限定” して shape guard を作り、未対応は Fail‑Fast(曖昧に通さない) - **P3(hoist)**: ループ内の不変式の巻き上げは Loop Canonicalizer 側で扱う(別ユースケースとして分離) + +## P1: Pinned Local Captures (Explicit/Pinned) - 完了 ✅ + +Implemented CapturedKind enum to distinguish: +- **Explicit**: Traditional captures (condition variables, carriers) +- **Pinned**: Phase 100 read-only loop-outer locals used as method receivers + +**Status**: P1-1 through P1-5 complete - pinned receiver functionality validated with fixture+smoke tests. + +Example (now works): +```hako +local s = "a" + "b" + "c" # Dynamic construction (loop-outer) +loop(i < 1) { + local ch = s.substring(i, i+1) # Pinned receiver works! + print(i) + i = i + 1 +} +``` + +**Smoke test**: phase100_pinned_local_receiver_vm.sh + +### Implementation Details + +**Search Order (SSOT)**: +1. ConditionEnv (loop-outer scope) +2. LoopBodyLocalEnv (body-local variables - Phase 226 cascading) +3. CapturedEnv (pinned loop-outer locals) +4. CarrierInfo (mutable carriers) + +**Key Components**: +- `CapturedKind` enum: Distinguishes Explicit vs Pinned captures +- `PinnedLocalAnalyzer`: Identifies loop-outer read-only locals +- `loop_body_local_init.rs`: Updated receiver resolution with full search order + +### Test Coverage + +- **Fixture**: `apps/tests/phase100_pinned_local_receiver_min.hako` +- **Smoke Test**: `tools/smokes/v2/profiles/integration/apps/phase100_pinned_local_receiver_vm.sh` +- **Regression**: Phase 96 and Phase 94 smoke tests pass