refactor(mir): Remove TypeContext legacy fields (Phase 2-3/7)
完全移行→削除の安全順序(Option C)に従い、TypeContext の deprecated フィールドと sync helpers を完全削除。 ⚠️ 危険ゾーン: TypeFactsBox 等の同名フィールドと混同しないよう、 ファイル単位で手作業移行を実施。 ## Changes - Migrated all MirBuilder access sites to type_ctx.* (manual, 40+ files) - Removed 3 deprecated fields (value_types, value_kinds, value_origin_newbox) - Removed 2 sync helpers (sync_type_ctx_to_legacy, sync_legacy_to_type_ctx) - Verified TypeFactsBox, CalleeGuardBox unchanged (no false positives) ## Tests - cargo test --release --lib: 1029/1033 PASS - TypeFactsBox integration: PASS (borrowed references unchanged) - Deprecation warnings: 456 → 255 (-201, -44%) ## Safety Verification ✅ TypeFactsBox unchanged (still uses &'a BTreeMap borrowed references) ✅ CalleeGuardBox unchanged ✅ CalleeResolverBox unchanged ✅ BoxCompilationContext unchanged Phase 2 Progress: 3/7 contexts complete (43%) - ✅ MetadataContext - ✅ CoreContext - ✅ TypeContext (this commit) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -17,7 +17,7 @@ pub fn emit_to(
|
||||
b.emit_instruction(MirInstruction::Compare { dst, op, lhs, rhs })?;
|
||||
}
|
||||
// 比較結果は Bool 型(既存実装と同じ振る舞い)
|
||||
b.value_types.insert(dst, MirType::Bool);
|
||||
b.type_ctx.value_types.insert(dst, MirType::Bool);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ pub fn emit_integer(b: &mut MirBuilder, val: i64) -> ValueId {
|
||||
value: ConstValue::Integer(val),
|
||||
});
|
||||
// Phase 84-1: Integer constant type annotation
|
||||
b.value_types.insert(dst, crate::mir::MirType::Integer);
|
||||
b.type_ctx.value_types.insert(dst, crate::mir::MirType::Integer);
|
||||
dst
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ pub fn emit_bool(b: &mut MirBuilder, val: bool) -> ValueId {
|
||||
value: ConstValue::Bool(val),
|
||||
});
|
||||
// Phase 84-1: Bool constant type annotation
|
||||
b.value_types.insert(dst, crate::mir::MirType::Bool);
|
||||
b.type_ctx.value_types.insert(dst, crate::mir::MirType::Bool);
|
||||
dst
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ pub fn emit_float(b: &mut MirBuilder, val: f64) -> ValueId {
|
||||
value: ConstValue::Float(val),
|
||||
});
|
||||
// Phase 84-1: Float constant type annotation
|
||||
b.value_types.insert(dst, crate::mir::MirType::Float);
|
||||
b.type_ctx.value_types.insert(dst, crate::mir::MirType::Float);
|
||||
dst
|
||||
}
|
||||
|
||||
@ -51,9 +51,9 @@ pub fn emit_string<S: Into<String>>(b: &mut MirBuilder, s: S) -> ValueId {
|
||||
});
|
||||
// 🎯 Phase 3-A: String constant type annotation
|
||||
// Ensures string constants have proper Box type for method resolution
|
||||
b.value_types
|
||||
b.type_ctx.value_types
|
||||
.insert(dst, crate::mir::MirType::Box("StringBox".to_string()));
|
||||
b.value_origin_newbox.insert(dst, "StringBox".to_string());
|
||||
b.type_ctx.value_origin_newbox.insert(dst, "StringBox".to_string());
|
||||
dst
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ pub fn emit_null(b: &mut MirBuilder) -> ValueId {
|
||||
});
|
||||
// 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);
|
||||
b.type_ctx.value_types.insert(dst, crate::mir::MirType::Unknown);
|
||||
dst
|
||||
}
|
||||
|
||||
@ -78,6 +78,6 @@ pub fn emit_void(b: &mut MirBuilder) -> ValueId {
|
||||
value: ConstValue::Void,
|
||||
});
|
||||
// Phase 84-1: Void constant type annotation
|
||||
b.value_types.insert(dst, crate::mir::MirType::Void);
|
||||
b.type_ctx.value_types.insert(dst, crate::mir::MirType::Void);
|
||||
dst
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user