fix(mir-builder): static method arity mismatch根治 - Phase 25.x

**問題**:
- ParserStmtBox.parse_using/4 に5引数が渡される
- me.method呼び出しで instance/static 判別なし
- static method に誤って receiver 追加

**修正**:
- MeCallPolicyBox: params[0]の型で instance/static 判別
- Instance method: receiver 追加
- Static method: receiver なし
- Arity検証(NYASH_ME_CALL_ARITY_STRICT=1)

**ドキュメント**:
- docs/reference/environment-variables.md 新規作成
- docs/development/architecture/mir-logs-observability.md 更新

**テスト**:
- src/tests/mir_stage1_cli_emit_program_min.rs 追加
- 既存 stage1 テスト全てパス

Phase: 25.x
This commit is contained in:
nyash-codex
2025-11-21 11:16:38 +09:00
parent b92d9f335d
commit c344451087
15 changed files with 702 additions and 53 deletions

View File

@ -97,12 +97,37 @@
---
### 5. MeCall Arity DebugPhase 25.x追加
**場所**: `src/mir/builder/method_call_handlers.rs`
| 行番号 | タグ | 説明 | 用途 |
|-------|------|-----|------|
| 70-73 | `[me-call] arity mismatch (instance)` | Instance method arity不一致警告 | Dev専用 |
| 98-101 | `[me-call] arity mismatch (static)` | Static method arity不一致警告 | Dev専用 |
| 150-154 | `[static-call] emit` | Static method呼び出しトレース | 観測用 |
**有効化環境変数**:
- `NYASH_ME_CALL_ARITY_STRICT=1` - 厳密モード(不一致でエラー返却)
- `NYASH_STATIC_CALL_TRACE=1` - トレースモードwarning出力
**説明**:
- `me.method(...)` 呼び出しのarity検証
- Instance methodreceiver追加vs Static methodreceiver なし)の判別
- ParserStmtBox.parse_using/4 の5引数バグ等の検出
**用途と削除時期**:
- Phase XXstatic box instance化完了後に削除予定
- 過渡期のデバッグ支援ログstatic boxのsingleton化後は不要
---
## 用途別集計表
| 用途 | 件数 | 内容 | 用途と削除時期 |
|-----|-------|-----|----------|
| **Dev専用** | 11 | Stage-1 CLI / StringHelpers デバッグ用 | 削除予定Phase 25.x 完了) |
| **観測用** | 3 | FuncScanner ループ反復観測 | 保持推奨MIR観測 API 昇格) |
| **Dev専用** | 13 | Stage-1 CLI / StringHelpers / MeCall Arity デバッグ用 | 削除予定Phase 25.x 完了) |
| **観測用** | 4 | FuncScanner ループ反復 / Static call トレース | 保持推奨MIR観測 API 昇格) |
| **コメント** | 1 | テスト場所の注釈 | - |
---