feat(joinir): Phase 65-2-A StringBox メソッド型ヒント実装

Phase 65-2-A 完了:P3-A(StringBox メソッド)型ヒント実装

## 実装内容

### 1. type_inference.rs 新規作成
- `infer_method_return_type()`: StringBox/ArrayBox/MapBox メソッド型推論
- `infer_box_type()`: Box コンストラクタ型推論(Phase 65-2-B 用)
- 8 テスト全て PASS

### 2. JoinInst::MethodCall に type_hint 追加
- `src/mir/join_ir/mod.rs`: `type_hint: Option<MirType>` フィールド追加
- 段階的拡大のため Optional 設計(既存コード破壊なし)

### 3. read_quoted.rs で型ヒント設定
- substring() → String(4箇所)
- length() → Integer(1箇所)
- read_quoted 系関数で完全な型ヒント供給

### 4. 汎用経路は None で後方互換性維持
- expr.rs: 汎用 MethodCall は `type_hint: None`
- convert.rs: 型ヒント追加(Phase 65-3 で活用予定)
- json.rs: JSON シリアライズ対応

## テスト結果
-  type_inference モジュール: 8/8 PASS
-  ビルド: 0 エラー

## 次のステップ
- Phase 65-2-B: Box コンストラクタ型ヒント実装

---
🌟 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-11-30 06:10:58 +09:00
parent 6566a3cd12
commit b4b6a01b92
8 changed files with 202 additions and 7 deletions

View File

@ -323,11 +323,15 @@ pub enum JoinInst {
/// Phase 34-6: メソッド呼び出し構造
/// receiver.method(args...) の構造を JoinIR で表現
/// 意味論BoxCall/Call への変換)は JoinIR→MIR ブリッジで実装
///
/// Phase 65-2-A: type_hint で戻り値型を伝播infer_type_from_phi 削減用)
MethodCall {
dst: VarId,
receiver: VarId,
method: String,
args: Vec<VarId>,
/// Phase 65-2-A: 戻り値型ヒントP3-A StringBox メソッド対応)
type_hint: Option<MirType>,
},
/// Phase 56: 条件付きメソッド呼び出しfilter パターン用)