refactor(mir): Phase 139-P3-B - RoutingDecision を enum 対応 + レガシー削除

- RoutingDecision の missing_caps を Vec<CapabilityTag> に変更(型安全化)
- error_tags は to_tag() メソッドで自動生成
- 全 callsite を enum variant に修正
- capability_tags モジュール(文字列定数群)を完全削除
- 全テスト PASS(型安全性向上を確認)
- フォーマット適用
This commit is contained in:
nyash-codex
2025-12-16 07:02:14 +09:00
parent 146f14a019
commit e404746612
106 changed files with 1475 additions and 1017 deletions

View File

@ -222,7 +222,8 @@ impl super::MirBuilder {
body.clone(),
)?;
// Index static method for fallback resolution of bare calls
self.comp_ctx.static_method_index
self.comp_ctx
.static_method_index
.entry(method_name.clone())
.or_insert_with(Vec::new)
.push((name.clone(), params.len()));
@ -306,14 +307,18 @@ impl super::MirBuilder {
args: vec![],
effects: super::EffectMask::MUT,
})?;
self.type_ctx.value_origin_newbox
self.type_ctx
.value_origin_newbox
.insert(arr_id, "ArrayBox".to_string());
self.type_ctx.value_types
self.type_ctx
.value_types
.insert(arr_id, super::MirType::Box("ArrayBox".to_string()));
// TypeRegistry + trace for deterministic debug
self.comp_ctx.type_registry
self.comp_ctx
.type_registry
.record_newbox(arr_id, "ArrayBox".to_string());
self.comp_ctx.type_registry
self.comp_ctx
.type_registry
.record_type(arr_id, super::MirType::Box("ArrayBox".to_string()));
type_trace::origin("newbox:ArrayLiteral", arr_id, "ArrayBox");
type_trace::ty(
@ -350,13 +355,17 @@ impl super::MirBuilder {
args: vec![],
effects: super::EffectMask::MUT,
})?;
self.type_ctx.value_origin_newbox
self.type_ctx
.value_origin_newbox
.insert(map_id, "MapBox".to_string());
self.type_ctx.value_types
self.type_ctx
.value_types
.insert(map_id, super::MirType::Box("MapBox".to_string()));
self.comp_ctx.type_registry
self.comp_ctx
.type_registry
.record_newbox(map_id, "MapBox".to_string());
self.comp_ctx.type_registry
self.comp_ctx
.type_registry
.record_type(map_id, super::MirType::Box("MapBox".to_string()));
type_trace::origin("newbox:MapLiteral", map_id, "MapBox");
type_trace::ty(
@ -404,13 +413,16 @@ impl super::MirBuilder {
if let Some(cls) = self.type_ctx.value_origin_newbox.get(&target_val) {
return Some(cls.clone());
}
self.type_ctx.value_types.get(&target_val).and_then(|ty| match ty {
super::MirType::Box(name) => Some(name.clone()),
super::MirType::String => Some("String".to_string()),
super::MirType::Integer => Some("Integer".to_string()),
super::MirType::Float => Some("Float".to_string()),
_ => None,
})
self.type_ctx
.value_types
.get(&target_val)
.and_then(|ty| match ty {
super::MirType::Box(name) => Some(name.clone()),
super::MirType::String => Some("String".to_string()),
super::MirType::Integer => Some("Integer".to_string()),
super::MirType::Float => Some("Float".to_string()),
_ => None,
})
}
fn format_index_target_kind(class_hint: Option<&String>) -> String {