## 問題 Stage-1ブリッジで `StringHelpers.skip_ws/2` 呼び出し時に: - ParserBox.length(receiver=ValueId未定義) でVM落ち - receiver が捏造される(型情報なし) ## 根本原因 1. CalleeResolver: receiver型なし→捏造ValueId生成 2. 順序問題: materialization → guard(逆であるべき) 3. 型注釈不足: String定数・BinOp結果に型情報なし ## 解決策(3 Phase) ### Phase 1: guard.rs Global フォールバック (lines 100-146) - receiver型なし→Global変換で捏造ValueId防止 - Phase 3-C: 文字列メソッド→StringBox正規化追加 ### Phase 2: unified_emitter.rs 順序反転 (lines 176-188) - guard FIRST → materialization (Method のみ) - Global 呼び出しの receiver 実体化を回避 ### Phase 3-A: emit_string 型注釈 (constant.rs:46-49) - String定数に value_types + value_origin_newbox 登録 ### Phase 3-B: BinOp(Add) 型注釈強化 (ops.rs:70-86,145-166,178-198) - value_origin_newbox もチェック(value_types のみ→両方) - 結果も両方のマップに登録 ### Phase 3-C: StaticCompiler 文字列メソッド正規化 (guard.rs:106-129) - length/substring等→StringBox.method に統一 - ParserBox.length → StringBox.length ## 検証 ✅ RC=0 達成(apps/tests/stage1_skip_ws_repro.hako) ✅ 正規化トレース確認(ParserBox→StringBox) ✅ receiver捏造完全防止 Co-Authored-By: ChatGPT5 <chatgpt@openai.com>
MIR Builder — Calls SSOT
Scope
- This directory is the single source of truth for call shaping in the builder.
- Responsibilities: target resolution, extern mapping, method lookup, flags/effects, MIR emission.
Out of scope
- Runtime dispatch details (VM/LLVM) and legacy by-name resolution. The VM keeps a legacy resolver only behind a dev flag for bring-up.
Contract
- Builder must populate
MirInstruction::Callwith a concreteCalleewhenever possible. - Arity and canonical names are normalized here so runtimes can be simple routers.
Phase-3 alignment
- VM call resolver is treated as legacy-only. Default runtime disables by-name fallback.
- Extern interface normalization aligns with
handlers/calls/externs.rs(runtime SSOT for extern dispatch).