feat(constant): Phase 84-1 Add type annotations for all constant types
Const命令の型アノテーション欠如を根本的に修正。 ## 変更内容 5つの emit 関数に型登録を追加: - emit_integer → MirType::Integer - emit_bool → MirType::Bool - emit_float → MirType::Float - emit_null → MirType::Unknown (Null型が存在しないため) - emit_void → MirType::Void emit_string は既に実装済み (Phase 3-A)。 ## 成果 - Case D 大幅削減 (詳細は Phase 84 テスト結果で確認) - 残り 12 件は edge copy / loop break/continue 関連 - Task先生予測の GroupA (Const欠如) を完全解決 ## 設計原則 emit_string と同じパターンを踏襲: ```rust b.value_types.insert(dst, crate::mir::MirType::Integer); ``` ## 次のステップ Phase 84-2: Copy命令型伝播の徹底 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -13,6 +13,8 @@ pub fn emit_integer(b: &mut MirBuilder, val: i64) -> ValueId {
|
||||
dst,
|
||||
value: ConstValue::Integer(val),
|
||||
});
|
||||
// Phase 84-1: Integer constant type annotation
|
||||
b.value_types.insert(dst, crate::mir::MirType::Integer);
|
||||
dst
|
||||
}
|
||||
|
||||
@ -23,6 +25,8 @@ pub fn emit_bool(b: &mut MirBuilder, val: bool) -> ValueId {
|
||||
dst,
|
||||
value: ConstValue::Bool(val),
|
||||
});
|
||||
// Phase 84-1: Bool constant type annotation
|
||||
b.value_types.insert(dst, crate::mir::MirType::Bool);
|
||||
dst
|
||||
}
|
||||
|
||||
@ -33,6 +37,8 @@ pub fn emit_float(b: &mut MirBuilder, val: f64) -> ValueId {
|
||||
dst,
|
||||
value: ConstValue::Float(val),
|
||||
});
|
||||
// Phase 84-1: Float constant type annotation
|
||||
b.value_types.insert(dst, crate::mir::MirType::Float);
|
||||
dst
|
||||
}
|
||||
|
||||
@ -58,6 +64,9 @@ pub fn emit_null(b: &mut MirBuilder) -> ValueId {
|
||||
dst,
|
||||
value: ConstValue::Null,
|
||||
});
|
||||
// Phase 84-1: Null constant type annotation
|
||||
// Note: MirType has no Null variant, using Unknown as fallback
|
||||
b.value_types.insert(dst, crate::mir::MirType::Unknown);
|
||||
dst
|
||||
}
|
||||
|
||||
@ -68,5 +77,7 @@ pub fn emit_void(b: &mut MirBuilder) -> ValueId {
|
||||
dst,
|
||||
value: ConstValue::Void,
|
||||
});
|
||||
// Phase 84-1: Void constant type annotation
|
||||
b.value_types.insert(dst, crate::mir::MirType::Void);
|
||||
dst
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user